/* ============================================================================
   SirenSense — Bench Instrument  (rev 2)
   Direction: grounded candidate 3/7 (test-bench instrument face) · seed 475c31c8
   Raises: console-dashboard (one active state) · streaming-wall (focus model) ·
   risograph (flat inks + grain) · phosphor (persistence) · akari (warmth) ·
   layered-papercut (depth by overlap, never shading)

   rev 2 fixes: real grid instead of -46% margin · cool instrument grey, off the
   "cream + terracotta" cluster · graticule drawn as SVG, not repeating gradients
   · secondary text and active state raised to 4.5:1 · 12.5px text floor ·
   mobile header overflow.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* Cool instrument ground — a bench under neutral light, not cream, not a void. */
  --bench:    #dee3e1;   /* panel ground */
  --bench-2:  #ccd3d1;   /* recessed */
  --bench-3:  #eaeeed;   /* raised plate */

  --ink:      #14181a;
  --ink-2:    #363d40;   /* 8.9:1 on --bench */
  --ink-3:    #545d61;   /* 5.1:1 on --bench (was 3.4:1) */
  /* Light text on --ink. One token: the stamp line and the code plate were
     two values 2% apart doing the same job. */
  --on-ink:   #e5eae8;

  --rule:     #9aa4a3;
  --rule-2:   #b6bfbd;

  /* Four flat channel inks — one per microphone. Data colours, not decoration. */
  --ch-n:     #16337a;
  --ch-e:     #9b2f1c;
  --ch-s:     #0d544d;
  --ch-w:     #5d4a14;

  /* The single active state — darkened to clear 4.5:1 on the ground. */
  --active:   #8a5100;

  --max: 1180px;
  --gut: clamp(16px, 4vw, 40px);

  /* Exponential ease-out. No bounce, no elastic. */
  --out:  cubic-bezier(.16, 1, .3, 1);
  --fast: cubic-bezier(.22, .61, .36, 1);

  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bench);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--active);
}

/* Grain — the deliberate imperfection of a printed sheet. */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none; opacity: .05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* Browser surfaces, themed. */
::selection { background: var(--active); color: #fff; }
:focus-visible { outline: 2px solid var(--active); outline-offset: 2px; }
* { scrollbar-color: var(--rule) var(--bench-2); scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bench-2); }
::-webkit-scrollbar-thumb { background: var(--rule); border: 3px solid var(--bench-2); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; left: 12px; top: -80px; z-index: 300;
  background: var(--ink); color: #fff;
  padding: 12px 16px; font-size: 13.5px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* One plain line, not a flex wrapper: a flex container here reads as a wrapper
   whose children sit against the strip edge, and the gutter is a clamp() the
   length resolver cannot measure. Inline text sidesteps both. */
.stampbar {
  margin: 0; padding: 10px var(--gut);
  background: var(--ink); color: var(--on-ink);
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .03em;
}
/* The studio link lives in the top strip, on every page and in both languages. */
.stamp-link { color: var(--on-ink); text-decoration: underline; text-underline-offset: 3px; }
.stamp-link:hover { text-decoration-thickness: 2px; }

/* ------------------------------------------------------------------- bar */
.bar { border-bottom: 1px solid var(--ink); background: var(--bench); }
.bar-in {
  width: min(100% - var(--gut) * 2, var(--max));
  margin-inline: auto; min-height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }

/* The mark is the array: a square with the four-microphone cross cut out. */
.mark { position: relative; width: 22px; height: 22px; background: var(--ink); flex: none; }
.mark::before, .mark::after { content: ""; position: absolute; background: var(--bench); }
.mark::before { left: 50%; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; }
.mark::after  { top: 50%; left: 4px; right: 4px; height: 2px; margin-top: -1px; }

.brand-t { font-weight: 700; letter-spacing: -.015em; line-height: 1.1; font-size: 16.5px; }
.brand-t em {
  display: block; font-style: normal; font-weight: 500;
  font-size: 12.5px; color: var(--ink-3);
}

.nav { display: flex; align-items: center; gap: 20px; }
.nav a {
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  text-decoration: none; text-underline-offset: 3px;
  transition: color .16s var(--fast);
}
.nav a:hover { color: var(--ink); text-decoration: underline; }
.nav-ctl {
  border: 1px solid var(--ink); padding: 9px 14px;
  color: var(--ink) !important; font-weight: 600;
  transition: background .16s var(--fast), color .16s var(--fast);
}
.nav-ctl:hover { background: var(--ink); color: var(--bench) !important; text-decoration: none; }
.nav-ctl .short { display: none; }

/* The language switcher is never hidden: collapsing the section anchors on a
   phone is a simplification, but hiding the only route to the other language
   would break the bilingual parity the site commits to. */
.nav-lang {
  border: 1px solid var(--rule); padding: 7px 10px;
  font-family: var(--mono); font-size: 12.5px !important;
  letter-spacing: .04em; color: var(--ink) !important;
  transition: background .16s var(--fast), color .16s var(--fast);
}
.nav-lang:hover { background: var(--ink); border-color: var(--ink); color: var(--bench-3) !important; text-decoration: none; }

/* ----------------------------------------------------------------- bench
   Graticule drawn as an SVG pattern (fine 18px cells, major 90px rules). */
.bench {
  width: min(100% - var(--gut) * 2, var(--max));
  margin: clamp(18px, 3vw, 34px) auto clamp(40px, 6vw, 76px);
  border: 1px solid var(--ink);
  background-color: var(--bench-3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cdefs%3E%3Cpattern id='f' width='18' height='18' patternUnits='userSpaceOnUse'%3E%3Cpath d='M18 0H0V18' fill='none' stroke='%2314181a' stroke-opacity='.075' stroke-width='1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='90' height='90' fill='url(%23f)'/%3E%3Cpath d='M90 0H0V90' fill='none' stroke='%2314181a' stroke-opacity='.17' stroke-width='1'/%3E%3C/svg%3E");
}

/* Flex/grid children default to min-width:auto, which refuses to shrink below
   their max-content width. Without these the legend pushed the document wider
   than a 390px viewport and the header overflowed. */
.bar-in > *, .bench-head > *, .plot > * { min-width: 0; }

.bench-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px 26px; padding: 14px 18px;
  border-bottom: 1px solid var(--ink); background: var(--bench);
}

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; }
.legend li {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2);
}
.legend li span { color: var(--ink); font-weight: 700; }
.sw { width: 13px; height: 3px; flex: none; }
.sw.n { background: var(--ch-n); }
.sw.e { background: var(--ch-e); }
.sw.s { background: var(--ch-s); }
.sw.w { background: var(--ch-w); }

