/* Counterpart prototype, stage branch. One stylesheet, tokens first.
   Direction: "signal-room console". A near-black ground framed by a white bezel (the nav bar),
   square slab buttons, 1px graphite hairlines instead of cards, grit only inside the stage film.
   Sora for headlines, UI and prose; JetBrains Mono for labels, code and the transcript.
   One accent, signal coral, for the marked phrase, links and live state. Committed in README.md. */

/* ---------- Fonts: self-hosted, swap, metric-matched fallbacks (no layout shift on swap) ---------- */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-400-700.woff2") format("woff2");
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url("/assets/fonts/sora-300-600.woff2") format("woff2");
}
/* Fallback metrics, per weight, so the swap moves nothing.
   size-adjust = measured advance-width ratio of the web font to the local face (canvas measureText, same sample);
   ascent/descent = the web font's hhea metrics divided by size-adjust. */
@font-face {
  font-family: "Mono Fallback";
  font-weight: 400;
  src: local("Courier New"), local("CourierNewPSMT");
  size-adjust: 100%;
  ascent-override: 102%;
  descent-override: 30%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Mono Fallback";
  font-weight: 700;
  src: local("Courier New Bold"), local("CourierNewPS-BoldMT");
  size-adjust: 100%;
  ascent-override: 102%;
  descent-override: 30%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Sans Fallback";
  font-weight: 300 500;
  src: local("Arial"), local("ArialMT");
  size-adjust: 113.02%;
  ascent-override: 85.83%;
  descent-override: 25.66%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Sans Fallback";
  font-weight: 600 700;
  src: local("Arial Bold"), local("Arial-BoldMT");
  size-adjust: 106.65%;
  ascent-override: 90.95%;
  descent-override: 27.19%;
  line-gap-override: 0%;
}

/* ---------- Tokens ---------- */
/* Two designed themes that follow the system, overridable from the header toggle:
   the dark console (near-black ground, white bezel) and its inversion (bone ground, black bezel).
   The stage is the same dark film in both. */
