/* Hao Zou — research path, version 3
   Palette: Columbia night (navy surfaces, Columbia-blue ink accents).
   Token states carry meaning everywhere on the page:
     stale = rose, masked = amber, verified/repaired = mint, draft/pending = sky. */

:root {
  /* Graphite night: neutral dark surfaces, Columbia-blue accent. */
  --bg: #0c0e13;
  --bg-2: #10131a;
  --panel: #151922;
  --panel-2: #1e232e;
  --line: #282e3b;
  --line-2: #3d4556;
  --ink: #f1f3f7;
  --ink-2: #b6bdc9;
  --ink-3: #828b9a;

  --sky: #8ec5ee;      /* identity + generation thread */
  --lilac: #b9a4ff;    /* efficiency thread */
  --peach: #ffa873;    /* agents thread */

  --stale: #ff6b81;
  --mask: #f2b84b;
  --ok: #45d6a4;
  --draft: #8ec5ee;

  /* chart series (validated on the panel surface) */
  --c1: #3987e5;
  --c2: #d95926;
  --c3: #199e70;
  --c4: #c98500;

  --display: "Newsreader", "Source Serif 4", "Iowan Old Style", "Charter", "Bitstream Charter", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, "DejaVu Sans Mono", monospace;

  /* aliases used by components shared with the light build */
  --card: var(--panel); --soft: var(--bg-2); --blue: var(--sky); --violet: var(--lilac); --green: var(--ok);
  --red: var(--stale); --gray: #8f97a6; --amber: var(--mask); --serif: var(--display); --sans: var(--body);

  --wrap: 1120px;
  --r-s: 6px;
  --r-m: 12px;
  --r-l: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 22px 44px -22px rgba(0, 0, 0, .7);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--sky); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #c4e2f8; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { width: min(var(--wrap), calc(100% - 48px)); margin-inline: auto; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.top.is-stuck { border-bottom-color: var(--line); }
.top-in { display: flex; align-items: center; gap: 28px; height: 60px; }
.brand { font: 500 18px/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.top nav { display: flex; gap: 4px; margin-left: auto; }
.top nav a {
  color: var(--ink-2); text-decoration: none; font-size: 14.5px; font-weight: 500;
  padding: 7px 11px; border-radius: 999px;
}
.top nav a:hover { color: var(--ink); background: var(--panel); }
.top nav a.is-here { color: var(--bg); background: var(--sky); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink);
  font-size: 14.5px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--panel-2); border-color: var(--sky); color: var(--ink); }
.btn.solid { background: var(--sky); border-color: var(--sky); color: #0b1220; font-weight: 600; }
.btn.solid:hover { background: #b4daf5; color: #0b1220; }
.btn.small { padding: 6px 12px; font-size: 13.5px; }
.btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn:disabled { opacity: .4; cursor: default; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 72px 0 84px; overflow: hidden; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; pointer-events: none;
  -webkit-mask-image: linear-gradient(100deg, transparent 30%, #000 75%);
          mask-image: linear-gradient(100deg, transparent 30%, #000 75%); }
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: end; }
.hero-hello { font: 500 18px/1.4 var(--body); color: var(--ink-2); margin: 0 0 12px; }
.hero-hello b { color: var(--ink); font-weight: 600; }
.hero-kicker { font: 500 11.5px/1.5 var(--mono); letter-spacing: .065em; text-transform: uppercase; color: var(--ok); margin: 0 0 18px; }
.hero-line {
  font: 500 clamp(40px, 6.6vw, 84px)/1.02 var(--display);
  letter-spacing: -.035em; margin: 0; min-height: 3.1em;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: .14em .24em;
}
.hw { display: inline-block; position: relative; border-radius: .12em; transition: color .4s, background .4s; white-space: nowrap; }
.hw.m { color: transparent; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line-2); }
.hw.m.amber { background: color-mix(in srgb, var(--mask) 18%, var(--panel)); box-shadow: inset 0 0 0 2px var(--mask); }
.hw.amber::after {
  content: "[MASK]"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 500 .2em/1 var(--mono); letter-spacing: 0; color: var(--mask);
}
.hw.flag { color: var(--stale); text-decoration: line-through; text-decoration-thickness: .06em; }
.hw.new { color: var(--ok); }
.hw.settle { color: var(--ink); box-shadow: 0 .09em 0 -.02em var(--ok); border-radius: 0; }
.hw.pop { animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: translateY(.18em) scale(.96); opacity: 0; } }

.hero-steps { display: flex; align-items: center; gap: 10px; margin: 30px 0 0; flex-wrap: wrap; }
.hstep {
  font: 500 14px/1 var(--mono); padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-3); transition: all .3s;
}
.hstep[data-on="1"][data-k="draft"] { color: #0b1220; background: var(--draft); border-color: var(--draft); }
.hstep[data-on="1"][data-k="detect"] { color: #3a0612; background: var(--stale); border-color: var(--stale); }
.hstep[data-on="1"][data-k="remask"] { color: #3a2a06; background: var(--mask); border-color: var(--mask); }
.hstep[data-on="1"][data-k="repair"] { color: #06301f; background: var(--ok); border-color: var(--ok); }
.hero-sub { max-width: 62ch; font-size: 19px; line-height: 1.55; color: var(--ink-2); margin: 30px 0 0; }
.hero-sub strong { color: var(--ink); font-weight: 600; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; }

.card-me { border: 1px solid var(--line); border-radius: var(--r-l); background: color-mix(in srgb, var(--panel) 88%, transparent); padding: 20px; backdrop-filter: blur(6px); }
.portrait { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: var(--panel-2); border: 2px solid var(--line-2); }
.portrait-fallback { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 2px solid var(--line-2); font: 500 30px/1 var(--display); color: var(--sky); }
.card-me h2 { font: 500 21px/1.2 var(--display); margin: 14px 0 2px; letter-spacing: -.01em; }
.card-me p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.facts { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: grid; gap: 9px; }
.facts li { font-size: 14px; line-height: 1.4; color: var(--ink-2); display: grid; grid-template-columns: 76px 1fr; gap: 8px; }
.facts li span:first-child { color: var(--ink-3); }
.facts li a { color: var(--ink); }
.links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 16px; font-size: 14px; }

/* ---------- section scaffolding ---------- */
.band { padding: 84px 0; position: relative; }
.band.alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.band-head { max-width: 760px; margin-bottom: 34px; }
.band-head h2, .ch-head h2 {
  font: 500 clamp(30px, 4vw, 50px)/1.06 var(--display); letter-spacing: -.028em; margin: 0 0 16px;
  text-wrap: balance;
}
.band-head p, .ch-lede { color: var(--ink-2); font-size: 18.5px; line-height: 1.6; margin: 0; max-width: 68ch; }
.ch-lede + .ch-lede { margin-top: 12px; }

/* ---------- research map ---------- */
.map-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.map-tools .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--k, var(--ink-3)); }
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--panel-2); color: var(--ink); border-color: var(--k, var(--ink)); }
.map-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-l); background:
  radial-gradient(900px 380px at 85% 50%, rgba(142, 197, 238, .07), transparent 70%), var(--panel); }
