/*
 * ── CogniGTM stylesheet rules ─────────────────────────────
 * Keep these on when editing. Break one → hero-wraps-per-word class of bug.
 *
 * 1. UNITS FOR MEASURE (max-width on text)
 *    - Monospace (Geist Mono):  `ch` is exact — use it.
 *    - Geist sans:              use `rem`. Rough guide: body ≈ 34rem (~65 chars).
 *    - Fraunces (display/italic): use `em` (font-relative) or `rem`.
 *      Fraunces has a narrow "0" glyph, so `ch` under-measures ~40%.
 *      Guide: display h1 ≈ 12em · h2/h3 ≈ 14–18em · italic lede ≈ 28–32rem.
 *
 * 2. TYPE SCALE — always fluid clamps for display, fixed rem for body/mono.
 *    Hero h1              clamp(2.3rem, 5vw, 4.5rem)
 *    Sub-page h1          clamp(2.75rem, 6.5vw, 5.25rem)
 *    Scene h2             clamp(2rem, 4.4vw, 3.5rem)
 *    Chapter h3           clamp(1.55rem, 2.8vw, 2.15rem)
 *    Italic lede          clamp(1.2rem, 1.9vw, 1.55rem)
 *    Body (Geist)         1rem–1.0625rem fixed
 *    Mono labels          0.72–0.82rem fixed
 *
 * 3. RESPONSIVE BREAKPOINTS — only these, don't invent per-component:
 *      900px ↓  hero + scene + chapter grids collapse to 1 col
 *      700px ↓  signal-card 2-pane stacks
 *      640px ↓  nav hides `contact`
 *      620px ↓  source-flow arrows rotate, nodes stack
 *      560px ↓  artifact table columns tighten
 *
 * 4. MOTION — .anim-in (page load), .stage (scroll reveal), plus a few
 *    named pulses. All must respect `prefers-reduced-motion: reduce`
 *    (see the block at the bottom).
 *    ⚠ Never put .anim-in on inline `<span>` chunks INSIDE a text block —
 *    transforms promote inlines to atomic boxes and break wrapping.
 *    Reveal the whole block (h1, p) as one unit.
 *
 * 5. COLOR — only via tokens below. Scenes flip via `.scene-invert`,
 *    which remaps --bg/--fg/etc. to the opposite theme. Never hardcode
 *    hex outside the token blocks.
 *
 * 6. ADAPTIVE CHECK before shipping any new block:
 *    - Does it read at 375px width without horizontal overflow?
 *    - Does its measure cap prevent 1200px+ lines at desktop?
 *    - Does any fixed-column grid have a stacking breakpoint?
 */

/* ── tokens ─────────────────────────────────────────────── */
:root {
  --ember: #D85A30;
  --teal:  #0F6E56;
  --teal-lift: #4FAA8E;

  --bg:      #0E1512;
  --fg:      #E8E2D6;
  --fg-dim:  rgba(232, 226, 214, 0.52);
  --fg-line: rgba(232, 226, 214, 0.14);
  --accent-line: var(--teal-lift);
}
:root[data-theme="light"] {
  --bg:      #F5F1EA;
  --fg:      #0E1512;
  --fg-dim:  rgba(14, 21, 18, 0.55);
  --fg-line: rgba(14, 21, 18, 0.12);
  --accent-line: var(--teal);
}

/* ── base ───────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Geist', system-ui, sans-serif;
  font-feature-settings: 'ss01';
  -webkit-font-smoothing: antialiased;
  transition: background-color .5s ease, color .5s ease;
  min-height: 100vh;
}
::selection { background: var(--ember); color: #F5F1EA; }

/* ── layout shell (homepage hero landing) ───────────────── */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  gap: clamp(2rem, 5vw, 4rem);
}

