/* ============================================================================
   shared/sound-preview.css — the analysis dock (sound-authoring-design.md §6).
   SPEC tokens only; the dock is wide and horizontal because waveforms and
   spectrograms are wide, and a tall narrow preview wastes the axis carrying the
   information (§9.1).
   ========================================================================== */
.sp{display:flex;flex-direction:column;min-height:0;background:var(--panel)}
/* ---- the compare bar (§6.2) — two slots, and the one number that says "closer" -------------
   It sits ABOVE the view tabs because it changes what every view below it is showing: with a
   slot B loaded, the waveform overlays, the spectrum subtracts, the spectrogram subtracts. A
   mode that changes the meaning of the whole dock belongs above the dock, not inside one tab. */
.sp-cmp{display:flex;align-items:center;gap:10px;padding:6px 10px;background:var(--panel);border-bottom:1px solid var(--line);font-size:11px}
.sp-slot{display:flex;align-items:center;gap:6px;padding:3px 8px;border-radius:6px;background:var(--well);color:var(--text2);max-width:260px}
.sp-slot .tag{font:600 10px 'Figtree','Segoe UI',sans-serif;letter-spacing:.06em;color:var(--faint)}
.sp-slot .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:11px Consolas,monospace;color:var(--ink)}
.sp-slot.empty .nm{color:var(--faint);font-style:italic}
.sp-slot.drop{outline:2px dashed var(--accent);outline-offset:-2px}
.sp-cmp .score{margin-left:auto;display:flex;align-items:center;gap:8px}
.sp-cmp .score .k{color:var(--muted)}
.sp-cmp .score .v{font:600 12px Consolas,monospace;color:var(--accent-text);font-variant-numeric:tabular-nums}
.sp-cmp .score .v.far{color:var(--warn)}
.sp-cmp canvas.hist{width:110px;height:22px;background:var(--well);border-radius:5px}
.sp-cmp .blind{display:inline-flex;align-items:center;gap:5px;color:var(--text2);cursor:pointer}
.sp-cmp .note{color:var(--faint)}
/* ---- the trigger surface (§9.1) ------------------------------------------------------------
   Above the compare bar, because it is what makes the sound the rest of the dock measures. */
.tr{background:var(--panel);border-bottom:1px solid var(--line)}
.tr-row{display:flex;align-items:center;gap:8px;padding:6px 10px;font-size:11px;flex-wrap:wrap}
/* NO control declarations here. A transport button is the `.btn.sm` ATOM and a device picker is
   `.selin.sm`; the local `.tr-row button` / `.tr-midi select` rules that used to sit here were a
   second implementation of both verbs (21px tall, radius 6, beside the library's 24 and 8) and
   read as correct on their own page — which is exactly how a fork survives
   (theme-and-component-library.md §2, §4). Only `.tr-play` remains, and it is a STATE modifier
   painted on top of the atom, not a button of its own. */