#map { min-width: 980px; width: 100%; height: auto; }
#map text { font-family: var(--body); fill: var(--ink-2); }
#map .yr { font: 500 12.5px var(--mono); fill: var(--ink-3); }
#map .lane-name { font: 600 13.5px var(--body); }
#map .edge { fill: none; stroke-width: 2.5; stroke-linecap: round; opacity: .85; transition: opacity .3s, stroke-width .3s; }
#map .edge.grow { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }
#map.is-in .edge.grow { animation: grow 1.1s ease forwards; animation-delay: var(--d, 0s); }
@keyframes grow { to { stroke-dashoffset: 0; } }
#map .node { cursor: pointer; }
#map .node .halo { opacity: 0; transition: opacity .25s; }
#map .node:hover .halo, #map .node:focus-visible .halo, #map .node.is-tour .halo { opacity: .28; }
#map .node .dot { stroke: var(--panel); stroke-width: 3; transition: r .25s; }
#map .node .nm { font: 600 14px var(--body); fill: var(--ink); }
#map .node .vn { font: 500 12px var(--mono); fill: var(--ink-3); }
#map .node.big .nm { font: 500 16.5px var(--display); }
#map .node { opacity: 0; }
#map.is-in .node { animation: nodein .5s ease forwards; animation-delay: var(--d, 0s); }
@keyframes nodein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#map .dim { opacity: .16 !important; }
#map .node.dim { animation: none; }
#map .pulse { opacity: .9; }
#map:focus { outline: none; }
.map-foot { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; font-size: 14px; color: var(--ink-3); }
.map-foot span { display: inline-flex; align-items: center; gap: 8px; }
.map-foot i { width: 22px; height: 3px; border-radius: 2px; background: var(--k); }

/* ---------- chapters on the path ---------- */
.chapters { counter-reset: ch; position: relative; }
.thread-head { padding: 70px 0 6px; }
.thread-head h2 { font: 500 clamp(26px, 3.2vw, 38px)/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 10px; color: var(--k); }
.thread-head p { margin: 0; color: var(--ink-2); max-width: 66ch; font-size: 18px; }

.chapter { counter-increment: ch; position: relative; padding: 64px 0 20px 0; }
.chapter .wrap { position: relative; padding-left: 74px; }
.chapter .wrap::before { /* the path */
  content: ""; position: absolute; left: 22px; top: -64px; bottom: -20px; width: 2px;
  background: linear-gradient(var(--k), var(--k)); opacity: .45;
}
.chapter .wrap::after { /* node on the path */
  content: counter(ch); position: absolute; left: 0; top: 0; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font: 500 17px/1 var(--display);
  background: var(--bg); color: var(--k); border: 2px solid var(--k);
  box-shadow: 0 0 0 6px var(--bg);
}
.chapter.is-current .wrap::after { background: var(--k); color: var(--bg); }
[data-thread="roots"] { --k: var(--ink-3); }
[data-thread="gen"] { --k: var(--sky); }
[data-thread="eff"] { --k: var(--lilac); }
[data-thread="agents"] { --k: var(--peach); }
[data-thread="next"] { --k: var(--ok); }

.ch-head { max-width: 800px; margin-bottom: 28px; }
.ch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0 16px; font-size: 14.5px; color: var(--ink-3); line-height: 1.45; }
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font: 500 12.5px/1.2 var(--mono); border: 1px solid var(--line-2); color: var(--ink); white-space: nowrap; }
.badge.gold { background: var(--mask); border-color: var(--mask); color: #2c1e02; font-weight: 600; }
.badge.pub { background: color-mix(in srgb, var(--ok) 16%, transparent); border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.badge.rev { border-style: dashed; color: var(--ink-2); }
.mine { margin: 18px 0 0; padding: 12px 16px; border-left: 3px solid var(--k); background: var(--panel); border-radius: 0 var(--r-s) var(--r-s) 0; font-size: 15.5px; color: var(--ink-2); max-width: 760px; }
.mine b { color: var(--ink); font-weight: 600; }
.ch-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.ch-sub { font: 500 25px/1.2 var(--display); letter-spacing: -.015em; margin: 48px 0 10px; max-width: 760px; text-wrap: balance; }
.ch-p { margin: 0 0 18px; max-width: 72ch; color: var(--ink-2); font-size: 17px; }
.bridge { margin: 34px 0 0; max-width: 700px; font: 500 20px/1.45 var(--display); letter-spacing: -.01em; color: var(--ink); }
.bridge small { display: block; margin-top: 6px; font: 400 15px/1.5 var(--body); color: var(--ink-3); letter-spacing: 0; }

.cols { display: grid; gap: 18px; }
.cols.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 18px; }

/* ---------- figures ---------- */
.fig-frame { margin: 0; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); overflow: hidden; }
.fig-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.fig-title { font: 500 16.5px/1.3 var(--display); letter-spacing: -.005em; margin-right: auto; }
.fig-kind { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; }
.fig-kind i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.fig-kind.reported i { background: var(--ok); }
.fig-kind.illustration i, .fig-kind.schematic i { background: var(--mask); }
.fig-kind.simulation i { background: var(--lilac); }
.fig-body { padding: 22px 20px; }
.fig-note { margin: 0; padding: 12px 20px 14px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.5; color: var(--ink-3); }
.fig-note a { color: var(--ink-2); }