:root {
  color-scheme: light;
  --paper: #F4F3EF;
  --panel: #E9E8E3;
  --rule: #D3D2CC;
  --ink: #0B0C0E;
  --graphite: #5B5E66;
  --accent: #C2331F;
  --on-accent: #FFFFFF;
  --accent-soft: #F7DDD8;
  --ok: #1D6B3A;
  --bad: #A4262C;
  --bar: #0B0C0E;
  --on-bar: #F4F3EF;
  --bar-dim: #B5B7BD;
  --bar-hover: #1E2025;

  --mono: "JetBrains Mono", "Mono Fallback", ui-monospace, monospace;
  --sans: "Sora", "Sans Fallback", Arial, sans-serif;

  /* Type scale: 16 base, ratio 1.25, rounded to whole pixels on the 4-pt grid */
  --t-xs: 14px;
  --t-sm: 16px;
  --t-md: 18px;
  --t-lg: 20px;
  --t-xl: 24px;
  --t-2xl: 32px;
  --t-3xl: 40px;

  /* Spacing, 8-pt grid */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --wrap: 1216px;
  --gutter: 32px;
  --radius: 0px;
  --chip-radius: 6px;
  /* Grain: 4% monochrome noise, drawn by the browser from 300 bytes, never an image download */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #08090B;
    --panel: #111317;
    --rule: #2A2D34;
    --ink: #F2F1EE;
    --graphite: #9A9DA6;
    --accent: #FF5A47;
    --on-accent: #08090B;
    --accent-soft: #2A1512;
    --ok: #7FD39B;
    --bad: #FF9B9B;
    --bar: #FFFFFF;
    --on-bar: #08090B;
    --bar-dim: #4A4D55;
    --bar-hover: #EEEEF0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #08090B;
  --panel: #111317;
  --rule: #2A2D34;
  --ink: #F2F1EE;
  --graphite: #9A9DA6;
  --accent: #FF5A47;
  --on-accent: #08090B;
  --accent-soft: #2A1512;
  --ok: #7FD39B;
  --bad: #FF9B9B;
  --bar: #FFFFFF;
  --on-bar: #08090B;
  --bar-dim: #4A4D55;
  --bar-hover: #EEEEF0;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grain) var(--paper);
  color: var(--ink);
  font: 400 var(--t-sm)/1.65 var(--sans);
  letter-spacing: -0.005em;
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 400; margin: 0; letter-spacing: -0.02em; }
h1 { font-size: var(--t-3xl); line-height: 1.12; letter-spacing: -0.03em; }
h2 { font-size: 28px; line-height: 1.15; }
h3 { font-size: var(--t-md); font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
/* The marked phrase: a highlighter in the one accent, as the stage marks the active node */
h1 em { font-style: normal; color: var(--on-accent); background: var(--accent); padding: 0 0.12em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
p, ul, ol, dl, figure, pre, table { margin: 0; }
code, pre, kbd, samp { font-family: var(--mono); font-size: 0.875em; }
p code, li code, td code, th code, dd code { background: var(--panel); padding: 1px 4px; border-radius: 2px; overflow-wrap: anywhere; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
/* Inline links grow their hit area to 24px+ without moving the line (web.dev rule 6) */
a:not([class]) { padding-block: 4px; }
a:hover { text-decoration-thickness: 2px; }
strong, b { font-weight: 600; }

/* Every actionable element signals it (web.dev rule 3) */
a, button, summary, label[for], input[type="radio"], input[type="checkbox"], select { cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }

/* ---------- Header: logo, three links, one button. No bar; on the home page it floats over the film ---------- */
.site-header { --head-ink: var(--ink); --head-ground: var(--paper); position: relative; z-index: 2; color: var(--head-ink); }
.bar { display: flex; align-items: center; gap: var(--s4); min-height: 80px; }
/* The skip link stays first in the tab order but shows only when focused. */
.skip { position: absolute; top: var(--s4); left: var(--gutter); width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; font: 500 var(--t-xs)/1 var(--mono); }
.skip:focus, .skip:focus-visible { width: auto; height: auto; min-height: 40px; display: inline-flex; align-items: center; padding: 0 var(--s3); clip-path: none; overflow: visible; z-index: 3; color: var(--ink); background: var(--paper); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; font: 600 var(--t-md)/1 var(--sans); color: var(--ink); text-decoration: none; letter-spacing: -0.03em; }
.bar .brand { color: var(--head-ink); }
.brand.small { font-size: var(--t-sm); }
.mark { width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; position: relative; flex: none; pointer-events: none; }
.mark::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 0 var(--s2); }
.site-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 var(--s3); font: 500 var(--t-xs)/1 var(--sans); letter-spacing: -0.02em; color: var(--head-ink); text-decoration: none; }
.site-nav a:hover { text-decoration: underline; text-underline-offset: 6px; }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
.site-nav .nav-cta { color: var(--head-ground); background: var(--head-ink); padding: 0 var(--s4); margin-left: var(--s2); }
.site-nav .nav-cta:hover { text-decoration: none; opacity: 0.88; }
.site-header :focus-visible { outline-color: var(--head-ink); }
/* Home: the header sits on the film, legible over a soft top shade drawn by the stage. */
body:has(#hero-stage) .site-header { position: absolute; top: 0; left: 0; right: 0; --head-ink: #F2F1EE; --head-ground: #08090B; }
.theme-toggle { justify-self: start; display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s3); font: 500 var(--t-xs)/1 var(--sans); letter-spacing: -0.02em; color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: var(--radius); }
.theme-toggle:hover { background: var(--panel); }
.knob { width: 24px; height: 14px; border-radius: 7px; border: 1px solid currentColor; position: relative; flex: none; pointer-events: none; }
.knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; border-radius: 50%; background: currentColor; transition: transform 150ms ease; }
.theme-toggle[aria-pressed="true"] .knob::after { transform: translateX(10px); }

/* ---------- Document furniture ---------- */
main { padding-bottom: var(--s9); }
.crumbs { padding: var(--s4) 0 0; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; font: 400 var(--t-xs)/1 var(--mono); color: var(--graphite); }
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before { content: "/"; padding: 0 var(--s2); color: var(--rule); }
.crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--graphite); }
.crumbs [aria-current] { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink); }
.docmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s4); font: 400 var(--t-xs)/1.6 var(--mono); color: var(--graphite); }
.docmeta a { display: inline-flex; align-items: center; min-height: 32px; }
.label { font: 500 var(--t-xs)/1.4 var(--mono); color: var(--graphite); letter-spacing: 0.02em; }
.lede { font-size: var(--t-lg); line-height: 1.55; max-width: 640px; }
.sub { color: var(--graphite); max-width: 680px; }
.prose { max-width: 720px; display: grid; gap: var(--s4); }

