/* ==========================================================================
   Instruments — catalog with live faceplate thumbnails, and the instrument
   workspace header that sits above the faceplate and mapping deck.
   ========================================================================== */

.instrument-heading { position: relative; overflow: hidden; padding: 30px 32px; margin-bottom: 18px; border-radius: var(--r-xl);
  background: radial-gradient(700px 300px at 90% -20%, rgba(94,230,200,.18), transparent 70%), radial-gradient(500px 260px at 0% 120%, rgba(255,181,71,.08), transparent 70%), linear-gradient(135deg, #131c1b, #0e1214);
  box-shadow: var(--shadow-2); }
.instrument-heading h2 { font-size: 32px; letter-spacing: -.03em; margin: 4px 0 8px; }
.instrument-intro { max-width: 70ch; margin: 0; color: var(--ink-2); }
.instrument-tools { position: sticky; top: calc(var(--topbar-h) + 6px); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; margin-bottom: 16px; border-radius: var(--r); background: rgba(20,24,28,.9); backdrop-filter: blur(12px); box-shadow: var(--shadow-2); }
.instrument-tools input { flex: 1; min-width: 240px; padding-left: 38px; background: var(--surface-0) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%238d979f' stroke-width='1.6'/%3E%3Cpath d='m15.5 15.5 5 5' stroke='%238d979f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 12px center/16px no-repeat; }
.instrument-tools select { width: 220px; }
.instrument-count { font: 600 11px var(--mono); letter-spacing: .08em; color: var(--accent); padding: 0 8px; white-space: nowrap; }
.instrument-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.instrument-card { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 0 0 18px; border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 40%), var(--surface-1); box-shadow: var(--shadow-2); transition: transform .15s, box-shadow .15s; }
.instrument-card:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--accent-line), 0 30px 60px -30px rgba(0,0,0,.95), 0 0 40px -20px rgba(94,230,200,.35); }
.instrument-card > :not(.instrument-shot) { margin-inline: 18px; }
.instrument-card:not(:has(.instrument-shot)) { padding-top: 18px; }
.instrument-card .eyebrow { margin-bottom: 2px; }
.instrument-card h3 { font-size: 19px; letter-spacing: -.02em; }
.instrument-card > p { margin-top: 0; margin-bottom: 0; font-size: 12.5px; color: var(--ink-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.instrument-card .instrument-coverage { font-size: 11.5px; color: var(--ink-faint); -webkit-line-clamp: 2; }
.instrument-card .button { margin-top: auto; align-self: flex-start; }
.instrument-shot { position: relative; height: 178px; display: grid; place-items: center; overflow: hidden; padding: 14px 4px;
  background: radial-gradient(80% 90% at 50% 10%, rgba(255,255,255,.07), transparent 70%), repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 1px, transparent 1px 22px), repeating-linear-gradient(90deg, rgba(255,255,255,.015) 0 1px, transparent 1px 22px), #0a0c0e;
  border-bottom: 1px solid var(--line); }
.instrument-shot:not(.ready)::after { content: ""; width: 60%; height: 46%; border-radius: 10px; background: linear-gradient(90deg, #15191c, #1d2226, #15191c); background-size: 200% 100%; animation: shimmer 1.4s linear 4; }
@keyframes shimmer { to { background-position: -200% 0; } }
.instrument-shot .hw-panel { flex: none; transform-origin: center; filter: drop-shadow(0 18px 18px rgba(0,0,0,.6)); transition: transform .25s ease; }
.instrument-card:hover .instrument-shot .hw-panel { transform: scale(1.03); }
.instrument-card-title { display: flex; flex-direction: column; }
.instrument-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.instrument-chips span { padding: 3px 9px; border-radius: 999px; font: 600 10px var(--mono); letter-spacing: .04em; color: var(--ink-2); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); }
.instrument-chips span:first-child { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(94,230,200,.2); }
.generic-card { justify-content: flex-end; padding: 22px 0 18px; background: radial-gradient(400px 220px at 80% 0%, rgba(94,230,200,.16), transparent 70%), linear-gradient(160deg, #18221f, #111517); }
.generic-card h3 { font-size: 24px; }
.instrument-footnote { margin-top: 18px; font-size: 12px; color: var(--ink-faint); }

/* instrument workspace header (inside the controller view) */
.device-workspace { padding: 18px 20px; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 50%), var(--surface-1); box-shadow: var(--shadow-2); }
.device-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.device-title-row h2 { font-size: 26px; letter-spacing: -.025em; margin: 2px 0 6px; }
.device-title-row p:not(.eyebrow) { margin: 0; max-width: 90ch; font-size: 12.5px; color: var(--ink-dim); }
.device-primary-actions { display: flex; gap: 8px; flex: none; }
#deviceContext { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.device-navigation { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.device-section-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--r); background: var(--surface-0); box-shadow: inset 0 0 0 1px var(--line); }
.device-section-tab { min-height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--ink-dim); font-size: 12px; font-weight: 600; white-space: nowrap; }
.device-section-tab:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.device-section-tab.active { color: var(--accent-ink); background: linear-gradient(180deg, #85f1d9, var(--accent)); box-shadow: 0 4px 12px -6px rgba(94,230,200,.8); }
.device-jump { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-dim); }
.device-jump select { width: 240px; }
.device-state-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font: 11.5px var(--mono); color: var(--ink-dim); }
.device-state-line .button { min-height: 32px; font-size: 12px; }
.device-documentation { border-radius: var(--r); background: var(--surface-0); box-shadow: inset 0 0 0 1px var(--line); }
.device-documentation summary { padding: 10px 14px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
#deviceDocumentation { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 22px; padding: 4px 16px 16px; }
#deviceDocumentation h4 { margin: 8px 0 6px; font-size: 12px; letter-spacing: .04em; color: var(--accent); }
#deviceDocumentation ul { margin: 0; padding-left: 18px; font-size: 12px; color: var(--ink-dim); }
#deviceDocumentation li { margin-bottom: 4px; }
#deviceDocumentation a { display: block; margin-bottom: 4px; font-size: 12px; color: var(--ink-2); text-underline-offset: 3px; }
#deviceDocumentation a:hover { color: var(--accent); }
.device-read-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-0); box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; }
.device-read-controls label { display: flex; align-items: center; gap: 8px; }
.device-read-controls input { width: 70px; }
.device-read-controls small { color: var(--ink-faint); }
.instrument-panel-mount { margin: 2px 0; }
.instrument-panel-loading { padding: 40px; text-align: center; color: var(--ink-dim); border-radius: var(--r-lg); background: var(--surface-1); }

/* ADSR helper on the deck (section envelopes) */
.device-envelope { margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: #020405; box-shadow: inset 0 0 0 1px #000, 0 0 0 5px #0b0d0f, 0 0 0 6px rgba(255,255,255,.06); color: var(--oled-ink, #6af0d2); }
.device-envelope-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 6px; }
.device-envelope-heading .eyebrow { color: rgba(106,240,210,.6); }
.device-envelope-heading h3 { font: 700 14px var(--mono); color: #e9fff9; }
.device-envelope-heading > span { font: 10px var(--mono); color: rgba(106,240,210,.45); }
.device-envelope svg { width: 100%; height: 130px; display: block; overflow: visible; }
.envelope-grid { stroke: rgba(106,240,210,.1); stroke-width: 1; fill: none; }
.envelope-line { stroke: #6af0d2; stroke-width: 2.5; fill: rgba(106,240,210,.08); stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(106,240,210,.6)); }
.device-envelope circle { fill: #020405; stroke: #6af0d2; stroke-width: 2; cursor: grab; }
.device-envelope circle:hover { fill: #6af0d2; }
.envelope-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.envelope-controls input { width: 100%; min-width: 0; }
@media (max-width: 760px) { .envelope-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.envelope-controls label { display: flex; flex-direction: column; gap: 4px; font: 600 9.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(106,240,210,.6); }
.envelope-controls output { font: 600 11px var(--mono); color: #d9fff5; }

@media (max-width: 760px) { .instrument-catalog { grid-template-columns: 1fr; } .device-title-row { flex-direction: column; } .instrument-tools select { width: 100%; } .device-jump select { width: 100%; } .instrument-heading { padding: 22px; } }