.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.ctl-label { font-size: 14px; color: var(--ink-2); }
.ctl .grow { flex: 1; }
.step-name { font: 500 14px/1.3 var(--mono); color: var(--ink-2); min-width: 0; }
.step-name b { color: var(--ink); font-weight: 500; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 18px; height: 4px; border-radius: 2px; background: var(--line-2); transition: background .3s; }
.dots i.on { background: var(--sky); }
select.pick { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 30px 6px 13px; font-size: 14px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="range"] { accent-color: var(--sky); width: 180px; max-width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; padding: 6px 13px; border-radius: 999px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.tabs { margin-bottom: 20px; }

.readout { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.readout div { font-size: 14px; color: var(--ink-3); }
.readout b { display: block; font: 500 24px/1.15 var(--display); color: var(--ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* tokens */
.toks { display: flex; flex-wrap: wrap; gap: 7px 6px; align-items: flex-start; font: 500 15.5px/1 var(--mono); }
.tk { display: inline-flex; flex-direction: column; align-items: stretch; gap: 4px; }
.tok {
  display: inline-block; padding: 7px 8px; border-radius: var(--r-s);
  background: var(--panel-2); color: var(--ink); border: 1px solid transparent; white-space: nowrap;
  transition: background .3s, color .3s, border-color .3s, opacity .3s;
}
.tok.plain { background: transparent; padding-inline: 2px; }
.tok.stale { background: color-mix(in srgb, var(--stale) 20%, var(--panel)); border-color: var(--stale); color: #ffd3da; animation: flag .5s ease; }
.tok.missed { border-bottom: 2px dotted var(--stale); border-radius: var(--r-s) var(--r-s) 0 0; }
.tok.mask { background: color-mix(in srgb, var(--mask) 14%, var(--panel)); border: 1px dashed var(--mask); color: var(--mask); animation: flipin .45s ease; }
.tok.ok { background: color-mix(in srgb, var(--ok) 18%, var(--panel)); border-color: var(--ok); color: #d3fbec; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.tok.same { background: transparent; border: 1px dashed color-mix(in srgb, var(--ok) 60%, transparent); color: var(--ink); }
.tok.gone { background: transparent; color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--stale); padding-inline: 3px; }
.tok.pend { background: color-mix(in srgb, var(--draft) 16%, var(--panel)); border: 1px dashed var(--draft); color: #d6ecfb; animation: pop .4s ease; }
.tok.drop { opacity: .35; text-decoration: line-through; }
.tok.fix { background: color-mix(in srgb, var(--mask) 22%, var(--panel)); border-color: var(--mask); color: #ffe9bd; animation: pop .45s ease; }
.tok.skip { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-3); opacity: .6; }
.tok.regen { background: color-mix(in srgb, var(--lilac) 20%, var(--panel)); border-color: var(--lilac); animation: pop .4s ease; }
.tok.given { background: var(--ok); color: #06301f; font-weight: 600; }
.tok.click { cursor: pointer; }
.tok.click:hover { border-color: var(--ink-3); }
@keyframes flag { 0% { transform: translateY(0); } 40% { transform: translateY(-4px); } 100% { transform: none; } }
@keyframes flipin { from { transform: rotateX(80deg); opacity: 0; } }
.no-anim .tok { animation: none !important; }
.risk { height: 26px; display: flex; align-items: flex-end; }
.risk::before { content: ""; display: block; width: 100%; height: calc(var(--s) * 100%); min-height: 2px; border-radius: 2px 2px 0 0; background: var(--ink-3); transition: height .5s ease; }
.risk.hi::before { background: var(--stale); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink-2); margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--k); }
.legend i.ln { height: 3px; width: 18px; border-radius: 2px; }
.legend i.dash { background: transparent; border: 1px dashed var(--k); }

/* small cards inside figures and chapters */
.cardlet { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--bg-2); padding: 16px 18px; }
.cardlet h4 { font: 500 15.5px/1.3 var(--display); margin: 0 0 8px; }
.cardlet p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.cardlet p + p { margin-top: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 14px; align-items: center; font-size: 15px; }
.kv .k { color: var(--ink-3); white-space: nowrap; }
.kv .v { font-family: var(--mono); font-size: 14px; white-space: nowrap; transition: color .3s, opacity .3s; }
.kv .v.old.struck { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--stale); }
.kv .v.neu { color: var(--ok); opacity: 0; transform: translateX(-6px); transition: opacity .4s, transform .4s; }
.kv .v.neu.in { opacity: 1; transform: none; }

/* numbers strip */
.nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; background: var(--panel); }
.nums div { padding: 16px 18px; border-right: 1px solid var(--line); margin-right: -1px; border-bottom: 1px solid var(--line); margin-bottom: -1px; }
.nums b { display: block; font: 500 30px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.nums span { display: block; margin-top: 6px; font-size: 14px; line-height: 1.4; color: var(--ink-2); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl thead th { font-weight: 600; font-size: 13.5px; color: var(--ink-2); background: var(--bg-2); white-space: nowrap; }
.tbl tbody tr:last-child td, .tbl tbody tr:last-child th { border-bottom: 0; }
.tbl tbody th { font-weight: 500; color: var(--ink); }
.tbl .num { text-align: right; font-family: var(--mono); font-size: 14.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.best { color: var(--ok); font-weight: 600; }
.tbl tr.ours th, .tbl tr.ours td { background: color-mix(in srgb, var(--c1) 12%, transparent); }
.tbl tbody tr:hover td, .tbl tbody tr:hover th { background: color-mix(in srgb, var(--sky) 6%, transparent); }
.tbl caption { caption-side: bottom; text-align: left; padding: 10px 14px; font-size: 13.5px; color: var(--ink-3); border-top: 1px solid var(--line); }
.tbl a { white-space: nowrap; }

/* charts */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-2); stroke-width: 1; }
.chart text { font: 400 12px var(--body); fill: var(--ink-3); }
.chart text.lbl { fill: var(--ink); font-weight: 500; font-size: 12.5px; }
.chart text.ax { fill: var(--ink-2); font-size: 12.5px; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: grow 1.2s ease forwards; }
.chart .pt { stroke: var(--panel); stroke-width: 2; }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; }
.chart .ref { stroke: var(--ink-3); stroke-width: 1.5; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 18px; height: 3px; border-radius: 2px; background: var(--k); }
.chart-legend i.dot { width: 10px; height: 10px; border-radius: 50%; }

.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 68px; gap: 12px; align-items: center; font-size: 14.5px; }
.bar-row .nm { color: var(--ink); line-height: 1.3; }
.bar-row .nm small { display: block; color: var(--ink-3); font-size: 13px; }
.bar-track { position: relative; height: 18px; }
.bar-track::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--k, var(--c1)); border-radius: 0 4px 4px 0; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.bar-ref { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 1.5px solid var(--ink-3); }
.bar-ref span { position: absolute; top: -17px; left: -40px; width: 80px; text-align: center; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.bar-row .val { font: 500 14.5px var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.dot-track { position: relative; height: 18px; }
.dot-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-2); }
.dot-mark { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--k, var(--c1)); box-shadow: 0 0 0 2px var(--panel); left: 0; transition: left .9s cubic-bezier(.2, .8, .2, 1); }
.dot-axis { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 68px; gap: 12px; font: 400 12px var(--mono); color: var(--ink-3); }
.dot-axis div { display: flex; justify-content: space-between; }