.page-head { padding: var(--s7) 0 var(--s2); display: grid; gap: var(--s4); }
.page-head h1 { max-width: 800px; }

.section { padding: var(--s8) 0 0; display: grid; gap: var(--s5); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--ink); }
.sec-head h2 { max-width: 640px; }
.h3-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--s3); }
.loop .h3-head, .tier .h3-head, .stepper .h3-head { flex-direction: column; align-items: flex-start; }
.anchor { display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; font: 400 var(--t-xs)/1 var(--mono); color: var(--graphite); text-decoration: none; white-space: nowrap; }
.anchor:hover { color: var(--accent); text-decoration: underline; }
.section-foot { padding-top: var(--s2); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
/* Square slabs, ranked by darkness: the primary is the ink slab (white on the dark ground),
   the ghost is a 1px ink outline. Neither is the accent: coral marks, it does not shout. */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 var(--s5); font: 500 var(--t-sm)/1.2 var(--sans); letter-spacing: -0.025em; color: var(--paper); background: var(--ink); border: 1px solid var(--ink); border-radius: var(--radius); text-decoration: none; text-align: center; transition: background-color 200ms ease-in-out, color 200ms ease-in-out, border-color 200ms ease-in-out; }
.btn:hover { background: var(--graphite); border-color: var(--graphite); text-decoration: none; }
.btn:active { background: var(--rule); border-color: var(--rule); color: var(--ink); }
.btn.ghost { color: var(--ink); background: transparent; border-color: var(--ink); }
.btn.ghost:hover { background: var(--panel); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- Home: the stage hero ----------
   The film fills the first viewport, edge to edge, in both themes. The header floats on it, the
   headline and subhead sit bottom-left and the two buttons bottom-right; only the film changes
   behind them. A soft shade at the top (for the nav) and the bottom (for the copy) keeps every
   scene legible without a panel behind the text. The film's frame is 1440x810 and object-fit
   covers the viewport; what matters in it sits in the central 1080x670. */
.home { padding-bottom: var(--s9); }
.home > article > section:not(.hero) { max-width: var(--wrap); margin-inline: auto; padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right)); }
.hero {
  --stage-ink: #F2F1EE;
  --stage-dim: #C3C5CC;
  --stage-accent: #FF5A47;
  position: relative; isolation: isolate; display: grid; align-content: end;
  height: 100vh; height: 100svh; min-height: 560px; overflow: hidden;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) var(--s9) max(var(--gutter), env(safe-area-inset-left));
  background: #0C0D10; color: var(--stage-ink);
}
.stage { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(8, 9, 11, 0.72), rgba(8, 9, 11, 0) 160px), linear-gradient(to top, rgba(8, 9, 11, 0.95), rgba(8, 9, 11, 0.8) 34%, rgba(8, 9, 11, 0.35) 56%, rgba(8, 9, 11, 0) 72%); }
.stage-video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.stage-pause { position: absolute; z-index: 1; right: max(var(--gutter), env(safe-area-inset-right)); bottom: var(--s5); pointer-events: auto; display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s3); font: 500 13px/1 var(--mono); color: var(--stage-dim); background: transparent; border: 0; }
.stage-pause:hover { color: var(--stage-ink); }
.stage-pause[aria-pressed="true"] .knob::after { transform: translateX(10px); }
.stage-pause:focus-visible { outline-color: var(--stage-ink); }
.hero-copy { max-width: var(--wrap); width: 100%; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s5) var(--s7); }
.hero h1 { grid-column: 1 / -1; font-size: 88px; line-height: 1.02; letter-spacing: -0.04em; text-wrap: balance; }
.hero h1 em { color: #08090B; background: var(--stage-accent); }
.hero .lede { max-width: 30em; font-size: var(--t-lg); font-weight: 300; line-height: 1.5; color: var(--stage-dim); }
.hero .btn { color: #08090B; background: var(--stage-ink); border-color: var(--stage-ink); }
.hero .btn:hover { background: #FFFFFF; border-color: #FFFFFF; }
.hero .btn.ghost { color: var(--stage-ink); background: transparent; border-color: var(--stage-ink); }
.hero .btn.ghost:hover { background: rgba(242, 241, 238, 0.12); }
.hero :focus-visible { outline-color: var(--stage-ink); }
.home .section { padding-top: var(--s9); gap: var(--s4); }
.home .section > h2, .home .final > h2 { font-size: 40px; line-height: 1.1; letter-spacing: -0.03em; max-width: 18em; }
.home .section > .sub { font-size: var(--t-md); max-width: 36em; }
.home .section > .sub + * { margin-top: var(--s5); }

/* ---------- The wire: a transcript ---------- */
.wire { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); font-family: var(--mono); font-size: var(--t-xs); line-height: 1.6; }
.wire figcaption { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); color: var(--graphite); }
.wire figcaption b { color: var(--ink); font-weight: 600; }
.wire ol { list-style: none; margin: 0; padding: var(--s3) 0; }
.wire li { display: grid; grid-template-columns: 80px 104px minmax(0, 1fr); gap: var(--s4); padding: var(--s1) var(--s4); }
.wire .t { color: var(--graphite); font-variant-numeric: tabular-nums; }
.wire .who { font-weight: 700; }
.wire .a .who { color: var(--accent); }
.wire .b .who { color: var(--ink); }
.wire .sys .who, .wire .sys .m { color: var(--graphite); }
.wire code { background: none; padding: 0; font-size: 1em; }
.wire .done { padding: var(--s3) var(--s4); border-top: 1px solid var(--rule); color: var(--ok); font-weight: 700; }
.wire.mini ol { padding: var(--s2) 0; }
ol.wire { list-style: none; margin: 0; padding: var(--s3) 0; }

/* ---------- Ledger ---------- */
.ledger { display: grid; border-top: 1px solid var(--rule); }
.ledger .r { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 4fr); gap: var(--s5); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.ledger dt { font: 700 var(--t-sm)/1.5 var(--mono); }
.ledger dd { margin: 0; font-size: var(--t-sm); line-height: 1.55; }
.ledger .today { color: var(--graphite); }
.tag { display: block; font: 500 var(--t-xs)/1.6 var(--mono); color: var(--graphite); }
.ledger .now .tag { color: var(--accent); }

/* ---------- Loop / steps ---------- */
.loop { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.loop li { display: grid; gap: var(--s2); align-content: start; padding: var(--s4) var(--s4) var(--s4) 0; }
.loop li + li { padding-left: var(--s4); border-left: 1px solid var(--rule); }
.loop p { font-size: var(--t-sm); line-height: 1.55; }
.n { font: 500 var(--t-xs)/1.4 var(--mono); color: var(--accent); }
.loop .who, .stepper .who { font: 400 var(--t-xs)/1.4 var(--mono); color: var(--graphite); }

.stepper { list-style: none; padding: 0; display: grid; }
.stepper > li { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; gap: var(--s6); padding: var(--s6) 0; border-top: 1px solid var(--rule); }
.stepper > li > div { display: grid; gap: var(--s3); align-content: start; }

/* ---------- Definition blocks ---------- */
.knows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s6); border-top: 1px solid var(--rule); }
.knows > div { padding: var(--s4) 0; border-bottom: 1px solid var(--rule); display: grid; gap: var(--s2); }
.knows dt { font: 700 var(--t-sm)/1.5 var(--mono); }
.knows dd { margin: 0; font-size: var(--t-sm); line-height: 1.6; color: var(--ink); }
.kv { display: grid; border-top: 1px solid var(--rule); }
.kv > div { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: var(--s5); padding: var(--s3) 0; border-bottom: 1px solid var(--rule); }
.kv dt { font: 700 var(--t-xs)/1.8 var(--mono); }
.kv dd { margin: 0; font-size: var(--t-sm); }