/* ── nav ────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand {
  font-family: 'Fraunces', serif;
  font-weight: 450;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  color: var(--fg);
  text-decoration: none;
}
.brand .dot {
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  border-radius: 50%;
  background: var(--ember);
  transform: translateY(-0.55em);
  animation: brand-pulse 4.8s ease-in-out infinite;
}
.brand.back {
  gap: 0.6em;
}
.brand.back .arrow {
  color: var(--fg-dim);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.9em;
  transition: transform .25s cubic-bezier(.2,.7,.2,1);
  display: inline-block;
}
.brand.back:hover .arrow, .brand.back:focus-visible .arrow {
  transform: translateX(-3px);
  color: var(--fg);
}
@keyframes brand-pulse {
  0%, 100% { opacity: 1; transform: translateY(-0.55em) scale(1); }
  50%      { opacity: .82; transform: translateY(-0.55em) scale(.94); }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.nav-links a {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color .2s ease;
  padding: 0.4rem 0;
  border-bottom: 1px solid transparent;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--fg);
  border-bottom-color: var(--ember);
  outline: none;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--fg-line);
  color: var(--fg-dim);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
  letter-spacing: 0.04em;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--fg);
  border-color: var(--fg);
  outline: none;
}
@media (max-width: 640px) {
  .nav-links a[data-hide-mobile] { display: none; }
  .nav-links { gap: 0.9rem; }
  .nav-links a { font-size: 0.72rem; }
  .theme-toggle { padding: 0.35rem 0.6rem; font-size: 0.68rem; }
  .brand { font-size: 1rem; }
}

/* ── hero ───────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: clamp(2rem, 6vh, 5rem) 0;
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .hero .rail { display: none; }
}

.rail {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
  line-height: 1.9;
}
.rail .rail-item { display: block; }
.rail .rail-item + .rail-item { margin-top: 0.15rem; }

.lede {
  max-width: 44rem;
}
.lede-diag {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
  margin: 0 0 clamp(1.25rem, 3vh, 2rem);
}
.lede h1 {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 96, 'SOFT' 50;
  font-weight: 450;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.022em;
  margin: 0 0 clamp(1.5rem, 4vh, 2.25rem);
  max-width: 12em;
}
.lede h1 .ember-dot {
  display: inline-block;
  width: 0.32em;
  height: 0.32em;
  border-radius: 50%;
  background: var(--ember);
  margin-left: 0.14em;
  transform: translateY(-0.05em);
  vertical-align: baseline;
}

.accent-rule {
  display: block;
  width: 3.25rem;
  height: 1px;
  background: var(--accent-line);
  margin: 0 0 1rem;
  transform-origin: left center;
}
.tagline {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--fg);
  letter-spacing: -0.01em;
  margin: 0;
  opacity: .92;
}

/* ── foot strip (hero landing bottom) ───────────────────── */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
}
.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.scroll-hint .arrow {
  display: inline-block;
  width: 1px;
  height: 1.1rem;
  background: var(--fg-dim);
  position: relative;
  animation: scroll-drift 2.6s ease-in-out infinite;
}
.scroll-hint .arrow::after {
  content: "";
  position: absolute;
  left: -3px; bottom: 0;
  width: 7px; height: 7px;
  border-right: 1px solid var(--fg-dim);
  border-bottom: 1px solid var(--fg-dim);
  transform: rotate(45deg) translate(-1px, -1px);
}
@keyframes scroll-drift {
  0%, 100% { transform: translateY(0); opacity: .7; }
  50%      { transform: translateY(4px); opacity: 1; }
}

/* ── arrival choreography (page load) ───────────────────── */
.anim-in { opacity: 0; transform: translateY(8px); }
.loaded .anim-in {
  animation: rise-in .9s cubic-bezier(.2,.7,.2,1) forwards;
}
.loaded .anim-in.d1 { animation-delay: .05s; }
.loaded .anim-in.d2 { animation-delay: .25s; }
.loaded .anim-in.d3 { animation-delay: .45s; }
.loaded .anim-in.d4 { animation-delay: .70s; }
.loaded .anim-in.d5 { animation-delay: .95s; }
.loaded .anim-in.d6 { animation-delay: 1.15s; }
@keyframes rise-in {
  to { opacity: 1; transform: translateY(0); }
}