.readouts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.readouts div { display: flex; align-items: baseline; gap: 7px; }
.readouts dt {
  font-size: 12.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
}
.readouts dd {
  margin: 0; font-family: var(--mono); font-size: 13.5px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
/* The one active state in the whole viewport. */
.readouts .lock-val { color: var(--active); font-weight: 700; }

/* ------------------------------------------------------------------ plot
   Real two-column grid. No percentage negative margins. */
.plot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 310px);
  align-items: start;
}
.traces {
  grid-column: 1 / -1; grid-row: 1;
  display: block; width: 100%; height: clamp(190px, 26vw, 268px);
}
.traces .ch { fill: none; stroke-width: 1.6; mix-blend-mode: multiply; }
.traces .ch.n { stroke: var(--ch-n); }
.traces .ch.e { stroke: var(--ch-e); }
.traces .ch.s { stroke: var(--ch-s); }
.traces .ch.w { stroke: var(--ch-w); }

.trigger { stroke: var(--active); stroke-width: 1.2; stroke-dasharray: 5 4; }
.bearing line { stroke: var(--active); stroke-width: 1.2; }
.bearing path { fill: var(--active); }

/* The lead is a flat plate laid on the field — depth by overlap, no shadow. */
.lead {
  grid-column: 1; grid-row: 2;
  padding: 40px;
  background: var(--bench-3);
  border-top: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
}
.lead h1 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(2rem, 4.6vw, 3.4rem);   /* under the 6rem ceiling */
  line-height: .98;
  letter-spacing: -.03em;                   /* above the -0.04em floor */
}
.lead h1 em { display: block; font-style: normal; color: var(--ch-n); }
.sub {
  max-width: 68ch; margin: 18px 0 0;
  color: var(--ink-2); font-size: 16.5px;
}
/* Authorship is a fact about the project, so it is stated plainly and early. */
.maker {
  margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--rule);
  max-width: 64ch; font-size: 15px; color: var(--ink-2);
}
.maker b { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.ctl {
  display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px;
  border: 1px solid var(--ink);
  font-size: 14.5px; font-weight: 600; text-decoration: none; color: var(--ink);
  transition: background .16s var(--fast), color .16s var(--fast);
}
.ctl:hover { background: var(--ink); color: var(--bench-3); }
.ctl-primary { background: var(--active); border-color: var(--active); color: #fff; }
.ctl-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--bench-3); }