/* ---------- Pairing ---------- */
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s7); align-items: start; }
.pair > div { display: grid; gap: var(--s4); }
.pairfig { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); display: grid; }
.pairfig figcaption { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); font: 400 var(--t-xs)/1.6 var(--mono); color: var(--graphite); }
.pairfig ul { margin: 0; padding: var(--s4) var(--s4) var(--s4) var(--s6); display: grid; gap: var(--s2); font-size: var(--t-sm); }
.ends { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s3); align-items: center; padding: var(--s4); border-bottom: 1px solid var(--rule); font-family: var(--mono); font-size: var(--t-xs); }
.end { display: grid; gap: var(--s1); padding: var(--s3); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.end span { color: var(--graphite); }
.link { text-align: center; color: var(--accent); font-weight: 700; }

/* ---------- Pricing ---------- */
.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.tier { display: grid; gap: var(--s3); align-content: start; padding: var(--s5); border: 1px solid var(--rule); border-radius: var(--radius); }
.tier.hot { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.tier h3 { font-size: var(--t-xl); }
.tier ul { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s2); font-size: var(--t-sm); }
ul.tiers { list-style: none; margin: 0; padding: 0; }
.tier p { font-size: var(--t-sm); color: var(--graphite); }
.price { font: 400 var(--t-xs)/1.6 var(--mono); color: var(--graphite); border-top: 1px solid var(--rule); padding-top: var(--s3); }
.free { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s5); align-items: baseline; padding: var(--s5) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.amount { font: 700 var(--t-2xl)/1 var(--mono); }
.amount small { display: block; font: 400 var(--t-xs)/1.6 var(--mono); color: var(--graphite); }
.table-wrap { overflow-x: auto; }
.compare { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.compare caption { text-align: left; font: 500 var(--t-xs)/1.4 var(--mono); color: var(--graphite); padding-bottom: var(--s2); }
.compare th, .compare td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); vertical-align: top; }
.compare thead th { font: 700 var(--t-xs)/1.4 var(--mono); border-bottom-color: var(--ink); }
.compare tbody th { font-weight: 400; }
.compare td { font-family: var(--mono); font-size: var(--t-xs); color: var(--graphite); }
.compare td.yes { color: var(--ink); font-weight: 700; }
.qa { display: grid; border-top: 1px solid var(--rule); }
.qa > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--s5); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.qa h3 { font-size: var(--t-sm); }
.qa p { font-size: var(--t-sm); }