.lede h1 .ember-dot {
  opacity: 0;
  transform: translateY(-0.05em) scale(.3);
}
.loaded .lede h1 .ember-dot {
  animation: dot-land .7s cubic-bezier(.2,.9,.25,1.2) forwards;
  animation-delay: 1.35s;
}
@keyframes dot-land {
  0%   { opacity: 0; transform: translateY(-1.2em) scale(.3); }
  70%  { opacity: 1; transform: translateY(0.05em) scale(1.08); }
  100% { opacity: 1; transform: translateY(-0.05em) scale(1); }
}

.accent-rule { transform: scaleX(0); opacity: 0; }
.loaded .accent-rule {
  animation: rule-in .7s cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: 1.55s;
}
@keyframes rule-in {
  to { transform: scaleX(1); opacity: 1; }
}

/* ── scene (chapter, homepage) ──────────────────────────── */
.scene {
  padding: clamp(6rem, 14vh, 10rem) clamp(1.25rem, 2.5vw, 2rem);
  background: var(--bg);
  color: var(--fg);
  transition: background-color .6s ease, color .6s ease;
}
[data-theme="dark"] .scene-invert {
  --bg: #F5F1EA;
  --fg: #0E1512;
  --fg-dim: rgba(14, 21, 18, 0.55);
  --fg-line: rgba(14, 21, 18, 0.12);
  --accent-line: var(--teal);
}
[data-theme="light"] .scene-invert {
  --bg: #0E1512;
  --fg: #E8E2D6;
  --fg-dim: rgba(232, 226, 214, 0.52);
  --fg-line: rgba(232, 226, 214, 0.14);
  --accent-line: var(--teal-lift);
}
.scene-invert { background: var(--bg); color: var(--fg); }

.scene-inner {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 4rem);
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 900px) {
  .scene-inner { grid-template-columns: 1fr; gap: 2.5rem; }
  .scene .rail { display: none; }
  .scene { padding-top: clamp(4rem, 10vh, 6rem); padding-bottom: clamp(4rem, 10vh, 6rem); }
}

.scene .rail-item { display: block; }
.scene .rail-item + .rail-item { margin-top: 0.15rem; }
.scene .rail-group + .rail-group { margin-top: 1.5rem; }

.scene-heading {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 96, 'SOFT' 50;
  font-weight: 450;
  font-size: clamp(2rem, 4.4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 clamp(1.25rem, 3vh, 1.75rem);
}
.scene-lede {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
  line-height: 1.4;
  letter-spacing: -0.008em;
  max-width: 30rem;
  margin: 0 0 clamp(1.25rem, 3vh, 1.75rem);
  color: var(--fg);
}
.scene-lede .ember-dot {
  display: inline-block;
  width: 0.35em;
  height: 0.35em;
  border-radius: 50%;
  background: var(--ember);
  margin-left: 0.15em;
  transform: translateY(-0.05em);
  vertical-align: baseline;
}
.replaces {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
  line-height: 1.7;
  margin: 0 0 clamp(2rem, 5vh, 3rem);
  max-width: 44ch;
}
.replaces b {
  font-weight: 500;
  color: var(--fg);
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--fg);
  text-decoration: none;
  padding: 0.65rem 1rem 0.65rem 0.9rem;
  border: 1px solid var(--fg-line);
  border-radius: 999px;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
  letter-spacing: 0.02em;
}
.cta::before { content: "["; color: var(--fg-dim); }
.cta::after  { content: "]"; color: var(--fg-dim); }
.cta .arrow  { transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.cta:hover, .cta:focus-visible {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
  outline: none;
}
.cta:hover::before, .cta:hover::after,
.cta:focus-visible::before, .cta:focus-visible::after { color: var(--bg); }
.cta:hover .arrow, .cta:focus-visible .arrow { transform: translateX(3px); }

/* ── artifact: painsignal dashboard mock (homepage) ─────── */
.artifact {
  margin: 0 0 clamp(2rem, 5vh, 3rem);
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--fg) 3%, var(--bg));
  overflow: hidden;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg);
  max-width: 640px;
}
.artifact-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--fg-line);
  color: var(--fg-dim);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}