/* The photo is a plated inset at the field's edge. */
.plate {
  grid-column: 2; grid-row: 2; margin: 0;
  border-top: 1px solid var(--ink);
  background: var(--bench);
}
.plate img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.plate figcaption {
  padding: 13px 15px 15px;
  font-size: 12.5px; line-height: 1.45; color: var(--ink-2);
}

/* -------------------------------------------------------------- benchfoot */
.bench-foot { display: flex; flex-wrap: wrap; border-top: 1px solid var(--ink); }
.bench-foot .cell { flex: 1 1 320px; padding: 15px 18px; border-right: 1px solid var(--rule); }
.bench-foot .cell:last-child { border-right: 0; }
.bench-foot dt {
  font-size: 12.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px;
}
.bench-foot dd { margin: 0; font-size: 14px; color: var(--ink-2); max-width: 64ch; }

/* ----------------------------------------------------------------- motion
   ONE authored moment: the capture arrives. Nothing else moves on load. */
@media (prefers-reduced-motion: no-preference) {
  .traces .ch {
    stroke-dasharray: 100 100; stroke-dashoffset: 100;
    animation: draw 1.5s var(--out) forwards;
  }
  .traces .ch.e { animation-delay: .1s; }
  .traces .ch.s { animation-delay: .2s; }
  .traces .ch.w { animation-delay: .3s; }
  .trigger, .bearing { opacity: 0; animation: land .5s var(--out) 1.15s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes land { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .traces .ch { stroke-dasharray: none; stroke-dashoffset: 0; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .plot { grid-template-columns: minmax(0, 1fr); }
  .traces { grid-row: 1; }
  .lead { grid-column: 1; grid-row: 2; border-right: 0; }
  .plate { grid-column: 1; grid-row: 3; border-top: 1px solid var(--rule); }
  .plate img { aspect-ratio: 16 / 9; }
}

@media (max-width: 700px) {
  .nav a:not(.nav-ctl):not(.nav-lang) { display: none; }
  .nav-ctl .long { display: none; }
  .nav-ctl .short { display: inline; }
  .brand-t { font-size: 15.5px; }
  .traces { height: 186px; }
  .lead { padding: 22px 18px 24px; }
  .lead h1 { font-size: clamp(1.85rem, 8.2vw, 2.5rem); }
  .sub { font-size: 15.5px; }
  .bench-head { padding: 13px 15px; }
  .bench-foot .cell { border-right: 0; border-bottom: 1px solid var(--rule); }
  .bench-foot .cell:last-child { border-bottom: 0; }
}

/* ============================================================================
   BANDS — the long-form sections. Solid paper, so the graticule stays the
   exclusive mark of the instrument field at the top of the page.
   ========================================================================== */
.band { margin-top: clamp(30px, 5vw, 60px); }
.band-in {
  width: min(100% - var(--gut) * 2, var(--max));
  margin-inline: auto;
  border: 1px solid var(--ink);
  background: var(--bench-3);
  /* Plain values, not clamp(): some tooling cannot resolve clamp() here. */
  padding: 46px;
}
.band-alt .band-in { background: var(--bench); }

.band-head { max-width: 74ch; margin-bottom: clamp(26px, 3.4vw, 44px); }
.band-head h2 {
  margin: 0 0 14px;
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
  line-height: 1.05; letter-spacing: -.025em; font-weight: 700;
}
.band-head p { margin: 0; color: var(--ink-2); font-size: 16.5px; }
.band-head b { color: var(--ink); }

/* ------------------------------------------------- two-column explainer */
.pair {
  display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: clamp(22px, 3.4vw, 48px); align-items: start;
  padding: 32px 0;
  border-top: 1px solid var(--rule);
}
.pair-rev { grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); }
.pair-rev .pair-txt { order: 1; }
.pair-rev .pair-fig { order: 2; }
.pair-txt h3 {
  margin: 0 0 12px; font-size: 1.28rem;
  letter-spacing: -.015em; font-weight: 700;
}
.pair-txt p { margin: 0 0 14px; color: var(--ink-2); max-width: 68ch; }
.pair-txt b { color: var(--ink); }

/* Formula plate: a flat inset, no coloured edge. */
.eq {
  font-family: var(--mono); font-size: 15px; color: var(--ink);
  background: var(--bench); border: 1px solid var(--rule);
  padding: 14px 16px; margin: 0 0 14px; overflow-x: auto;
}
.eq-inline { font-family: var(--mono); font-size: .92em; color: var(--ink); white-space: nowrap; }

/* ------------------------------------------------------------- diagrams */
.diag { display: block; width: 100%; height: auto; }
.diag .d-ring { fill: none; stroke: var(--rule); stroke-width: 1.2; stroke-dasharray: 4 4; }
.diag .d-ax { stroke: var(--ink); stroke-width: 1.2; }
.diag .d-wave { stroke: var(--ch-n); stroke-width: 1.6; }
.diag .d-wave2 { stroke: var(--ch-n); stroke-width: 1.2; opacity: .5; }
.diag .d-mic { fill: var(--ch-e); }
.diag .d-arc { fill: none; stroke: var(--active); stroke-width: 1.4; }
.diag .d-dim { stroke: var(--ink-2); stroke-width: 1; }
.diag .d-vec { stroke: var(--active); stroke-width: 2; }
.diag .d-pt { fill: var(--active); }
.diag text { font-family: var(--mono); font-size: 16px; }
.diag .d-lab { fill: var(--ink); font-weight: 700; }
.diag .d-lab2 { fill: var(--ink-2); }
.diag .d-lab3 { fill: var(--ink-3); font-size: 14px; }
.diag .sub { font-size: 11px; }

/* ---------------------------------------------------------------- charts */
.fig-wide { margin: clamp(20px, 2.6vw, 30px) 0 0; border-top: 1px solid var(--rule); padding-top: 24px; }
.fig-wide:first-of-type { border-top: 0; }
.chart { display: block; width: 100%; height: auto; min-width: 560px; }
.fig-wide { overflow-x: auto; }
.chart .grid line { stroke: var(--rule-2); stroke-width: 1; }
.chart .curve { fill: none; stroke-width: 2; }
.chart .c-n { stroke: var(--ch-n); }
.chart .c-e { stroke: var(--ch-e); }
.chart .c-w { stroke: var(--ch-w); }
.chart .flat { stroke-dasharray: 7 5; }
.chart .axis text { font-family: var(--mono); font-size: 15px; fill: var(--ink-2); }
.chart .mark line { stroke: var(--active); stroke-width: 1.2; stroke-dasharray: 4 4; }
.chart .mk { fill: none; stroke: var(--active); stroke-width: 2; }
.chart .note { font-family: var(--mono); font-size: 15px; fill: var(--ink-2); }
.chart .sub { font-size: 11px; }
.fig-wide figcaption {
  margin-top: 14px; max-width: 82ch;
  font-size: 14px; line-height: 1.55; color: var(--ink-2);
}
.fig-wide figcaption b { color: var(--ink); font-family: var(--mono); font-size: 13px; letter-spacing: .04em; }

/* ------------------------------------------------------------- pipeline */
.pipe {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
}
.pipe-step { background: var(--bench-3); padding: 20px 20px 22px; }
.pipe-n {
  display: block; margin-bottom: 8px;
  font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--active);
}
.pipe-step b { display: block; font-size: 15.5px; margin-bottom: 7px; }
.pipe-step p { margin: 0; font-size: 14.5px; color: var(--ink-2); }

.note-box {
  margin-top: clamp(22px, 3vw, 32px);
  padding: 20px 22px;
  border: 1px solid var(--ink);
  background: var(--bench);
}
.note-box h3 { margin: 0 0 9px; font-size: 1.06rem; letter-spacing: -.01em; }
.note-box p { margin: 0; color: var(--ink-2); max-width: 76ch; }
.note-box b { color: var(--ink); }

.formula {
  margin-top: clamp(22px, 3vw, 32px);
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.formula p:last-child { margin: 0; color: var(--ink-2); max-width: 76ch; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: .82em; }
.frac span:first-child { border-bottom: 1px solid var(--ink); padding: 0 4px 2px; }
.frac span:last-child { padding: 2px 4px 0; }

/* -------------------------------------------------- explain disclosures */
/* The control sits beside its formula so that adding it costs no vertical
   space. The panel wraps onto its own line; on a narrow screen so does the
   button. Scoping the spacing here keeps the plate's own margin intact
   everywhere a button is not attached. */
.eq-block { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.eq-block .eq { flex: 1 1 auto; min-width: 0; margin: 0; }
.eq-block .eq-x { flex: none; }
.eq-block .eq-x-panel { flex: 1 1 100%; margin: 14px 0 0; }
.eq-block--tail { margin: 16px 0 0; }

.eq-x {
  padding: 9px 14px; min-height: 38px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .16s var(--fast), color .16s var(--fast);
}
.eq-x:hover { background: var(--ink); color: var(--bench-3); }

/* Recessed plate, so it reads as an opened drawer on either band colour. */
.eq-x-panel {
  margin: 14px 0 0; padding: 18px 20px;
  border: 1px solid var(--rule); background: var(--bench-2);
  max-width: 84ch;
}
.eq-x-panel h4 {
  margin: 18px 0 7px; font-size: 13.5px; font-weight: 700;
  letter-spacing: -.005em; color: var(--ink);
}
.eq-x-panel h4:first-of-type { margin-top: 0; }
.eq-x-panel p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.eq-x-panel p:last-child { margin-bottom: 0; }
.eq-x-panel b { color: var(--ink); }
.eq-x-eq {
  font-family: var(--mono); font-size: 13.5px; color: var(--ink);
  background: var(--bench-3); border: 1px solid var(--rule);
  padding: 12px 14px; margin: 0 0 16px; overflow-x: auto;
}
/* Symbol tables: the formula's parameters are tabular data, so they are a real
   table rather than a styled list. */
.eq-x-dl { width: 100%; border-collapse: collapse; margin: 0 0 12px; }
.eq-x-dl th, .eq-x-dl td {
  text-align: left; vertical-align: top;
  padding: 9px 0; border-bottom: 1px solid var(--rule-2);
}
.eq-x-dl th { width: 7.5em; font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--ink); }
.eq-x-dl td { font-size: 14px; color: var(--ink-2); }
.eq-x-dl tr:last-child th, .eq-x-dl tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------- phases */
.phase { margin-top: clamp(26px, 3.4vw, 40px); padding-top: 26px; border-top: 1px solid var(--rule); }
.phase:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.phase-head { max-width: 74ch; margin-bottom: 20px; }
.phase-n {
  display: block; margin-bottom: 8px;
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--active);
}
.phase-head h3 { margin: 0 0 9px; font-size: 1.35rem; letter-spacing: -.015em; }
.phase-head p { margin: 0; color: var(--ink-2); }
.phase-head b { color: var(--ink); }
.mono { font-family: var(--mono); font-size: .93em; }

.gal { display: grid; gap: 12px; }
.gal-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gal-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gal figure { margin: 0; border: 1px solid var(--rule); background: var(--bench-3); }
.gal img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.gal figure:first-child img { aspect-ratio: 4 / 3; }
.gal figcaption { padding: 11px 13px 13px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }

/* ----------------------------------------------------------- spec table */
.spec { width: 100%; border-collapse: collapse; margin: 0; }
.spec th, .spec td {
  text-align: left; vertical-align: top;
  padding: 13px 16px; border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
}
.spec th { width: 32%; font-weight: 600; color: var(--ink); }
.spec td { color: var(--ink-2); }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }
.spec td.tgt { color: var(--active); font-weight: 600; }

