/* ==========================================================================
   VideoHarness-SRSI project page
   ========================================================================== */

:root {
  --bg: #f6f4ef;
  --bg-soft: #efece4;
  --surface: #ffffff;
  --ink: #16213a;
  --ink-2: #3c4760;
  --muted: #6b7489;
  --line: #dcd8cd;
  --line-soft: #e8e5dc;

  --blue: #2f6db5;      /* SRSI / information isolation */
  --purple: #7b5ea7;    /* Stage I */
  --gold: #b8862b;      /* Stage II */
  --green: #1f8a6a;     /* Stage III */
  --orange: #d9772b;    /* BRSI */
  --red: #c4483b;
  --teal: #2e706c;      /* takeaway boxes (matches the paper) */

  --hero-bg: #0f1a2e;
  --hero-ink: #eef2fb;
  --hero-muted: #9aa8c4;

  --fig-bg: #ffffff;
  --shadow: 0 1px 2px rgba(22, 33, 58, .05), 0 8px 24px -12px rgba(22, 33, 58, .18);
  --radius: 14px;
  --maxw: 1120px;

  --f-display: "Fraunces", Georgia, serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1422; --bg-soft: #121b2d; --surface: #141d30; --ink: #e8ecf5; --ink-2: #c3cbdc;
    --muted: #8d98b0; --line: #26324a; --line-soft: #1e2940;
    --blue: #6ea3e6; --purple: #a88ad6; --gold: #dcae55; --green: #45bf97; --orange: #f09a52; --teal: #5fb3ad;
    --hero-bg: #070c17; --fig-bg: #f4f2ec;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg: #0d1422; --bg-soft: #121b2d; --surface: #141d30; --ink: #e8ecf5; --ink-2: #c3cbdc;
  --muted: #8d98b0; --line: #26324a; --line-soft: #1e2940;
  --blue: #6ea3e6; --purple: #a88ad6; --gold: #dcae55; --green: #45bf97; --orange: #f09a52; --teal: #5fb3ad;
  --hero-bg: #070c17; --fig-bg: #f4f2ec;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 var(--f-body); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--f-mono); font-size: .88em; }
em { font-style: italic; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.srsi { color: var(--blue); font-weight: 600; }
.brsi { color: var(--orange); font-weight: 600; }
.sc { font-variant: small-caps; letter-spacing: .02em; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 20px; height: 56px; }
.nav .brand { font-family: var(--f-display); font-weight: 600; color: var(--ink); font-size: 17px; white-space: nowrap; }
.nav .brand span { color: var(--blue); }
.nav ul { display: flex; gap: 4px; list-style: none; margin: 0 0 0 auto; padding: 0; overflow-x: auto; scrollbar-width: none; }
.nav ul::-webkit-scrollbar { display: none; }
.nav li a {
  display: block; padding: 6px 11px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2); white-space: nowrap;
}
.nav li a:hover { background: var(--bg-soft); text-decoration: none; }
.nav li a.active { background: var(--ink); color: var(--bg); }
.theme-btn {
  border: 1px solid var(--line); background: transparent; color: var(--ink-2); border-radius: 999px;
  width: 32px; height: 32px; cursor: pointer; flex: none; font-size: 15px;
}

/* ---------- hero ---------- */
.hero {
  position: relative; background: var(--hero-bg); color: var(--hero-ink); overflow: hidden;
  padding: 88px 0 72px;
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 35%, transparent 0%, rgba(8, 13, 25, .55) 70%);
}
.hero .wrap { position: relative; z-index: 2; text-align: center; }
.venue {
  display: inline-flex; gap: 8px; align-items: center; font: 500 12.5px/1 var(--f-mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--hero-muted);
  border: 1px solid rgba(154, 168, 196, .3); padding: 7px 12px; border-radius: 999px;
}
.venue i { width: 7px; height: 7px; border-radius: 50%; background: #58d6a7; box-shadow: 0 0 10px #58d6a7; }
.hero h1 {
  font-family: var(--f-display); font-weight: 600; font-size: clamp(38px, 6.2vw, 72px);
  line-height: 1.02; letter-spacing: -.02em; margin: 22px 0 10px;
}
.hero h1 .accent {
  background: linear-gradient(90deg, #7fb2ff, #b89cf0 45%, #f0c56e 75%, #5fd3a6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .subtitle {
  font-family: var(--f-display); font-weight: 400; font-size: clamp(18px, 2.3vw, 25px);
  color: #c8d2e8; max-width: 820px; margin: 0 auto 30px; line-height: 1.35;
}
.authors { font-size: 16.5px; max-width: 900px; margin: 0 auto; line-height: 1.9; }
.authors a, .authors span.a { color: var(--hero-ink); white-space: nowrap; }
.authors sup { color: var(--hero-muted); font-size: 11px; margin-left: 1px; }
.affils { color: var(--hero-muted); font-size: 14px; margin: 10px auto 0; max-width: 900px; line-height: 1.8; }
.affils span { white-space: nowrap; margin: 0 8px; }
.affils .note { display: block; font-size: 12.5px; opacity: .8; }
.links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 30px 0 44px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  background: #eef2fb; color: #0f1a2e; font-weight: 600; font-size: 14.5px; border: 1px solid transparent;
  transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; background: #fff; }
.btn.ghost { background: transparent; color: var(--hero-ink); border-color: rgba(238, 242, 251, .28); }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.btn .soon { font: 500 10.5px var(--f-mono); opacity: .6; margin-left: 2px; }
.btn svg { width: 17px; height: 17px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: rgba(154, 168, 196, .18);
  border: 1px solid rgba(154, 168, 196, .18); border-radius: var(--radius); overflow: hidden; max-width: 900px; margin: 0 auto; }
.stat { background: rgba(15, 26, 46, .78); padding: 20px 14px; }
.stat b { display: block; font-family: var(--f-display); font-weight: 600; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; }
.stat span { color: var(--hero-muted); font-size: 13px; line-height: 1.35; display: block; margin-top: 6px; }
.stat:nth-child(1) b { color: #9cc4ff; }
.stat:nth-child(2) b { color: #6fe0b6; }
.stat:nth-child(3) b { color: #f3c872; }
.stat:nth-child(4) b { color: #c9b2f5; }

/* ---------- sections ---------- */
section.block { padding: 88px 0 24px; }
.eyebrow {
  font: 600 12px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; opacity: .5; }
h2 {
  font-family: var(--f-display); font-weight: 600; font-size: clamp(28px, 3.6vw, 42px); line-height: 1.12;
  letter-spacing: -.015em; margin: 0 0 16px; max-width: 860px;
}
h3 { font-family: var(--f-display); font-weight: 600; font-size: 22px; line-height: 1.25; margin: 0 0 8px; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 820px; margin: 0 0 34px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.figure { background: var(--fig-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.figure img { width: 100%; height: auto; border-radius: 6px; cursor: zoom-in; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 12px; line-height: 1.55; }
figcaption b { color: var(--ink-2); }
.figure figcaption { color: #5b6477; }
.figure figcaption b { color: #2a3348; }

/* TL;DR */
.tldr { display: grid; grid-template-columns: 1.25fr 1fr; gap: 36px; align-items: start; }
.tldr p { margin: 0 0 14px; color: var(--ink-2); }
.tldr .big { font-family: var(--f-display); font-size: 23px; line-height: 1.4; color: var(--ink); }
.pill-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.pill-list li { padding: 16px 18px 16px 58px; position: relative; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.pill-list li b { display: block; font-size: 15px; }
.pill-list li span { font-size: 14px; color: var(--muted); line-height: 1.5; display: block; }
.pill-list li::before {
  content: attr(data-n); position: absolute; left: 16px; top: 16px; width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; font: 600 13px var(--f-mono); color: #fff; background: var(--c, var(--blue));
}

/* ---------- interactive chart shells ---------- */
.viz { padding: 22px 22px 16px; }
.viz-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.viz-title { font-weight: 600; font-size: 15px; }
.viz-title small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ctl {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 14px;
  font: 500 13px var(--f-body); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; transition: background .15s;
}
.ctl:hover { background: var(--bg-soft); }
.ctl.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ctl.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ctl .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.scrub { display: flex; align-items: center; gap: 12px; margin-top: 8px; font: 12.5px var(--f-mono); color: var(--muted); }
.scrub input[type=range] { flex: 1; accent-color: var(--blue); }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--f-body); }
svg.chart .axis text { fill: var(--muted); font-size: 12px; }
svg.chart .axis path, svg.chart .axis line { stroke: var(--line); }
svg.chart .grid line { stroke: var(--line-soft); }
svg.chart .grid path { display: none; }
svg.chart .axis-label { fill: var(--muted); font-size: 12.5px; }
svg.chart .halo { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 100; max-width: 320px; background: var(--hero-bg); color: #eef2fb;
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; opacity: 0; transition: opacity .12s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.tooltip b { font-family: var(--f-mono); font-size: 12.5px; }
.tooltip .chips { margin-top: 6px; }
.tooltip .chip { background: rgba(255, 255, 255, .1); color: #d6def0; border: 0; }

.evo-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; }
.champion {
  border-left: 1px solid var(--line); padding-left: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.champion .label { font: 600 11px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.champion .name { font: 600 17px var(--f-mono); color: var(--orange); word-break: break-all; transition: color .3s; }
.champion .acc { font-family: var(--f-display); font-size: 44px; font-weight: 600; line-height: 1; }
.champion .acc small { font-size: 15px; color: var(--muted); font-family: var(--f-body); font-weight: 400; }
.champion .delta { font: 600 13px var(--f-mono); color: var(--green); }
.champion.flash .name { animation: flash .9s ease; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--gold) 35%, transparent); } 100% { background: transparent; } }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font: 500 11.5px var(--f-mono); padding: 3px 8px; border-radius: 6px; background: var(--bg-soft);
  color: var(--ink-2); border: 1px solid var(--line-soft);
}
.log { font: 12px/1.55 var(--f-mono); color: var(--muted); max-height: 150px; overflow: auto; margin: 0; padding: 0; list-style: none; }
.log li { padding: 2px 0; border-bottom: 1px dashed var(--line-soft); }
.log li b { color: var(--ink); font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* ---------- verdict equation ---------- */
.equation {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: 8px; margin: 10px 0 30px;
  font-family: var(--f-display); font-size: 20px;
}
.eq-term {
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); min-width: 110px; cursor: default; transition: all .2s;
}
.eq-term .sym { font-size: 26px; font-style: italic; }
.eq-term .nm { font: 500 11.5px var(--f-mono); letter-spacing: .04em; color: var(--muted); margin-top: 4px; text-transform: uppercase; }
.eq-op { display: flex; align-items: center; font-size: 26px; color: var(--muted); padding: 0 2px; }
.eq-term.good { border-color: var(--green); }
.eq-term.good .sym { color: var(--green); }
.eq-term[data-mode] .sym { color: var(--red); }
.eq-term.hl { background: color-mix(in srgb, var(--red) 10%, var(--surface)); border-color: var(--red); transform: translateY(-2px); }

/* term definitions under the equation */
button.eq-term { font: inherit; color: inherit; cursor: pointer; }
.eq-term:hover { border-color: var(--ink-2); transform: translateY(-2px); }
.eq-term.sel { background: color-mix(in srgb, var(--ink) 6%, var(--surface)); border-color: var(--ink); transform: translateY(-2px); }
.eq-term.good.sel { border-color: var(--green); background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.eq-term[data-mode].sel, .eq-term.hl { background: color-mix(in srgb, var(--red) 10%, var(--surface)); border-color: var(--red); transform: translateY(-2px); }
.eq-defs { border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); padding: 6px 18px 14px; margin: -12px 0 30px; transition: border-color .2s; }
.eq-defs.good { border-color: var(--green); }
.eq-defs.bad { border-color: var(--red); }
.eq-defs-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font: 600 11.5px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 0 10px; border-bottom: 1px solid var(--line-soft); }
.eq-defs-head .hint { font-weight: 500; letter-spacing: .03em; text-transform: none; }
.eq-def { display: none; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; padding: 14px 0 2px; animation: defIn .25s ease; }
.eq-def.active { display: grid; }
@keyframes defIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.eq-def-sym { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 6px; border-radius: 10px; border: 1.5px solid var(--line); font-family: var(--f-display); }
.eq-def-sym .sym { font-size: 24px; font-style: italic; }
.eq-def-sym .nm { font: 500 10.5px var(--f-mono); letter-spacing: .04em; color: var(--muted); margin-top: 3px; text-transform: uppercase; text-align: center; }
.eq-def.good .eq-def-sym { border-color: var(--green); }
.eq-def.good .sym { color: var(--green); }
.eq-def[data-def="fit"] .eq-def-sym, .eq-def[data-def="inflation"] .eq-def-sym, .eq-def[data-def="noise"] .eq-def-sym { border-color: var(--red); }
.eq-def[data-def="fit"] .sym, .eq-def[data-def="inflation"] .sym, .eq-def[data-def="noise"] .sym { color: var(--red); }
.eq-def-body p { margin: 0 0 6px; font-size: 15px; line-height: 1.55; }
.eq-def-body p:last-child { margin-bottom: 0; }
.eq-def-body b { font-family: var(--f-display); font-style: italic; font-weight: 600; letter-spacing: .01em; }
.eq-def-note { color: var(--muted); font-size: 14px !important; }
.eq-def-note b { font-family: inherit; font-style: normal; color: var(--ink-2); }
.eq-def .tag { display: inline-block; font: 600 10.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; border: 1px solid currentColor; }
.eq-def .tag.ok { color: var(--green); }
.eq-def .tag.bad { color: var(--red); }

.modes-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.mode-tab {
  flex: 1; min-width: 200px; text-align: left; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 14px 16px; color: var(--ink); font: inherit; transition: all .2s;
}
.mode-tab .k { font: 600 11px var(--f-mono); letter-spacing: .06em; color: var(--muted); }
.mode-tab .t { font-family: var(--f-display); font-size: 19px; font-weight: 600; display: block; margin-top: 3px; }
.mode-tab .s { font-size: 13px; color: var(--muted); }
.mode-tab.active { border-color: var(--ink); box-shadow: var(--shadow); }
.mode-panel { display: none; }
.mode-panel.active { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; animation: fadeUp .4s ease; }
.mode-panel .figure { padding: 12px; }
.mode-text { grid-column: 1 / -1; display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.mode-text p { margin: 0 0 10px; color: var(--ink-2); }
.bignum { display: grid; gap: 16px; align-content: start; }
.bignum div b { display: block; font-family: var(--f-display); font-size: 34px; line-height: 1.1; color: var(--red); }
.bignum div span { font-size: 13px; color: var(--muted); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.takeaway {
  position: relative; border: 1.5px solid var(--teal); border-radius: 12px; padding: 20px 20px 16px;
  background: color-mix(in srgb, var(--teal) 6%, var(--surface)); margin-top: 8px;
}
.takeaway::before {
  content: "Takeaway"; position: absolute; top: -11px; left: 16px; background: var(--teal); color: #fff;
  font: 600 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px;
}
.takeaway p { margin: 0; color: var(--ink); font-size: 15px; }

.root-cause {
  margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
}
.root-cause > div { padding: 18px 20px; border-right: 1px solid var(--line); }
.root-cause > div:last-child { border-right: 0; }
.root-cause .from { font: 500 12px var(--f-mono); color: var(--red); }
.root-cause .arrow { color: var(--muted); margin: 0 4px; }
.root-cause .to { font: 600 12px var(--f-mono); color: var(--green); }
.root-cause p { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }

/* ---------- method stepper ---------- */
.stepper { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; margin-top: 26px; }
.steps { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.stepper > * { min-width: 0; }
.step {
  cursor: pointer; text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 14px 16px; font: inherit; color: var(--ink); position: relative; transition: all .2s; overflow: hidden;
}
.step::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); opacity: .35; transition: opacity .2s; }
.step .k { font: 600 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.step .t { display: block; font-weight: 600; font-size: 15.5px; margin-top: 2px; }
.step.active { border-color: var(--c); box-shadow: var(--shadow); }
.step.active::before { opacity: 1; }
.step-body { display: none; }
.step-body.active { display: block; animation: fadeUp .35s ease; }
.step-body h3 { color: var(--c); }
.step-body p { color: var(--ink-2); margin: 0 0 12px; }
.step-body .viz { margin-top: 14px; }
.fixes { font-size: 13px; font-family: var(--f-mono); color: var(--muted); margin-bottom: 8px; }
.fixes b { color: var(--red); font-weight: 600; }

.iso-diagram { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin-top: 8px; }
.iso-box { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); font-size: 13.5px; }
.iso-box h4 { margin: 0 0 8px; font-size: 13px; font-family: var(--f-mono); text-transform: uppercase; letter-spacing: .08em; }
.iso-box ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.iso-box.deny { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.iso-box.deny h4 { color: var(--red); }
.iso-box.deny li { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 70%, transparent); }
.iso-box.allow { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.iso-box.allow h4 { color: var(--green); }
.iso-shield { font-size: 34px; text-align: center; color: var(--blue); }
.trace {
  font: 12px/1.6 var(--f-mono); background: var(--hero-bg); color: #cfd8ec; border-radius: 10px; padding: 12px 14px;
  margin-top: 14px; overflow-x: auto; white-space: pre;
}
.trace .c { color: #7f8db0; }
.trace .g { color: #6fe0b6; }
.trace .r { color: #ff8b7a; }

.seed-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seed-switch button { border: 0; background: transparent; color: var(--ink-2); padding: 5px 12px; cursor: pointer; font: 500 12.5px var(--f-mono); }
.seed-switch button.on { background: var(--ink); color: var(--bg); }

/* ---------- strategies ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.filters .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.strat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.strat {
  padding: 18px; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--c); animation: fadeUp .35s ease both;
}
.strat .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.strat .role { font: 600 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--c); }
.strat .seed { font: 500 11.5px var(--f-mono); color: var(--muted); }
.strat .nm { font: 600 17px var(--f-mono); color: var(--ink); word-break: break-word; }
.strat .axis { font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.strat .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.strat .nums div { background: var(--bg-soft); border-radius: 8px; padding: 7px 9px; }
.strat .nums b { display: block; font: 600 16px var(--f-mono); }
.strat .nums span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.strat .hyp { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; position: relative; }
.strat .hyp .q { font: 600 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 3px; }
.strat .hyp.clamped p { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.strat .hyp p { margin: 0; }
.more { border: 0; background: none; color: var(--blue); cursor: pointer; padding: 0; font: 500 13px var(--f-body); align-self: flex-start; }

/* milestone timeline (BRSI) */
.milestones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; position: relative; margin-top: 8px; }
.milestones::before { content: ""; position: absolute; left: 6%; right: 6%; top: 17px; height: 2px; background: linear-gradient(90deg, var(--line), var(--orange)); }
.ms { text-align: center; padding: 0 8px; position: relative; }
.ms .star { width: 36px; height: 36px; margin: 0 auto 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--orange); display: grid; place-items: center; color: var(--orange); font-size: 16px; }
.ms b { font: 600 13.5px var(--f-mono); display: block; word-break: break-all; }
.ms .v { font-family: var(--f-display); font-size: 22px; font-weight: 600; }
.ms .i { font-size: 12px; color: var(--muted); }

/* ---------- results ---------- */
.table-wrap { overflow-x: auto; }
table.res { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.res th, table.res td { padding: 9px 10px; text-align: center; border-bottom: 1px solid var(--line-soft); }
table.res th { font-weight: 600; color: var(--ink-2); font-size: 13px; }
table.res thead tr:first-child th { border-bottom: 1px solid var(--line); }
table.res td:first-child, table.res th:first-child { text-align: left; }
table.res td.m { font-family: var(--f-mono); font-size: 13px; }
table.res tr.group td { background: var(--bg-soft); font-weight: 600; font-style: italic; color: var(--muted); font-size: 12.5px; text-align: left; }
table.res tr.ours { background: color-mix(in srgb, var(--blue) 8%, transparent); }
table.res tr.ours td:first-child { font-weight: 700; color: var(--blue); }
table.res td .pm { color: var(--muted); font-size: 11px; }
table.res td.best { font-weight: 700; }
table.res td.test { background: color-mix(in srgb, var(--ink) 3%, transparent); }

.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 20px 0; }
.metric-row.two { grid-template-columns: repeat(2, 1fr); }
.metric { padding: 18px 20px; }
.metric .k { font: 600 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.metric .v { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 4px; font-family: var(--f-display); font-weight: 600; }
.metric .v .from { font-size: 24px; color: var(--orange); }
.metric .v .arr { color: var(--muted); font-size: 18px; }
.metric .v .to { font-size: 34px; color: var(--blue); }
.metric p { margin: 0; font-size: 13.5px; color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; width: 18px; }
.legend span.flow { display: inline; }

/* ablations */
.abl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.abl { padding: 20px; }
.abl h3 { font-size: 19px; }
.abl p { color: var(--ink-2); font-size: 14.5px; margin: 0 0 12px; }
.abl .figure { padding: 10px; margin-top: auto; }
.abl { display: flex; flex-direction: column; }
.hbar { display: grid; grid-template-columns: 160px 1fr 54px; align-items: center; gap: 10px; margin: 8px 0; font-size: 13.5px; }
.hbar .track { height: 22px; background: var(--bg-soft); border-radius: 6px; overflow: hidden; position: relative; }
.hbar .fill { height: 100%; width: 0; background: var(--c); border-radius: 6px; transition: width 1.2s cubic-bezier(.2, .8, .2, 1); }
.hbar .val { font: 600 13.5px var(--f-mono); text-align: right; }
.hbar .ref { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--orange); }

/* bibtex */
.bib { position: relative; }
.bib pre {
  margin: 0; background: var(--hero-bg); color: #d8e0f2; border-radius: var(--radius); padding: 22px; overflow-x: auto;
  font: 13px/1.6 var(--f-mono);
}
.copy {
  position: absolute; top: 12px; right: 12px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06);
  color: #eef2fb; border-radius: 8px; padding: 5px 12px; font: 500 12.5px var(--f-body); cursor: pointer;
}

footer { padding: 60px 0 50px; color: var(--muted); font-size: 13.5px; text-align: center; }
footer a { color: var(--ink-2); }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(8, 12, 22, .88); z-index: 200; display: none; place-items: center; padding: 24px; cursor: zoom-out;
}
.lightbox.open { display: grid; animation: fadeUp .2s ease; }
.lightbox img { max-width: min(1600px, 96vw); max-height: 92vh; background: #fff; border-radius: 8px; padding: 10px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */

/* qualitative examples */
.ex-harness { padding: 18px 22px; margin-bottom: 20px; }
.ex-harness .lin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; }
.ex-harness .lin .k, .ex-harness .hyp .q { font: 600 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ex-harness .lin code:last-child { color: var(--blue); font-weight: 600; }
.ex-harness .arr { color: var(--muted); }
.ex-harness ol { margin: 12px 0 10px; padding-left: 20px; font-size: 14.5px; color: var(--ink-2); }
.ex-harness li { margin-bottom: 4px; }
.ex-harness .hyp { margin: 0; font-size: 13.5px; color: var(--ink-2); border-left: 3px solid var(--line); padding-left: 12px; font-style: italic; }
.ex-harness .hyp .q { display: block; font-style: normal; margin-bottom: 2px; }
.ex { padding: 20px 22px; margin-bottom: 20px; }
.ex-tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.ex-tags span { background: var(--bg-soft); border-radius: 999px; padding: 2px 10px; }
.ex-tags .mono { font-family: var(--f-mono); }
.ex h3 { margin: 10px 0 8px; font-size: 21px; }
.ex-opts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ex-opts li { border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: 14px; color: var(--ink-2); }
.ex-opts li b { font-family: var(--f-mono); margin-right: 6px; color: var(--muted); }
.ex-opts li.gt { border-color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--ink); }
.ex-opts li.gt b { color: var(--green); }
.ex-video { margin-top: 16px; }
.ex-strip { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; border-radius: 8px; overflow: hidden; }
.ex-strip img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.ex-timeline { position: relative; height: 18px; margin-top: 6px; background: var(--bg-soft); border-radius: 5px; }
.ex-timeline .span { position: absolute; top: 0; bottom: 0; background: var(--green); border-radius: 3px; opacity: .85; }
.ex-timeline .ticks i { position: absolute; top: 3px; bottom: 3px; width: 2px; margin-left: -1px; background: var(--muted); border-radius: 1px; }
.ex-tl-legend { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.ex-tl-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.ex-tl-legend .span-sw { background: var(--green); }
.ex-tl-legend .tick-sw { width: 2px; background: var(--muted); margin-left: 6px; }
.ex-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; margin-top: 18px; align-items: start; }
.ex-key { margin: 0; }
.ex-key .imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 10px; overflow: hidden; outline: 3px solid var(--green); }
.ex-key img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.ex-key figcaption { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.ex-runs { display: grid; gap: 8px; }
.ex-run { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.ex-run .h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.ex-run .h code { font-size: 13px; color: var(--ink); font-weight: 600; }
.ex-run .ans { font-size: 15px; margin-top: 3px; }
.ex-run .ans b { font-family: var(--f-mono); margin-right: 4px; }
.ex-run .ans em { font-style: normal; font-weight: 700; margin-left: 8px; }
.ex-run .ans small { color: var(--muted); margin-left: 10px; font-size: 12px; }
.ex-run.wrong .ans { color: var(--red); }
.ex-run.right { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 6%, transparent); }
.ex-run.right .h code { color: var(--blue); }
.ex-run.right > .ans { color: var(--green); margin-top: 8px; }
.voters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.voter { background: var(--surface); border: 1px solid var(--line-soft); border-top: 3px solid var(--red); border-radius: 8px; padding: 6px 8px; font-size: 12px; }
.voter.ok { border-top-color: var(--green); }
.voter .vh { color: var(--muted); }
.voter .vh b { font: 700 13px var(--f-mono); color: var(--ink); margin-right: 6px; }
.voter .slots { display: flex; gap: 3px; margin: 5px 0; }
.voter .slots span { flex: 1; text-align: center; font: 500 11.5px var(--f-mono); border-radius: 4px; background: var(--bg-soft); color: var(--muted); padding: 1px 0; }
.voter .slots span b { display: block; font-size: 9.5px; font-weight: 500; opacity: .7; }
.voter .slots span.pk { background: var(--ink); color: var(--surface); }
.voter .slots span.gt:not(.pk) { box-shadow: inset 0 0 0 1px var(--green); }
.voter .said { color: var(--ink-2); line-height: 1.4; }
.voter .said b { font-family: var(--f-mono); }
.ex-note { font-size: 14px; color: var(--ink-2); margin: 16px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); }
@media (max-width: 900px) {
  .ex-body { grid-template-columns: 1fr; }
  .ex-opts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .ex { padding: 16px 14px; }
  .ex-strip { grid-template-columns: repeat(4, 1fr); }
  .voters { grid-template-columns: 1fr; }
  .ex-tl-legend { font-size: 11px; }
}

@media (max-width: 900px) {
  .tldr, .two-col, .evo-grid, .stepper, .mode-panel.active, .mode-text, .abl-grid, .metric-row, .metric-row.two, .root-cause, .three-col, .ph-grid { grid-template-columns: 1fr; }
  .champion { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .root-cause > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { flex-direction: row; overflow-x: auto; }
  .step { min-width: 190px; }
  .milestones { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .milestones::before { display: none; }
  .iso-diagram { grid-template-columns: 1fr; }
  .iso-shield { transform: rotate(90deg); }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 60px 0 48px; }
  section.block { padding: 64px 0 16px; }
  .viz { padding: 16px 12px 12px; }
  .nav .brand { display: none; }
  .hbar { grid-template-columns: 110px 1fr 48px; }
  .strat-grid { grid-template-columns: 1fr; }
  .equation { gap: 4px; }
  .eq-term { min-width: 0; padding: 8px 10px; }
  .eq-term .sym { font-size: 21px; }
  .eq-term .nm { font-size: 9.5px; }
  .eq-op { font-size: 20px; }
  .eq-defs { padding: 4px 12px 12px; }
  .eq-def { grid-template-columns: 1fr; gap: 8px; }
  .eq-def-sym { flex-direction: row; gap: 10px; align-self: start; padding: 6px 12px; }
  .eq-def-sym .nm { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