.artifact-bar .title {
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.artifact-bar .title .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ember);
}
.artifact-bar .meta { display: inline-flex; gap: 0.9rem; }
.artifact-bar .live::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--teal-lift);
  margin-right: 0.4rem;
  transform: translateY(-1px);
  animation: live-blink 2s ease-in-out infinite;
}
@keyframes live-blink {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1; }
}

.artifact-head, .artifact-row {
  display: grid;
  grid-template-columns: 60px 78px 1fr 56px;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  align-items: center;
}
.artifact-head {
  color: var(--fg-dim);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--fg-line);
}
.artifact-row + .artifact-row {
  border-top: 1px solid var(--fg-line);
}
.artifact-row .conf { display: inline-flex; align-items: center; gap: 0.4rem; }
.artifact-row .conf .pulse-dot {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ember);
  animation: sig-pulse 5.4s ease-in-out infinite;
  transform-origin: center;
}
@keyframes sig-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(216,90,48,0); }
  50%      { transform: scale(1.25); box-shadow: 0 0 0 5px rgba(216,90,48,.14); }
}
.artifact-row .src { color: var(--fg-dim); }
.artifact-row .msg {
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artifact-row .when { color: var(--fg-dim); text-align: right; }
.artifact-foot {
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--fg-line);
  color: var(--fg-dim);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  display: flex;
  justify-content: space-between;
}
.artifact-foot .dim { opacity: .8; }

@media (max-width: 560px) {
  .artifact { font-size: 0.72rem; }
  .artifact-head, .artifact-row {
    grid-template-columns: 46px 60px 1fr 44px;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
  }
  .artifact-bar { padding: 0.6rem 0.75rem; }
}

/* ── stage reveal (used by .scene and .reveal) ──────────── */
.stage {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity .9s cubic-bezier(.2,.7,.2,1),
    transform .9s cubic-bezier(.2,.7,.2,1);
}
.stage.s1 { transition-delay: .05s; }
.stage.s2 { transition-delay: .18s; }
.stage.s3 { transition-delay: .32s; }
.stage.s4 { transition-delay: .48s; }
.stage.s5 { transition-delay: .66s; }
.stage.s6 { transition-delay: .84s; }
.scene-in .stage {
  opacity: 1;
  transform: translateY(0);
}

/* ── sub-page ───────────────────────────────────────────── */
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.subpage {
  padding: clamp(1.25rem, 2.5vw, 2rem);
  max-width: 1400px;
  margin: 0 auto;
}

/* split layout: sticky title/nav on left, chapters flow on right */
.subpage-split {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: start;
  padding: clamp(2rem, 5vh, 4rem) 0 clamp(2rem, 5vh, 4rem);
  max-width: 1180px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .subpage-split {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 1.5rem;
  }
}

.subpage-side {
  position: sticky;
  top: 5.5rem;
  align-self: start;
}
@media (max-width: 900px) {
  .subpage-side { position: static; top: auto; }
}