@media (max-width: 900px) {
  .pair, .pair-rev { grid-template-columns: minmax(0, 1fr); }
  .pair-rev .pair-txt { order: 2; }
  .pair-rev .pair-fig { order: 1; }
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gal-3, .gal-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  .pipe { grid-template-columns: minmax(0, 1fr); }
  .gal-3, .gal-4 { grid-template-columns: minmax(0, 1fr); }
  .gal img, .gal figure:first-child img { aspect-ratio: 16 / 10; }
  .spec th, .spec td { display: block; width: auto; border-bottom: 0; padding: 6px 0; }
  .spec tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .spec tr:last-child { border-bottom: 0; }
  .spec td { padding-top: 0; }
  /* Stack the disclose control under its formula on a phone. */
  .eq-block .eq, .eq-block .eq-x { flex: 1 1 100%; }
}

/* Status flag on a claim whose evidence is not yet in hand.
   No nowrap: a long flag must be able to wrap, or it forces the whole spec
   table wider than a phone screen. */
.flag {
  display: inline-block; margin-left: 6px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 400;
  letter-spacing: .04em; color: var(--active);
}

/* ============================================================================
   ENGINEERING NOTES — the deep dive the nav points at.
   ========================================================================== */
.note-sec { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--rule); }
.note-sec:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.note-sec h3 { margin: 0 0 12px; font-size: 1.28rem; letter-spacing: -.015em; font-weight: 700; }
.note-sec h4 { margin: 0 0 9px; font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.note-sec p { margin: 0 0 14px; color: var(--ink-2); max-width: 76ch; }
.note-sec p:last-child { margin-bottom: 0; }
.note-sec b { color: var(--ink); }
.note-sec a { color: var(--active); text-underline-offset: 3px; }
.note-sec .spec { margin: 16px 0 0; }
.note-sec .note-box, .note-sec .note-cols { margin-bottom: 16px; }
/* A register is a lookup, not prose: it reads better at a tighter leading. */
.note-sec .spec th, .note-sec .spec td { padding: 10px 14px; font-size: 14px; }

/* A wiring diagram is alignment, not decoration — so it is monospace and flat. */
.wire {
  margin: 16px 0; padding: 14px 16px;
  background: var(--bench-2); border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75; color: var(--ink);
  overflow-x: auto;
}

.note-list { margin: 0 0 16px; padding-left: 20px; }
.note-list li { margin-bottom: 5px; font-size: 15px; color: var(--ink-2); }
.note-list li:last-child { margin-bottom: 0; }

.note-cols {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 36px; align-items: start; margin: 0 0 16px;
}
.note-cols .note-list { margin-bottom: 0; }

/* ============================================================================
   TECHNICAL RECORD PAGE — same system, one long document.
   ========================================================================== */
.band-in h1 {
  margin: 0; font-weight: 700;
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  line-height: 1.02; letter-spacing: -.03em;
}
.crumb {
  display: inline-block; margin-bottom: 22px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em;
  color: var(--ink-3); text-decoration: none;
}
.crumb:hover { color: var(--ink); text-decoration: underline; }
/* Two-up subsection headings on a band: these sit one level under the band's
   h2, so they are h3 and sized to keep a real step away from body text. */
.note-cols h3 { margin: 0 0 9px; font-size: 1.28rem; letter-spacing: -.015em; font-weight: 700; }
.tail-note { margin: 16px 0 0; font-size: 15px; color: var(--ink-2); max-width: 76ch; }

/* Board layouts and KiCad captures are documents, not photographs: show the
   whole frame on a recessed ground rather than cropping the board edges off. */
.gal-natural img { object-fit: contain; background: var(--bench-2); }

/* ============================================================================
   WHAT IT DOES — the plain-language opening. Deliberately free of mathematics:
   this is the part a non-technical reader is expected to finish.
   ========================================================================== */
.nodes {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
}
.node { background: var(--bench-3); padding: 22px 22px 24px; }
.node h3 { margin: 0 0 5px; font-size: 1.28rem; letter-spacing: -.015em; }
/* The role line sits BELOW its heading — it is a gloss, not an eyebrow. */
.node-role {
  margin: 0 0 13px; font-family: var(--mono); font-size: 12.5px;
  letter-spacing: .06em; color: var(--active);
}
.node > p { margin: 0 0 13px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.node ul { margin: 0; padding-left: 18px; }
.node li { margin-bottom: 5px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.node li:last-child { margin-bottom: 0; }

.what-sec { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--rule); }
.subhead { margin: 0 0 10px; font-size: 1.35rem; letter-spacing: -.015em; }
.subnote { margin: 0 0 20px; max-width: 82ch; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.subnote b { color: var(--ink); }

.feats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.feat { display: flex; flex-direction: column; border: 1px solid var(--rule); background: var(--bench-3); padding: 16px 18px 18px; }
.feat h3 { margin: 0 0 8px; font-size: 1.28rem; letter-spacing: -.015em; }
.feat p { margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
/* The status tag is pinned to the bottom so a row of plates reads as a register. */
.feat .tag { display: inline-block; margin-top: auto; align-self: flex-start; }

/* These MUST follow the base rules above. A media query loses to a later rule
   of equal specificity, so declaring the collapse earlier in the file left the
   three-up grid in force on a phone. */
@media (max-width: 900px) {
  .nodes, .feats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .nodes, .feats { grid-template-columns: minmax(0, 1fr); }
}

/* ============================================================================
   SIMULATOR — "place a siren"
   ========================================================================== */
.sim {
  display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  gap: 28px; align-items: start;
}
.sim-left, .sim-right { min-width: 0; }

.sim-scene {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--ink); background: var(--bench);
  cursor: crosshair;
}
.sim-scene:focus-visible { outline: 2px solid var(--active); outline-offset: 3px; }

.ss-ground { fill: var(--bench); }
#ssLanes .ss-grid { stroke: rgba(20, 24, 26, .07); stroke-width: 1; }
#ssLanes .ss-lane { stroke: rgba(20, 24, 26, .17); stroke-width: 1; }
.ss-car .ss-body { fill: var(--ink); }
.ss-car .ss-glass { fill: var(--bench-3); opacity: .92; }
.ss-array .ss-ring { fill: none; stroke: var(--rule); stroke-dasharray: 4 4; }
.ss-array .ss-axis { stroke: var(--rule); stroke-width: 1; }
.ss-array .ss-mic { fill: var(--ch-e); }

#ssBearing { opacity: 0; transition: opacity .45s var(--out); }
#ssBearing.is-live { opacity: 1; }
.ss-bearing .ss-bearing, .ss-bearing .ss-bearing-head { stroke: var(--active); stroke-width: 2; }
.ss-bearing .ss-arc { fill: none; stroke: var(--active); stroke-width: 2; }

#ssSiren { opacity: 0; transition: opacity .3s var(--out); }
#ssSiren.is-live { opacity: 1; }
.ss-ambo { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.ss-ambo-glass { fill: #c9dde4; stroke: var(--ink); stroke-width: 1; }
.ss-beacon { fill: var(--active); }
.ss-ping { fill: none; stroke: var(--active); stroke-width: 1.5; opacity: .45; }
.ss-tag { font-family: var(--mono); font-size: 13px; fill: var(--ink-2); letter-spacing: .06em; }
.ss-wave { fill: none; stroke: var(--ch-n); stroke-width: 1.6; opacity: 0; animation: wave 1.9s linear infinite; }
@keyframes wave { 0% { r: 30; opacity: .5; } 100% { r: 320; opacity: 0; } }

.sim-hint { margin: 12px 0 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.sim-note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); max-width: 62ch; }
.sim-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.btn-sim {
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font-family: var(--sans); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .16s var(--fast), color .16s var(--fast);
}
.btn-sim:hover { background: var(--ink); color: var(--bench-3); }
.btn-clear { border-color: var(--rule); color: var(--ink-2); }

.sim-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 5px; }
.sim-steps li {
  position: relative; padding: 9px 12px 9px 33px;
  border: 1px solid var(--rule); background: var(--bench-3);
  font-size: 14px; color: var(--ink-3);
  transition: color .18s var(--fast), border-color .18s var(--fast);
}
.sim-steps li::before {
  content: ""; position: absolute; left: 12px; top: 50%;
  width: 9px; height: 9px; margin-top: -5px;
  border: 1px solid var(--rule); background: transparent;
}
.sim-steps li.on { border-color: var(--active); color: var(--ink); }
.sim-steps li.on::before { background: var(--active); border-color: var(--active); }
.sim-steps li.done { color: var(--ink-2); }
.sim-steps li.done::before { background: var(--ink-2); border-color: var(--ink-2); }

.sim-card {
  border: 1px solid var(--rule); background: var(--bench-3);
  padding: 16px 18px 18px; margin-bottom: 14px;
  /* Keeps a plot legible rather than shrinking it into a smear on a phone. */
  overflow-x: auto;
}
.sim-card h3 {
  margin: 0 0 12px; font-size: 15px; letter-spacing: -.01em;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
}
.tag {
  font-family: var(--mono); font-size: 12.5px; font-weight: 400;
  letter-spacing: .04em; color: var(--ink-3);
  border: 1px solid var(--rule-2); padding: 2px 6px;
}
.sim-svg { display: block; width: 100%; height: auto; min-width: 300px; }
/* The mel frame and the classifier are drawn in a 320 x 150 box. At full plate
   width they would stretch into a 234px blur, so they are held at screen size. */
.sim-svg--narrow { max-width: 320px; }
.sim-cap { margin: 11px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); max-width: 72ch; }

/* Result plates — two up across the band, so the band is not one long column
   beside a short scene. Order follows the step list left to right. */
.sim-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px; margin-top: 28px; padding-top: 22px;
  border-top: 1px solid var(--rule);
}
.sim-grid .sim-card { margin-bottom: 0; }
.sim-card--wide { grid-column: 1 / -1; }

/* Code plate beside its note. Applied only where .band-in has reached its full
   1180px, which guarantees the code column stays wider than the longest line;
   below that the code takes the whole plate instead. */
.sim-split { display: block; }
@media (min-width: 1181px) {
  .sim-split {
    display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    gap: 20px; align-items: start;
  }
  .sim-split .sim-cap { margin-top: 0; }
}

.sim-read { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 20px; margin: 0; }
.sim-read div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--rule-2); padding-bottom: 6px; }
.sim-read dt { font-size: 12.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.sim-read dd { margin: 0; font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--ink); }