.tip {
  position: fixed; z-index: 80; pointer-events: none; max-width: 300px;
  background: #080a0e; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px;
  font-size: 13.5px; line-height: 1.45; color: var(--ink-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
.tip.on { opacity: 1; transform: none; }
.tip b { color: var(--ink); font-weight: 600; }
.tip .tr { display: flex; align-items: center; gap: 8px; }
.tip .tr i { width: 14px; height: 3px; border-radius: 2px; background: var(--k); flex: none; }
.tip .tr b { font-family: var(--mono); font-weight: 500; }
.tip .th { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

/* figure-specific */
.ar-row { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: center; padding: 12px 0; }
.ar-row + .ar-row { border-top: 1px solid var(--line); }
.ar-row h4 { margin: 0; font: 600 15px/1.3 var(--body); }
.ar-row h4 small { display: block; font-weight: 400; color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }

.infill { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; }
.tpl { display: grid; gap: 12px; }
.tpl .slot { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; background: var(--bg-2); }
.tpl .slot > span { display: block; font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.tpl .q { font-size: 15.5px; color: var(--ink); line-height: 1.45; }
.cands { display: grid; gap: 6px; margin-top: 12px; }
.cand { display: grid; grid-template-columns: 34px 1fr 46px; gap: 8px; align-items: center; font: 500 13.5px var(--mono); color: var(--ink-2); }
.cand .t { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.cand .t i { display: block; height: 100%; width: 0; background: var(--ink-3); border-radius: 4px; transition: width .45s ease; }
.cand.top .t i { background: var(--ok); }
.cand.top { color: var(--ink); }

.drr { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; }
.drr .sum { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--bg-2); padding: 18px; min-height: 250px; }
.drr .sum > span { display: block; font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }

.flip { position: relative; }
.flip .tag { font: 500 12.5px var(--mono); color: var(--ink-3); }
.flip p { transition: opacity .35s; }
.flip mark { background: color-mix(in srgb, var(--stale) 24%, transparent); color: #ffd3da; border-radius: 3px; padding: 1px 3px; }
.flip.later mark { background: color-mix(in srgb, var(--ok) 22%, transparent); color: #d3fbec; }
.pipe { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; counter-reset: p; }
.pipe li { list-style: none; counter-increment: p; border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; font-size: 14.5px; color: var(--ink-2); background: var(--bg-2); line-height: 1.4; }
.pipe li::before { content: counter(p); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-2); color: var(--ink); font: 600 13px var(--mono); margin-bottom: 8px; }
.pipe li b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
ol.pipe { padding: 0; margin: 0; }
.pipe li.on { border-color: var(--sky); }
.pipe li.on::before { background: var(--sky); color: #0b1220; }

.report { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; }
.tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tl button { width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--r-s); padding: 9px 10px; display: grid; grid-template-columns: 34px 1fr; gap: 2px 8px; }
.tl button b { font: 600 13.5px var(--mono); color: var(--ink-3); grid-row: span 2; align-self: center; }
.tl button span { font-size: 14.5px; color: var(--ink-2); line-height: 1.3; }
.tl button small { font: 400 12.5px var(--mono); color: var(--ink-3); }
.tl button[aria-pressed="true"] { background: var(--panel-2); border-color: var(--line-2); }
.tl button[aria-pressed="true"] b { color: var(--sky); }
.tl button[aria-pressed="true"] span { color: var(--ink); }
.doc { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--bg-2); padding: 18px; display: grid; gap: 14px; }
.para { display: flex; flex-wrap: wrap; gap: 6px 5px; padding: 8px; border-radius: var(--r-s); border: 1px solid transparent; transition: border-color .4s, background .4s; }
.para.touched { border-color: var(--line-2); background: color-mix(in srgb, var(--sky) 5%, transparent); }
.para i { height: 9px; border-radius: 3px; background: var(--line-2); transition: background .4s, opacity .4s; }
.para i.neu { background: var(--c1); animation: pop .5s ease; }
.para i.old { background: transparent; box-shadow: inset 0 0 0 1px var(--stale); position: relative; opacity: .8; }
.para i.old::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 1px; background: var(--stale); }
.caps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.caps li { font-size: 14px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); }

.recipe { margin: 0; padding-left: 20px; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.recipe li + li { margin-top: 4px; }
.recipe b { color: var(--ink); font-weight: 600; font-family: var(--mono); font-size: 14px; }
.frame-note { font-size: 14.5px; color: var(--ink-2); margin: 14px 0 0; min-height: 3em; }
.frame-title { font: 600 15px var(--body); margin: 0 0 12px; }
.mini4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mini4 h5 { margin: 0 0 4px; font: 600 14px var(--body); color: var(--ink); }

.horizon { display: grid; gap: 18px; }
.hz-row h4 { margin: 0 0 8px; font: 600 15px var(--body); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hz-row h4 span { font: 500 14px var(--mono); color: var(--ink-2); }
.cells { display: flex; flex-wrap: wrap; gap: 3px; }
.cells i { width: 9px; height: 9px; border-radius: 2px; background: var(--line); transition: background .2s; }
.cells i.on { background: var(--c1); }
.cells i.fail { background: var(--stale); box-shadow: 0 0 0 2px color-mix(in srgb, var(--stale) 35%, transparent); }
.fails { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; min-height: 34px; }
.fails span { font-size: 13.5px; display: none; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--stale); color: #ffd3da; background: color-mix(in srgb, var(--stale) 12%, transparent); animation: pop .4s ease; }

.forge-ui { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; align-items: start; }
#forge-svg { width: 100%; height: auto; }
#forge-svg text { font-family: var(--body); fill: var(--ink-2); font-size: 13px; }
#forge-svg .bx { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 1.5; }
#forge-svg .bx.hot { stroke: var(--peach); }
#forge-svg .t1 { fill: var(--ink); font: 500 15px var(--display); }
#forge-svg .t2 { fill: var(--ink-3); font-size: 12.5px; }
#forge-svg .wire { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
#forge-svg .pod { fill: var(--line); transition: fill .3s; }
#forge-svg .pod.run { fill: var(--c1); }
#forge-svg .pod.pass { fill: var(--ok); }
#forge-svg .pod.fail { fill: var(--stale); }
.pick-group { display: grid; gap: 8px; }
.pick-group + .pick-group { margin-top: 16px; }
.pick-group > span { font-size: 13.5px; color: var(--ink-3); }
.pick-group .seg { border-radius: var(--r-m); }

.sim { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.sim h4 { margin: 0 0 10px; font: 600 15px var(--body); }
.sim canvas { width: 100%; height: 190px; border-radius: var(--r-m); background: var(--bg-2); border: 1px solid var(--line); }

.loop { display: grid; grid-template-columns: minmax(280px, 440px) minmax(0, 1fr); gap: 34px; align-items: center; }
#loop-svg { width: 100%; height: auto; }
#loop-svg .ring { fill: none; stroke-width: 34; opacity: .28; transition: opacity .3s; cursor: pointer; }
#loop-svg .ring.on { opacity: 1; }
#loop-svg text { font: 600 13.5px var(--body); fill: var(--ink-2); pointer-events: none; }
#loop-svg text.c { font: 500 19px var(--display); fill: var(--ink); }
#loop-svg .rl { font: 600 12.5px var(--mono); fill: var(--bg); }
.loop-side h3 { font: 500 28px/1.1 var(--display); margin: 0 0 14px; letter-spacing: -.02em; }
.loop-rows { display: grid; gap: 10px; }
.loop-rows div { display: grid; grid-template-columns: 78px 1fr; gap: 12px; font-size: 15.5px; color: var(--ink-2); padding: 10px 0; border-top: 1px solid var(--line); }
.loop-rows b { font: 500 13.5px var(--mono); padding-top: 2px; }
.loop-rows b.d { color: var(--draft); } .loop-rows b.v { color: var(--mask); } .loop-rows b.r { color: var(--ok); }
.loop-where { margin-top: 14px; font-size: 14.5px; color: var(--ink-3); }

.roots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.root { border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px 20px; background: var(--panel); }
.root .when { font: 500 13px var(--mono); color: var(--ink-3); }
.root h3 { font: 500 19px/1.25 var(--display); margin: 6px 0 8px; letter-spacing: -.01em; }
.root p { margin: 0; font-size: 15.5px; color: var(--ink-2); line-height: 1.55; }
.root .feeds { margin-top: 12px; font-size: 14px; color: var(--ink-3); }


.next-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: n; }
.next-card { border: 1px solid var(--line); border-top: 3px solid var(--ok); border-radius: var(--r-m); padding: 20px; background: var(--panel); }
.next-card h3 { font: 500 20px/1.2 var(--display); margin: 0 0 10px; letter-spacing: -.01em; }
.next-card p { margin: 0; font-size: 15.5px; color: var(--ink-2); line-height: 1.55; }
.next-card .from { margin-top: 12px; font-size: 14px; color: var(--ink-3); }

.people { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.people li { font-size: 14.5px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); }
.people li b { color: var(--ink); font-weight: 600; }
.people li a { color: var(--ink); text-decoration: none; }
.people li a:hover { text-decoration: underline; }

footer { padding: 46px 0 120px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 14.5px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; justify-content: space-between; }

/* ---------- rail + tour ---------- */
.rail { position: fixed; left: 18px; top: 50%; transform: translateY(-50%); z-index: 30; display: none; flex-direction: column; gap: 4px; opacity: 0; transition: opacity .3s; }
.rail.on { opacity: 1; }
.rail a { position: relative; display: block; width: 26px; height: 26px; }
.rail a::before { content: ""; position: absolute; left: 8px; top: 8px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--k); background: var(--bg); transition: transform .2s, background .2s; }
.rail a::after { content: ""; position: absolute; left: 12px; top: 22px; width: 2px; height: 12px; background: var(--line-2); }
.rail a:last-child::after { display: none; }
.rail a.is-here::before { background: var(--k); transform: scale(1.35); }
.rail a span { position: absolute; left: 30px; top: 2px; white-space: nowrap; font-size: 13.5px; background: #080a0e; border: 1px solid var(--line-2); color: var(--ink); padding: 3px 9px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.rail a:hover span, .rail a:focus-visible span { opacity: 1; }
@media (min-width: 1280px) { .rail { display: flex; } }

.tour { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 90px); z-index: 50; display: flex; align-items: center; gap: 6px;
  background: #080a0e; border: 1px solid var(--line-2); border-radius: 999px; padding: 6px; box-shadow: 0 14px 40px rgba(0, 0, 0, .5); transition: transform .35s cubic-bezier(.2, .9, .3, 1); max-width: calc(100vw - 24px); }
.tour.on { transform: translate(-50%, 0); }
.tour button { border: 0; background: var(--panel-2); color: var(--ink); border-radius: 999px; padding: 9px 16px; font-size: 14.5px; font-weight: 500; }
.tour button:hover:not(:disabled) { background: var(--sky); color: #0b1220; }
.tour button:disabled { opacity: .35; cursor: default; }
.tour .where { padding: 0 12px; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tour .where b { font: 500 14px var(--mono); color: var(--ink); margin-right: 8px; }
.tour .keys { font: 400 12.5px var(--mono); color: var(--ink-3); padding-right: 10px; white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .card-me { max-width: 420px; }
  .infill, .drr, .report, .forge-ui, .loop, .sim { grid-template-columns: minmax(0, 1fr); }
  .cols.c3, .cols.c4, .next-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top nav a:not(.keep) { display: none; }
}
@media (max-width: 700px) {
  body { font-size: 16px; }
  .wrap { width: calc(100% - 32px); }
  .hero { padding: 40px 0 56px; }
  .band { padding: 56px 0; }
  .chapter .wrap { padding-left: 0; padding-top: 62px; }
  .chapter .wrap::before { display: none; }
  .cols.c2, .cols.c3, .cols.c4, .roots, .next-grid, .mini4 { grid-template-columns: minmax(0, 1fr); }
  .pipe { grid-template-columns: minmax(0, 1fr); }
  .tour .where b { margin-right: 6px; }
  .hero-line { min-height: 4.2em; }
  .ar-row { grid-template-columns: 1fr; gap: 8px; }
  .bar-row, .dot-axis { grid-template-columns: 96px 1fr 58px; gap: 8px; }
  .fig-body { padding: 16px 14px; }
  .toks { font-size: 14px; }
  .tour .keys { display: none; }
  .tour .where { max-width: 44vw; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; }
}
@media print {
  .top, .rail, .tour, #field { display: none !important; }
  body { background: #fff; color: #000; }
}

.fails span.on { display: inline-block; }
#map { min-width: 1040px; }
.forge-scroll { overflow-x: auto; }
.seg { border-radius: 22px; }
@media (max-width: 700px) { #forge-svg { min-width: 600px; } #loop-svg text { font-size: 15px; } }

/* =====================================================================
   Version 3 additions: type overrides, scroll motion, paper figures,
   video, publications, and the components shared with the light build.
   ===================================================================== */

/* ---------- type: serif display at regular weight ---------- */
.brand { font-size: 21px; }
.hero-line { font-weight: 400; letter-spacing: -.03em; line-height: 1.02; }
.band-head h2, .ch-head h2 { font: 400 clamp(32px, 4.4vw, 56px)/1.05 var(--display); letter-spacing: -.025em; }
.thread-head h2 { font: 400 clamp(28px, 3.4vw, 42px)/1.1 var(--display); }
.bridge { font: 400 clamp(22px, 2.5vw, 30px)/1.25 var(--display); letter-spacing: -.015em; max-width: 26em; text-wrap: balance; }
.fig-title { font: 600 15.5px/1.3 var(--body); letter-spacing: 0; }
.cardlet h4 { font: 600 15px/1.3 var(--body); }
.readout b { font: 400 30px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums; }
.nums b { font: 400 40px/1.05 var(--display); font-variant-numeric: tabular-nums lining-nums; }
.ch-sub { font-weight: 400; font-size: 28px; }
#map .node.big .nm { font: 500 19px var(--display); }
.loop-side h3 { font-weight: 400; font-size: 34px; }
.chapter .wrap::after { font: 600 16px/1 var(--body); }
.card-me h2 { font-size: 24px; }
.kicker { font: 500 14px/1.3 var(--mono); color: var(--ink-3); margin: 0 0 18px; }
.h-xl { font: 400 clamp(36px, 5.4vw, 72px)/1.03 var(--display); letter-spacing: -.03em; margin: 0; text-wrap: balance; }
.lede { font-size: clamp(18px, 1.5vw, 20px); line-height: 1.55; color: var(--ink-2); margin: 22px 0 0; max-width: 36em; }
.btn.solid { color: #0b1220; }
.narrow { max-width: 760px; }

/* ---------- scroll progress, thread glow ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60; }
.progress i { display: block; height: 100%; width: calc(var(--page, 0) * 100%); background: var(--sky); }
.glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.glow i { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease; }
.glow i:nth-child(1) { background: radial-gradient(1100px 700px at 88% -8%, rgba(142, 197, 238, .16), transparent 62%), radial-gradient(800px 600px at -6% 108%, rgba(142, 197, 238, .07), transparent 60%); }
.glow i:nth-child(2) { background: radial-gradient(1100px 700px at 88% -8%, rgba(185, 164, 255, .17), transparent 62%), radial-gradient(800px 600px at -6% 108%, rgba(185, 164, 255, .07), transparent 60%); }
.glow i:nth-child(3) { background: radial-gradient(1100px 700px at 88% -8%, rgba(255, 168, 115, .14), transparent 62%), radial-gradient(800px 600px at -6% 108%, rgba(255, 168, 115, .06), transparent 60%); }
.glow i:nth-child(4) { background: radial-gradient(1100px 700px at 88% -8%, rgba(69, 214, 164, .13), transparent 62%), radial-gradient(800px 600px at -6% 108%, rgba(69, 214, 164, .06), transparent 60%); }
body[data-glow="gen"] .glow i:nth-child(1), body[data-glow="eff"] .glow i:nth-child(2),
body[data-glow="agents"] .glow i:nth-child(3), body[data-glow="next"] .glow i:nth-child(4) { opacity: 1; }
.band.alt { background: color-mix(in srgb, var(--bg-2) 82%, transparent); }

/* ---------- reveal on scroll ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); will-change: opacity, transform; }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="scale"] { transform: scale(.96) translateY(20px); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.hero-grid { transform: translateY(calc(var(--hero, 0) * -50px)); opacity: calc(1 - var(--hero, 0) * 1.1); }
#field { opacity: calc(.55 - var(--hero, 0) * .5); }

/* ---------- hero details ---------- */
.portrait { width: 96px; height: 96px; }
.hero-steps .btn { border-color: var(--line-2); }

/* ---------- publications, placed first ---------- */
.pubs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.pubcard { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); overflow: hidden; transition: transform .35s var(--ease), border-color .3s; }
.pubcard:hover { transform: translateY(-4px); border-color: var(--line-2); }
.pubcard .thumb { display: block; height: 168px; background: #fff; overflow: hidden; }
.pubcard .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .6s var(--ease); }
.pubcard:hover .thumb img { transform: scale(1.04); }
.pubcard .in { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pubcard h3 { font: 500 19px/1.22 var(--display); margin: 0; letter-spacing: -.008em; }
.pubcard .by { font-size: 13.5px; color: var(--ink-3); line-height: 1.45; margin: 0; }
.pubcard .by b { color: var(--ink); font-weight: 600; }
.pubcard .go { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.pub-more { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); }
.pub-more div { display: grid; grid-template-columns: minmax(0, 1fr) 150px 110px 110px; gap: 14px; padding: 13px 18px; align-items: baseline; font-size: 15px; }
.pub-more div + div { border-top: 1px solid var(--line); }
.pub-more span { color: var(--ink-3); font-size: 14px; }

/* ---------- layout helpers, paper figures, video ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(18px, 2.4vw, 30px); align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.split.center { align-items: center; }
.gap { margin-top: 24px; }
.shot { margin: 0; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
.shot button.zoom { display: block; width: 100%; padding: clamp(12px, 1.8vw, 22px); border: 0; background: #fff; cursor: zoom-in; }
.shot img { width: 100%; height: auto; }
.shot figcaption { padding: 11px 18px 13px; background: var(--panel); border-top: 1px solid var(--line-2); font-size: 13.5px; color: var(--ink-3); line-height: 1.5; }
.film { margin: 0; border: 1px solid var(--line-2); border-radius: var(--r-l); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.film video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #000; }
.film figcaption { padding: 11px 18px 13px; background: var(--panel); border-top: 1px solid var(--line-2); font-size: 13.5px; color: var(--ink-3); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; margin-top: 26px; border-top: 1px solid var(--line-2); }
.stats div { padding: 18px 18px 4px 0; }
.stats div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.stats b { display: block; font: 400 clamp(36px, 4.2vw, 54px)/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums lining-nums; color: var(--ink); }
.stats span { display: block; margin-top: 10px; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.stats.col { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
.stats.col div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
.stats.col div { padding-bottom: 14px; }
.stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.stats.two div { padding: 18px 16px 14px 0; border-left: 0; }
.stats.two div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
.stats.two div:nth-child(n+3) { border-top: 1px solid var(--line); }
.stats.two b { font-size: clamp(32px, 3.4vw, 44px); }

details.more { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); }
details.more > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 500; font-size: 15.5px; display: flex; align-items: center; gap: 12px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font: 400 15px/1 var(--mono); color: var(--ink-2); flex: none; }
details.more[open] > summary::before { content: "−"; }
details.more > summary span { color: var(--ink-3); font-weight: 400; font-size: 14.5px; }
details.more > summary:hover { color: var(--sky); }
details.more .more-body { padding: 4px 18px 20px; }
details.more .more-body > p { color: var(--ink-2); max-width: 46em; font-size: 15.5px; margin: 0 0 16px; }
.more .fig-frame { background: var(--bg-2); }

.browser { border: 1px solid var(--line-2); border-radius: var(--r-l); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.browser-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.browser-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.browser-bar span { margin-left: 12px; flex: 1; font: 400 12.5px var(--mono); color: var(--ink-3); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-body { padding: 22px; }
.browser iframe { display: block; width: 100%; height: 640px; border: 0; background: #fff; }

/* ---------- the stale summary (motivation figure) ---------- */
.stale-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(20px, 3vw, 44px); align-items: center; }
.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 26px; width: 1px; background: var(--line-2); }
.feed li { position: relative; padding: 0 0 18px 30px; opacity: .25; transform: translateY(6px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.feed li.on { opacity: 1; transform: none; }
.feed li::before { content: ""; position: absolute; left: 0; top: 5px; width: 13px; height: 13px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line-2); transition: border-color .4s, background .4s; }
.feed li.on::before { border-color: var(--ink-2); }
.feed li.now::before { background: var(--sky); border-color: var(--sky); }
.feed time { font: 500 13px var(--mono); color: var(--ink-3); display: block; }
.feed p { margin: 2px 0 0; font-size: 16px; color: var(--ink); }
.board { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-m); padding: clamp(18px, 2.4vw, 28px); }
.board-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font: 500 13px var(--mono); color: var(--ink-3); margin-bottom: 16px; }
.stamp { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); transition: all .4s; white-space: nowrap; }
.stamp.old { color: var(--stale); border-color: var(--stale); background: color-mix(in srgb, var(--stale) 10%, transparent); }
.stamp.fresh { color: var(--ok); border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.board-text { font: 400 clamp(24px, 2.7vw, 34px)/1.2 var(--display); letter-spacing: -.015em; margin: 0; min-height: 3.7em; }
.board-text span { transition: color .5s, background .5s, box-shadow .5s; border-radius: 6px; }
.board-text .s.flag { color: var(--stale); text-decoration: line-through; text-decoration-thickness: 2px; }
.board-text .s.mask { color: transparent; background: color-mix(in srgb, var(--mask) 16%, var(--panel)); box-shadow: inset 0 0 0 1.5px var(--mask); }
.board-text .s.new { color: var(--ok); }
.board-foot { margin: 14px 0 0; font-size: 15px; color: var(--ink-2); min-height: 3em; }

/* ---------- tokens and small pieces shared with the light build ---------- */
.tok.yes { background: color-mix(in srgb, var(--ok) 18%, var(--panel)); border-color: var(--ok); color: #d3fbec; animation: pop .4s ease; }
.tok.pend { background: transparent; border: 1px dashed var(--gray); color: var(--ink-2); }
.flow { width: 100%; height: auto; }
.flow text { font-family: var(--body); font-size: 13.5px; fill: var(--ink-2); }
.flow .t1 { font-weight: 600; fill: var(--ink); font-size: 14.5px; }
.flow .bx { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 1.25; transition: stroke .3s, fill .3s; }
.flow .bx.key { stroke: var(--lilac); stroke-width: 1.75; fill: color-mix(in srgb, var(--lilac) 9%, var(--bg-2)); }
.flow .wire { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.flow .lab { font: 500 12px var(--mono); fill: var(--ink-3); }
.hscroll { overflow-x: auto; }
.sim { display: block; }
.sim canvas { width: 100%; height: 230px; border-radius: var(--r-m); background: var(--bg-2); border: 1px solid var(--line); }
.cmp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 18px; border-top: 1px solid var(--line); }
.cmp > div { padding: 16px 16px 2px 0; opacity: .45; transition: opacity .3s; }
.cmp > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.cmp > div.on { opacity: 1; }
.cmp h5 { margin: 0 0 8px; font: 600 14px var(--body); }
.cmp p { margin: 0; font-size: 13.5px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 10px; }
.cmp p b { font: 500 14px var(--mono); color: var(--ink); }
.cells i.on { background: var(--peach); }

/* ---------- foundations with thumbnails ---------- */
.roots { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.root { padding: 0; overflow: hidden; display: flex; flex-direction: column; border-radius: var(--r-l); }
.root .thumb { height: 150px; background: #fff; display: grid; place-items: center; overflow: hidden; padding: 10px; }
.root .thumb img { max-height: 100%; width: auto; object-fit: contain; }
.root .thumb.txt { background: var(--bg-2); font: 400 44px/1 var(--display); color: var(--line-2); letter-spacing: -.03em; border-bottom: 1px solid var(--line); }
.root .in { padding: 16px 18px 18px; }
.root h3 { font: 500 20px/1.2 var(--display); }
.root p { font-size: 14.5px; }

/* ---------- what I want to build in a PhD ---------- */
.phd { margin-top: clamp(70px, 9vw, 120px); }
.phd-lede { max-width: 760px; margin: 24px 0 28px; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.55; color: var(--ink-2); }
.phd-pillars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 44px; }
.phd-pillar { border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); padding: clamp(19px, 2.2vw, 28px); }
.phd-pillar-tag { font: 500 12px/1.3 var(--mono); color: var(--ok); letter-spacing: .04em; }
.phd-pillar h3 { font: 400 clamp(23px, 2.4vw, 32px)/1.12 var(--display); letter-spacing: -.02em; margin: 14px 0 12px; }
.phd-pillar p { font-size: 15.5px; line-height: 1.55; color: var(--ink-2); margin: 0; }
.phd-options { margin-bottom: 0; }
.dir .phd-hypothesis { font: 400 clamp(20px, 2vw, 28px)/1.24 var(--display); color: var(--ink); border-left: 2px solid var(--ok); padding-left: 17px; margin: 0 0 20px; }
@media (max-width: 700px) { .phd-pillars { grid-template-columns: minmax(0, 1fr); } }
.dir { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(22px, 3.4vw, 52px); align-items: center; padding: clamp(36px, 5vw, 64px) 0; border-top: 1px solid var(--line); }
.dir:first-of-type { border-top: 1px solid var(--line-2); margin-top: 48px; }
.dir .n { font: 500 13.5px var(--mono); color: var(--ok); margin: 0 0 12px; }
.dir h3 { font: 400 clamp(26px, 3vw, 40px)/1.08 var(--display); letter-spacing: -.02em; margin: 0 0 16px; text-wrap: balance; }
.dir p { color: var(--ink-2); margin: 0 0 12px; font-size: 16.5px; }
.dir ul { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.dir li { font-size: 15.5px; color: var(--ink-2); padding-left: 20px; position: relative; line-height: 1.5; }
.dir li::before { content: ""; position: absolute; left: 0; top: .62em; width: 9px; height: 1.5px; background: var(--ok); }
.dir li b { color: var(--ink); font-weight: 600; }
.dir .src { font-size: 13px; color: var(--ink-3); margin-top: 14px; }
.dir .src a { color: var(--ink-2); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); padding: clamp(18px, 2.2vw, 26px); }
#hybrid { width: 100%; height: auto; }
#hybrid text { font-family: var(--body); font-size: 14px; fill: var(--ink-2); }
#hybrid .t1 { font-weight: 600; fill: var(--ink); font-size: 16px; }
#hybrid .bx { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 1.25; transition: stroke .3s, fill .3s; }
#hybrid .bx.on { stroke: var(--ok); fill: color-mix(in srgb, var(--ok) 8%, var(--bg-2)); }
#hybrid .wire { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
#hybrid .slot { fill: color-mix(in srgb, var(--mask) 12%, var(--panel)); stroke: var(--mask); stroke-dasharray: 3 3; transition: fill .3s, stroke .3s; }
#hybrid .slot.fill { fill: color-mix(in srgb, var(--ok) 20%, var(--panel)); stroke: var(--ok); stroke-dasharray: 0; }
#hybrid .slot.bad { fill: color-mix(in srgb, var(--stale) 22%, var(--panel)); stroke: var(--stale); stroke-dasharray: 0; }
#hybrid .arT { fill: var(--line-2); transition: fill .25s; }
#hybrid .arT.on { fill: var(--sky); }
.hy-cap { margin: 14px 0 0; font-size: 14.5px; color: var(--ink-2); min-height: 3em; }
.ladder { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; align-items: center; }
.ladder span { font: 500 12.5px var(--mono); padding: 5px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); }
.ladder em { font-style: normal; color: var(--ink-3); font-size: 13px; }
.why > div { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.why > div:first-child { border-top: 0; padding-top: 0; }
.why > div:last-child { padding-bottom: 0; }
.why b { font: 400 26px/1 var(--display); color: var(--line-2); }
.why h4 { margin: 0 0 4px; font: 600 15.5px var(--body); }
.why p { margin: 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.eq { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font: 400 13.5px/1.6 var(--mono); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 18px; }
.eq span:nth-child(odd) { color: var(--ink-3); }

/* ---------- lightbox, tour icon ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(4, 5, 8, .86); display: grid; place-items: center; padding: 4vh 4vw; opacity: 0; pointer-events: none; transition: opacity .25s; cursor: zoom-out; }
.lightbox.on { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 12px; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); transform: scale(.97); transition: transform .3s var(--ease); }
.lightbox.on img { transform: none; }
.tour .where { display: flex; align-items: center; gap: 9px; }
.tour .where svg { width: 20px; height: 20px; flex: none; color: var(--sky); }
.hero-steps svg { width: 24px; height: 24px; color: var(--ink-3); }

@media (max-width: 980px) {
  .pubs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.wide-left, .dir, .stale-grid { grid-template-columns: minmax(0, 1fr); }
  .roots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pub-more div { grid-template-columns: minmax(0, 1fr) 120px; }
  .pub-more div span:nth-child(3) { display: none; }
}
@media (max-width: 700px) {
  .pubs, .roots, .cmp { grid-template-columns: minmax(0, 1fr); }
  .cmp > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .stats div + div { padding-left: 0; border-left: 0; }
  .stats.two div:nth-child(even) { padding-left: 16px; }
  .flow, #hybrid { min-width: 560px; }
  .pub-more div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .tour .where span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1 !important; transform: none !important; }
}
@media print { .progress, .glow, .lightbox { display: none !important; } .js [data-reveal] { opacity: 1 !important; transform: none !important; } }


/* ================= V4: opening, 3D map, flight between stops, 3D loop ================= */
#intro { display: none; }
html.intro-on { overflow: hidden; }
html.intro-on #intro { display: block; position: fixed; inset: 0; z-index: 1000; background: #05060a; opacity: 1; }
#intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .25s; }
#intro.run canvas { opacity: 1; }
#intro.out { opacity: 0 !important; transition: opacity var(--out, .75s) ease; pointer-events: none; }
.intro-cap { position: absolute; left: clamp(20px, 4vw, 56px); bottom: clamp(20px, 5vh, 48px); margin: 0; display: grid; gap: 4px; color: rgba(241,243,247,.92); text-shadow: 0 1px 12px rgba(0,0,0,.6); opacity: 0; }
.intro-cap b { font: 400 30px/1.1 var(--display); letter-spacing: -.02em; }
.intro-cap span { font: 500 13px var(--mono); color: rgba(241,243,247,.62); }
#intro.run .intro-cap { animation: capin 3.9s ease .25s both; }
@keyframes capin { 0% { opacity: 0; transform: translateY(8px); } 14%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.intro-skip { position: absolute; right: clamp(20px, 4vw, 56px); bottom: clamp(20px, 5vh, 48px); font: 500 13px var(--body); color: rgba(241,243,247,.8);
  background: rgba(12,14,19,.45); border: 1px solid rgba(241,243,247,.22); border-radius: 999px; padding: 8px 14px; cursor: pointer; backdrop-filter: blur(6px); }
.intro-skip span { color: rgba(241,243,247,.5); }
.intro-skip:hover { border-color: rgba(241,243,247,.5); }
html.intro-on .hero-grid, html.intro-on .top { opacity: 0; }
html.intro-leaving .hero-grid { animation: arrive 1.1s var(--ease) both; }
html.intro-leaving .top { animation: arrive-top .9s ease .15s both; }
@keyframes arrive { from { opacity: 0; transform: translateY(26px) scale(1.035); filter: blur(6px) brightness(1.8); } to { opacity: 1; transform: none; filter: none; } }
@keyframes arrive-top { from { opacity: 0; } to { opacity: 1; } }
.linkish { font: inherit; color: var(--ink-2); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.linkish:hover { color: var(--ink); }

#map3d { display: block; width: 100%; min-width: 1000px; aspect-ratio: 1120 / 520; }

#transit { position: fixed; inset: 0; z-index: 900; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s .2s;
  background: radial-gradient(120% 90% at 50% 40%, #131722 0%, #0c0e13 62%, #08090d 100%); }
#transit.on { opacity: 1; visibility: visible; transition: opacity .14s ease; }
#transit.cut { transition: none; }
#transit canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.transit-cap { position: absolute; left: clamp(24px, 6vw, 96px); bottom: clamp(28px, 9vh, 96px); display: grid; gap: 6px; }
.transit-cap b { font: 500 13px var(--mono); color: var(--ink-3); }
.transit-cap span { font: 400 clamp(30px, 4.2vw, 54px)/1.05 var(--display); letter-spacing: -.025em; color: var(--ink); }

.loop-3d { display: block; width: 100%; aspect-ratio: 520 / 470; }
@media (max-width: 700px) { .intro-cap b { font-size: 24px; } }