.chapter-nav {
  margin-top: clamp(1.5rem, 3vh, 2rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--fg-line);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.chapter-nav a {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.4rem 0;
  transition: color .2s ease, transform .25s cubic-bezier(.2,.7,.2,1);
  display: flex;
  gap: 0.85rem;
  align-items: baseline;
  letter-spacing: 0.02em;
}
.chapter-nav a .num {
  color: var(--fg);
  font-weight: 500;
  min-width: 1.5rem;
}
.chapter-nav a:hover, .chapter-nav a:focus-visible {
  color: var(--fg);
  transform: translateX(3px);
  outline: none;
}
.chapter-nav a:hover .num, .chapter-nav a:focus-visible .num {
  color: var(--ember);
}

.subpage-main { min-width: 0; }

.subpage-eyebrow {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
  margin: 0 0 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.subpage-eyebrow::after {
  content: "";
  display: inline-block;
  width: 2.5rem;
  height: 1px;
  background: var(--accent-line);
}
.subpage-title {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 96, 'SOFT' 50;
  font-weight: 450;
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  overflow-wrap: break-word;
}
.subpage-lede {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.2rem, 1.9vw, 1.55rem);
  line-height: 1.35;
  color: var(--fg);
  opacity: .9;
  margin: 0;
  max-width: 28rem;
}
.subpage-lede .ember-dot {
  display: inline-block;
  width: 0.32em;
  height: 0.32em;
  border-radius: 50%;
  background: var(--ember);
  margin-right: 0.28em;
  transform: translateY(-0.05em);
  vertical-align: baseline;
}

.section-divider {
  border: 0;
  border-top: 1px solid var(--fg-line);
  margin: 0;
}

.chapter {
  padding: clamp(2.5rem, 6vh, 4rem) 0;
  border-top: 1px solid var(--fg-line);
  display: block;
}
.chapter:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.chapter-eyebrow {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}
.chapter-eyebrow .num {
  color: var(--ember);
  font-weight: 500;
}
.chapter-title {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 72, 'SOFT' 50;
  font-weight: 450;
  font-size: clamp(1.55rem, 2.8vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
  max-width: 16em;
}
.chapter-copy {
  font-family: 'Geist', sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--fg);
  opacity: .82;
  margin: 0 0 1.75rem;
  max-width: 34rem;
}

/* source-flow diagram (chapter 01) */
.source-flow {
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  padding: 1.5rem 1.25rem;
  background: color-mix(in srgb, var(--fg) 3%, var(--bg));
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  max-width: 640px;
}
.flow-row {
  display: grid;
  grid-template-columns: auto auto auto auto auto;
  align-items: center;
  gap: 1rem;
}
.flow-sources {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.node {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  color: var(--fg);
  background: var(--bg);
  min-width: 88px;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.node.emphasis {
  border-color: var(--ember);
  color: var(--ember);
  animation: queue-receive 3.2s ease-in-out infinite;
  animation-delay: 1.4s;
}
@keyframes queue-receive {
  0%, 100% { box-shadow: 0 0 0 0 rgba(216, 90, 48, 0); }
  6%       { box-shadow: 0 0 0 4px rgba(216, 90, 48, 0.18); }
  20%      { box-shadow: 0 0 0 0 rgba(216, 90, 48, 0); }
}

.flow-arrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: clamp(2.5rem, 5vw, 4rem);
  height: 1.2em;
  color: var(--fg-dim);
  font-family: 'Geist Mono', ui-monospace, monospace;
}
.flow-arrow .line {
  position: relative;
  flex: 1;
  height: 1px;
  background: var(--fg-line);
  overflow: visible;
}
.flow-arrow .pulse {
  position: absolute;
  top: 50%;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 6px 0 rgba(216, 90, 48, 0.55);
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: flow-pulse 3.2s cubic-bezier(.5, 0, .5, 1) infinite;
}
.flow-row > .flow-arrow:nth-child(4) .pulse {
  animation-delay: 1.6s;
}
@keyframes flow-pulse {
  0%   { left: 0%;   opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
.flow-arrow .head {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--fg-dim);
  margin-left: -1px;
  flex-shrink: 0;
}
.flow-note {
  margin-top: 1rem;
  color: var(--fg-dim);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
@media (max-width: 620px) {
  .flow-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    justify-items: start;
  }
  .flow-arrow { transform: rotate(90deg); margin-left: 1.5rem; }
}

/* card frame reused for signal-card and draft-card */
.card-frame {
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--fg) 3%, var(--bg));
  overflow: hidden;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  max-width: 720px;
}
.card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--fg-line);
  color: var(--fg-dim);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}