.scope-base { stroke: var(--rule-2); stroke-width: 1; }
.scope-trace { fill: none; stroke-width: 1.8; }
.scope-trace.ch-n { stroke: var(--ch-n); }
.scope-trace.ch-e { stroke: var(--ch-e); }
.scope-trace.ch-s { stroke: var(--ch-s); }
.scope-trace.ch-w { stroke: var(--ch-w); }
.scope-lab { font-family: var(--mono); font-size: 12.5px; fill: var(--ink-2); }
.phat-zero { stroke: var(--rule); stroke-dasharray: 4 4; }
.phat-peak { fill: none; stroke-width: 2; }
.phat-peak.ch-n { stroke: var(--ch-n); }
.phat-peak.ch-e { stroke: var(--ch-e); }
.mel-cell { fill: var(--ch-n); }
.net-edge { stroke: var(--rule); stroke-width: 1; }
.net-node { fill: var(--bench-3); stroke: var(--ink-2); stroke-width: 1.5; }
.net-hid { fill: var(--ink-2); }
.net-on { fill: var(--active); stroke: var(--active); }
.bar-bg { fill: var(--rule-2); }
/* Scale, not width: animating width is a layout-triggering property. */
.bar-siren {
  fill: var(--active);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .55s var(--out);
}
.bar-siren.on { transform: scaleX(1); }
.bar-noise { fill: var(--ink-3); }