.tr-play{background:var(--accent)!important;color:var(--on-accent)!important;font-weight:600!important}
.tr-play.on{background:var(--accent-text)!important}
.tr-play.err{background:var(--danger)!important;color:#1a0d10!important}
.tr-tog{display:inline-flex;align-items:center;gap:5px;color:var(--text2);cursor:pointer}
.tr-tog input{accent-color:var(--accent)}
.tr-oct{display:inline-flex;align-items:center;gap:5px;color:var(--text2);white-space:nowrap}
.tr-v{font:11px Consolas,monospace;color:var(--ink);font-variant-numeric:tabular-nums;min-width:46px}
.tr-sep{width:1px;height:16px;background:var(--line)}
.tr-note{color:var(--muted)}
.tr-note.err{color:var(--danger)}
.tr-midi{margin-left:auto;display:flex;align-items:center;gap:6px}
.tr-midi .err{color:var(--danger)}.tr-midi .warn{color:var(--warn)}.tr-midi .muted{color:var(--faint)}
/* The full A0–C8 piano remains visible as one keyboard. Its labels are intentionally sparse: C
   markers establish octave geography, while the chosen two-octave QWERTY window is bright enough
   to read without turning 88 narrow keys into 88 unreadable captions. */
.tr-kb{display:flex;gap:1px;padding:0 10px 8px;height:56px;overflow:hidden}
.tr-key{position:relative;flex:1 1 0;min-width:0;border-radius:0 0 4px 4px;background:#C9CCD6;cursor:pointer;display:flex;align-items:flex-end;justify-content:center;padding-bottom:3px;user-select:none}
.tr-key .note{position:absolute;bottom:3px;left:50%;transform:translateX(-50%);font:7px Consolas,monospace;color:#565B6B}
.tr-key .lbl{position:absolute;top:3px;left:50%;transform:translateX(-50%);font:8px Consolas,monospace;color:#565B6B;font-weight:700}
.tr-key.black{background:#23252E;height:64%}
.tr-key.black .note,.tr-key.black .lbl{color:#8F93A3}
.tr-key.qwerty .lbl{color:var(--accent-text)}
.tr-key:hover{filter:brightness(1.08)}
.tr-key.on{background:var(--accent)}
.tr-key.black.on{background:var(--accent-text)}
.tr-key:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
/* view tabs — one treatment across the set (design-pattern-consistency): text label,
   same emphasis, only the word varies. Active takes the panel-tab surface, not the
   accent: the accent belongs to the primary action, and a tab is context. */
.sp-tabs{display:flex;gap:2px;padding:6px 8px 0;overflow-x:auto;scrollbar-width:none}
.sp-tabs::-webkit-scrollbar{display:none}
.sp-tab{flex:0 0 auto;padding:5px 10px;border-radius:6px 6px 0 0;font-size:11.5px;color:var(--text2);cursor:pointer;white-space:nowrap;user-select:none}
.sp-tab:hover{background:var(--hover)}
.sp-tab.on{background:var(--card);color:var(--ink)}
.sp-tab:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
/* the control bar for the ACTIVE view only — a control that belongs to a hidden view is
   not disabled, it is absent (ui-and-authoring-docs §1: no clutter). */
.sp-ctl{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;padding:7px 10px;background:var(--card);border-bottom:1px solid var(--line)}
.sp-c{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--muted)}
.sp-c > label{white-space:nowrap}
.sp-c .rng{width:96px;flex:0 0 96px}
.tr-row .rng{width:88px;flex:0 0 88px}
.tr-oct .inp{width:44px;text-align:center}
.sp-c .v{font:11px Consolas,monospace;color:var(--ink);font-variant-numeric:tabular-nums;min-width:52px;text-align:right}
.sp-c .tg{display:inline-flex;align-items:center;gap:5px;cursor:pointer;color:var(--text2)}
.sp-c .tg input{accent-color:var(--accent)}
.sp-sp{flex:1}
/* the primary action of the dock: render the graph again. One per section, accent-filled. */
.sp-render{background:var(--accent);color:var(--on-accent);border:0;border-radius:6px;font:600 11px 'Figtree','Segoe UI',sans-serif;padding:4px 11px;cursor:pointer}
.sp-render:hover{filter:brightness(1.08)}
.sp-render:disabled{opacity:.45;cursor:not-allowed}
.sp-render:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
/* the plot */
.sp-plot{position:relative;flex:1;min-height:0;background:var(--well)}
.sp-plot canvas{display:block;width:100%;height:100%}
.sp-msg{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:20px;font-size:12px;color:var(--muted);line-height:1.6}
/* An author `display` rule OUTRANKS the user-agent's `[hidden]{display:none}`, so setting
   `.hidden = true` on this element did nothing and "Press Render to measure this graph" was
   painted over every plot the dock ever drew. The attribute was set correctly and the computed
   style disagreed with it — which is exactly why the verification rule says to read the COMPUTED
   style and never the intent. */
.sp-msg[hidden]{display:none}
.sp-msg.err{color:var(--danger)}
.sp-msg b{color:var(--text2)}
/* the read-out strip — the numbers each view measures. Tabular so a changing value does
   not shift its neighbours. */
.sp-read{display:flex;flex-wrap:wrap;gap:0 18px;padding:6px 10px;background:var(--card);border-top:1px solid var(--line);font-size:11px}
.sp-read .k{color:var(--muted)}
.sp-read .n{color:var(--ink);font:11px Consolas,monospace;font-variant-numeric:tabular-nums;margin-left:5px}
.sp-read .n.warn{color:var(--warn)}
.sp-read .n.bad{color:var(--danger)}
.sp-read .n.ok{color:var(--accent-text)}
.sp-read .none{color:var(--faint);font-style:italic}

/* ---- the audition scene (the one element view) ---------------------------------------------
   It occupies the plot area, so it is sized by the same box every plot is: the 3-D stage takes
   the space, and the placement read-out sits beside it as a card column rather than under it,
   because distance/gain/pan are read WHILE dragging the listener and a read-out below the fold
   would not be. */
.sp-3d{position:absolute;inset:0}
.au-wrap{display:flex;gap:8px;height:100%}
.au-stage{position:relative;flex:1;min-width:0;border-radius:9px;overflow:hidden;background:var(--well)}
.au-cv{width:100%;height:100%;display:block}
.au-msg{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  padding:16px;text-align:center;color:var(--faint);font-size:11px}
.au-msg[hidden]{display:none}
.au-side{width:206px;flex:none;display:flex;flex-direction:column;gap:8px;overflow:auto}
.au-card{background:var(--card);border-radius:9px;padding:8px 9px}
.au-h{font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--text2);margin-bottom:6px;
  display:flex;justify-content:space-between;align-items:baseline;gap:6px}
.au-ro{text-transform:none;letter-spacing:0;color:var(--faint);font-size:9px}
.au-row{display:flex;justify-content:space-between;gap:8px;padding:2px 0;font-size:11px;color:var(--text2)}
.au-row b{color:var(--ink);font:11px Consolas,monospace;font-variant-numeric:tabular-nums;font-weight:400}
.au-row b.ok{color:var(--accent-text)}
.au-row b.warn{color:var(--warn)}
.au-row b.bad{color:var(--danger)}
.au-t{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--text2);padding:3px 0;cursor:pointer}
.au-hint{color:var(--faint);font-size:10px;line-height:1.45;margin:6px 0 8px}
.au-btn{width:100%;height:26px;border:0;border-radius:8px;background:var(--accent);color:var(--on-accent);
  font-size:11px;font-weight:600;cursor:pointer}
.au-btn:hover{filter:brightness(1.06)}
.au-btn:disabled{opacity:.45;cursor:default}

/* The transport status, on its own full-width line (see sound-transport.js). It is the component's
   longest string and appears exactly when something is wrong, so it gets a line nothing else
   competes for — and in the failed case a danger-tinted band, because "audio unavailable" needs to
   read as a failure at a glance rather than as one more grey caption. */
.tr-note{padding:4px 10px 6px;color:var(--muted);font-size:11px;line-height:1.4}
.tr-note.err{color:var(--danger);background:rgba(239,106,122,.10);font-weight:600}

/* ---- the piano roll (§7.1) — the sub-editor a Pattern node opens -----------------------------
   The canvas sizes itself from the view's rowH/beatW, so this only owns the frame around it. */
.pr{background:var(--well);border-radius:9px;overflow:auto;outline:0}
.pr:focus-visible{box-shadow:0 0 0 2px var(--accent) inset}
.pr-cv{display:block;cursor:crosshair}