.card-bar .title {
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.card-bar .title .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ember);
}
.card-bar .meta { display: inline-flex; gap: 0.9rem; }

/* signal-card (chapter 02) */
.signal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.signal-raw {
  padding: 1.1rem 1.15rem;
  border-right: 1px solid var(--fg-line);
  color: var(--fg);
  line-height: 1.55;
  font-family: 'Fraunces', serif;
  font-size: 0.98rem;
  font-style: italic;
}
.signal-raw .quote { color: var(--fg-dim); }
.signal-verdict {
  padding: 1.1rem 1.15rem;
  color: var(--fg);
  line-height: 1.6;
}
.signal-verdict .label {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--fg-dim);
  letter-spacing: 0.03em;
  display: block;
  margin: 0 0 0.35rem;
}
.signal-verdict .label + p { margin-top: 0; }
.signal-verdict p {
  margin: 0 0 0.9rem;
  color: var(--fg);
  font-size: 0.82rem;
  line-height: 1.55;
}
.signal-verdict p:last-child { margin-bottom: 0; }
.signal-verdict .badge {
  color: var(--ember);
  margin-left: 0.35rem;
}
.signal-verdict code {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg);
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--fg-line);
  border-radius: 3px;
}
@media (max-width: 700px) {
  .signal-body { grid-template-columns: 1fr; }
  .signal-raw {
    border-right: 0;
    border-bottom: 1px solid var(--fg-line);
  }
}

/* draft card (chapter 03) */
.draft-body {
  padding: 1.15rem 1.25rem;
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--fg);
}
.draft-actions {
  padding: 0 1.25rem 1rem;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--fg);
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  background: var(--bg);
  cursor: default;
}
.chip-btn.primary {
  border-color: var(--ember);
  color: var(--ember);
}
.chip-btn.primary::before {
  content: "●";
  color: var(--ember);
  font-size: 0.7em;
}
.approve-note {
  padding: 0.7rem 1.25rem;
  border-top: 1px solid var(--fg-line);
  color: var(--fg-dim);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

/* ── mode-select (adversarialci ch 01) ──────────────────── */
.mode-select .mode-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--fg-line);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  align-items: baseline;
  transition: background .2s ease;
}
.mode-select .mode-row:hover {
  background: color-mix(in srgb, var(--fg) 4%, transparent);
}
.mode-select .mode-name {
  color: var(--fg);
  font-weight: 500;
}
.mode-select .mode-desc {
  color: var(--fg-dim);
}
@media (max-width: 520px) {
  .mode-select .mode-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding: 0.7rem 0.95rem;
  }
}

/* ── report-card (adversarialci ch 03) ──────────────────── */
.report-card { max-width: 720px; }

.report-winner {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--fg-line);
  font-family: 'Geist Mono', ui-monospace, monospace;
}
.report-winner .label {
  display: block;
  font-size: 0.7rem;
  color: var(--fg-dim);
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}
.report-winner .winner-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.report-winner .name {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 72, 'SOFT' 50;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 450;
  letter-spacing: -0.015em;
  color: var(--fg);
}
.report-winner .conf {
  font-size: 0.78rem;
  color: var(--fg-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.report-winner .conf-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 6px 0 rgba(216, 90, 48, 0.4);
}

.scorecard-wrap {
  overflow-x: auto;
  border-bottom: 1px solid var(--fg-line);
}
.scorecard {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  min-width: 380px;
}
.scorecard th, .scorecard td {
  padding: 0.55rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--fg-line);
  color: var(--fg);
}
.scorecard tbody tr:last-child td { border-bottom: 0; }
.scorecard thead th {
  font-weight: 500;
  color: var(--fg-dim);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--fg-line);
}
.scorecard td:first-child,
.scorecard th:first-child {
  color: var(--fg-dim);
}
.scorecard .win { color: var(--ember); }
.scorecard thead th.win {
  color: var(--ember);
  border-bottom-color: var(--ember);
}