.sim-code {
  margin: 0; padding: 13px 14px;
  background: var(--ink); color: var(--on-ink);
  border: 1px solid var(--ink); overflow-x: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
}
.sim-code code { font: inherit; }

.sim-verdict {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline;
  padding: 16px 18px; margin-bottom: 14px;
  border: 1px solid var(--rule); background: var(--bench-3);
  opacity: .45; transition: opacity .45s var(--out), border-color .45s var(--out);
}
.sim-verdict.is-live { opacity: 1; border-color: var(--active); }
.sim-verdict b {
  font-family: var(--mono); font-size: 13px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--active);
}
.sim-verdict span { font-size: 14.5px; color: var(--ink-2); }

@media (max-width: 980px) {
  .sim { grid-template-columns: minmax(0, 1fr); }
  .sim-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .sim-read { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Interactive device demos  (added: "Try the demo" section + demo/ pages)
   Uses the same tokens as the rest of the site so the demos read as native.
   ========================================================================== */
.demo-cta { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
a.demo-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--bench-3); border: 1px solid var(--rule); border-radius: 4px;
  padding: 22px 20px 20px; transition: border-color .18s ease, background .18s ease;
}
a.demo-card:hover { border-color: var(--active); background: var(--bench); }
a.demo-card .role {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--active);
}
a.demo-card h3 {
  font-family: var(--sans); font-size: 21px; line-height: 1.2; letter-spacing: -.01em;
  margin: 10px 0 8px; color: var(--ink);
}
a.demo-card p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); margin: 0 0 14px; }
a.demo-card ul { list-style: none; margin: 0 0 16px; padding: 0; }
a.demo-card li {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2);
  line-height: 1.95; padding-left: 14px; position: relative;
}
a.demo-card li::before { content: "\00b7"; position: absolute; left: 2px; color: var(--active); font-weight: 700; }
a.demo-card .go { font-family: var(--mono); font-size: 12.5px; color: var(--active); }
.demo-foot-note {
  margin: 22px 0 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
  color: var(--ink-3); max-width: 92ch;
}