/* ---------- Code ---------- */
.code { display: grid; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); min-width: 0; }
.code .code-label { padding: var(--s2) var(--s4); border-bottom: 1px solid var(--rule); font: 500 var(--t-xs)/1.6 var(--mono); color: var(--graphite); }
.code pre { padding: var(--s3) var(--s4); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--t-xs); line-height: 1.6; }
.code pre code { font-size: 1em; }
.code.out { background: transparent; border-style: dashed; }
.code.out pre { color: var(--graphite); }

/* ---------- Docs ---------- */
.notice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); padding: var(--s3) var(--s4); margin-top: var(--s5); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: var(--t-sm); }
.notice strong { font: 700 var(--t-xs)/1.8 var(--mono); }
.doc-step { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: var(--s4) var(--s6); padding: var(--s8) 0 0; }
.doc-step > .doc-text { display: grid; gap: var(--s3); align-content: start; }
.doc-step > .doc-code { display: grid; gap: var(--s3); min-width: 0; }

/* ---------- Forms ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: var(--s7); padding-top: var(--s8); align-items: start; }
.form-card { display: grid; gap: var(--s5); }
.aside > .section:first-child { padding-top: 0; }
form { display: grid; gap: var(--s5); }
.field { display: grid; gap: var(--s2); }
.field label { display: flex; align-items: center; min-height: 24px; }
label, legend { font: 600 var(--t-xs)/1.4 var(--mono); }
input[type="text"], input[type="email"], textarea {
  width: 100%; min-height: 48px; padding: var(--s3); font: 400 var(--t-sm)/1.5 var(--mono); color: var(--ink);
  background: var(--paper); border: 1px solid var(--graphite); border-radius: var(--radius);
}
textarea { resize: vertical; min-height: 144px; }
input::placeholder, textarea::placeholder { color: var(--graphite); }
.hint { font: 400 var(--t-xs)/1.5 var(--mono); color: var(--graphite); }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s2); min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: var(--s2); }
.choice { display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s4); border: 1px solid var(--rule); border-radius: var(--radius); font-weight: 500; }
.choice:has(:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--accent); }
.status { min-height: 96px; }
.confirm, .error { display: grid; gap: var(--s1); padding: var(--s3) var(--s4); border-radius: var(--radius); font-size: var(--t-sm); }
.confirm { border: 1px solid var(--ok); }
.confirm strong { color: var(--ok); font-family: var(--mono); }
.error { border: 1px solid var(--bad); color: var(--bad); }
.ref { font-family: var(--mono); font-size: var(--t-xs); color: var(--graphite); }
.aside { display: grid; gap: var(--s4); align-content: start; }
.aside ol { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s2); font-size: var(--t-sm); }
.pair-form { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: var(--s3); }
.pair-output { display: block; min-height: 48px; font: 400 var(--t-xs)/1.6 var(--mono); padding: var(--s3) var(--s4); border: 1px dashed var(--rule); border-radius: var(--radius); color: var(--graphite); }
.pair-output:not(:empty) { color: var(--ink); border-style: solid; border-color: var(--accent); }

/* WebMCP: an agent is filling or submitting a form (declarative API pseudo-classes) */
@supports selector(:tool-form-active) {
  form:tool-form-active { outline: 2px dashed var(--accent); outline-offset: 8px; }
  button:tool-submit-active { box-shadow: 0 0 0 3px var(--accent-soft); }
}