.tradeoffs {
  list-style: none;
  padding: 1rem 1.15rem;
  margin: 0;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--fg);
}
.tradeoffs li {
  padding-left: 1.4rem;
  position: relative;
  margin: 0 0 0.4rem;
}
.tradeoffs li:last-child { margin-bottom: 0; }
.tradeoffs li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 500;
  line-height: inherit;
}
.tradeoffs li.up::before {
  content: "↑";
  color: var(--teal-lift);
}
.tradeoffs li.down::before {
  content: "↓";
  color: var(--fg-dim);
}

/* persona chips (chapter 04) */
.personas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}
.personas span {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--fg);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--fg-line);
  border-radius: 999px;
}

/* subpage outro CTA */
.subpage-outro {
  padding: clamp(3rem, 8vh, 5rem) 0;
  border-top: 1px solid var(--fg-line);
  display: flex;
  justify-content: center;
}

/* subpage footer */
.subpage-foot {
  padding: 1.5rem 0 1rem;
  border-top: 1px solid var(--fg-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── mission section ────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.mission-line {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 36, 'SOFT' 50;
  font-weight: 400;
  font-size: clamp(1.3rem, 2.1vw, 1.75rem);
  line-height: 1.4;
  letter-spacing: -0.012em;
  color: var(--fg);
  margin: 0 0 clamp(1.25rem, 3vh, 1.75rem);
  max-width: 34rem;
}
.mission-line:last-child { margin-bottom: 0; }

/* ── approach section ───────────────────────────────────── */
.scene-approach {
  padding-top: clamp(4rem, 10vh, 7rem);
  border-top: 1px solid var(--fg-line);
}
.approach-container {
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}
.approach-header {
  margin: 0 0 clamp(2rem, 5vh, 3.5rem);
  max-width: 44rem;
}
.section-eyebrow {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.section-eyebrow::after {
  content: "";
  display: inline-block;
  width: 2.5rem;
  height: 1px;
  background: var(--accent-line);
}
.approach-h {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 96, 'SOFT' 50;
  font-weight: 450;
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 12em;
}

.approach-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--fg-line);
}
.approach-tile {
  padding: clamp(1.75rem, 3.5vw, 2.75rem) clamp(1.5rem, 3vw, 2.5rem);
  border-right: 1px solid var(--fg-line);
  border-bottom: 1px solid var(--fg-line);
}
.approach-tile:nth-child(2n) { border-right: 0; }
.approach-tile:nth-last-child(-n+2) { border-bottom: 0; }

.tile-num {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
}
.tile-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 60, 'SOFT' 50;
  font-weight: 450;
  font-size: clamp(1.3rem, 2vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--fg);
  margin: 0 0 0.75rem;
  max-width: 16em;
}
.tile-copy {
  font-family: 'Geist', sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--fg);
  opacity: .82;
  margin: 0;
  max-width: 34rem;
}
@media (max-width: 700px) {
  .approach-grid { grid-template-columns: 1fr; }
  .approach-tile {
    border-right: 0;
    border-bottom: 1px solid var(--fg-line);
    padding: 1.75rem 1.25rem;
  }
  .approach-tile:last-child { border-bottom: 0; }
}

/* ── reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .anim-in, .accent-rule, .lede h1 .ember-dot, .stage {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
  .brand .dot, .scroll-hint .arrow,
  .artifact-bar .live::before,
  .artifact-row .conf .pulse-dot,
  .flow-arrow .pulse,
  .node.emphasis {
    animation: none !important;
  }
  .flow-arrow .pulse { display: none; }
}