/* ---------- Closing and footer ---------- */
.final { margin-top: var(--s8); padding: var(--s6) 0 0; display: grid; gap: var(--s4); }
.final > p { max-width: 680px; }
.site-footer { border-top: 1px solid var(--rule); padding: var(--s6) 0 var(--s7); padding-bottom: max(var(--s7), env(safe-area-inset-bottom)); font: 400 var(--t-xs)/1.6 var(--mono); color: var(--graphite); }
.site-footer .wrap { display: grid; gap: var(--s4); }
.colophon { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s3); }
.site-footer nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--s4); }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 32px; }
.fine a { display: inline-flex; align-items: center; min-height: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stepper > li, .pair, .form-layout, .doc-step { grid-template-columns: minmax(0, 1fr); }
  .loop { grid-template-columns: minmax(0, 1fr); }
  .loop li, .loop li + li { padding: var(--s4) 0; border-left: 0; border-bottom: 1px solid var(--rule); }
  .hero-copy { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 64px; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { font-size: var(--t-sm); }
  h1 { font-size: var(--t-2xl); line-height: 1.15; }
  /* 16px: at 18 the /pricing/ lede wrapped one line differently in Sora and its fallback (CLS 0.012). */
  .lede { font-size: var(--t-sm); }
  /* Phones: logo and Talk to us on the first row, the three links on a fixed grid below.
     Fixed columns mean link widths never decide the layout, so the font swap moves nothing.
     The logo shares the grid's first cell; the list lets clicks through its empty cells. */
  .bar { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; padding-top: max(var(--s2), env(safe-area-inset-top)); padding-bottom: var(--s2); }
  .bar .brand { grid-area: 1 / 1; align-self: start; justify-self: start; }
  .site-nav { grid-area: 1 / 1; margin-left: 0; pointer-events: none; }
  .site-nav ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1) var(--s1); }
  .site-nav li:last-child { grid-row: 1; grid-column: 3; }
  .site-nav li:not(:last-child) { grid-row: 2; }
  .site-nav a { display: flex; pointer-events: auto; }
  .site-nav .nav-cta { margin-left: 0; }
  .tiers, .knows, .qa > div, .ledger .r, .kv > div, .free, .pair-form { grid-template-columns: minmax(0, 1fr); }
  .ledger .r { gap: var(--s2); }
  .wire li { grid-template-columns: 80px minmax(0, 1fr); gap: 0 var(--s3); }
  .wire .m { grid-column: 1 / -1; }
  .sec-head { flex-direction: column; gap: var(--s1); }
  .pane { font-size: 13px; }
  .actions .btn { flex: 1 1 100%; }
  .ends { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-bottom: var(--s8); min-height: 600px; }
  .hero-copy { gap: var(--s4); }
  .hero h1 { font-size: 44px; line-height: 1.05; }
  .hero .lede { font-size: var(--t-sm); }
  .hero-copy .actions { flex-direction: column; }
  .stage-pause { bottom: var(--s3); }
  .home .section { padding-top: var(--s8); }
  .home .section > h2, .home .final > h2 { font-size: var(--t-2xl); }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}
