/*
 * The story (index.html), laid out like a datasheet:
 * hero → 01 problem → 02 mechanism → 03 replay → 04 results → end.
 * Sections are separated by full-width hairlines; the content column is framed by two
 * vertical rules, and "+" marks sit where they cross.
 */

/* ============================================================ the sheet */
.sheet {
  position: relative;
  --edge-l: max(0px, calc(50% - var(--maxw) / 2));
  --edge-r: min(100%, calc(50% + var(--maxw) / 2 - 1px));
  background:
    linear-gradient(var(--line), var(--line)) var(--edge-l) 0 / 1px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) var(--edge-r) 0 / 1px 100% no-repeat;
}

/* ============================================================ nav */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.nav.solid {
  background: var(--nav-bg);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.nav-in {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: var(--maxw);
  height: 60px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.nav-links { display: flex; gap: 22px; }
.nav-links a {
  font: 500 12.5px/1 var(--mono);
  color: var(--muted);
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.on { color: var(--ink); }
.nav-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-cta { --h: 34px; padding: 0 12px; font-size: 13px; }

/* the page is a thread: scroll progress runs along the nav's bottom edge, the live square at its head */
.nav-thread { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none; }
.nav-thread i {
  display: block;
  height: 1px;
  background: var(--ink);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}
.nav-thread b {
  position: absolute;
  top: -2px;
  left: 0;
  width: 5px;
  height: 5px;
  background: var(--signal);
  transform: translateX(calc(var(--p, 0) * (100vw - 5px)));
  opacity: min(1, calc(var(--p, 0) * 60));
}

/* a square that slides to the link of the section you are reading */
.nav-links { position: relative; }
.nav-mark {
  position: absolute;
  left: 0;
  bottom: -9px;
  width: 4px;
  height: 4px;
  background: var(--signal);
  opacity: 0;
  transform: translateX(calc(var(--x, 0px) - 2px));
  transition: transform 0.6s var(--ease), opacity 0.3s;
}
.nav-mark.show { opacity: 1; }

@media (max-width: 860px) {
  .nav-links { display: none; }
}

/* ============================================================ scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }

/* headings rise word by word out of a mask (words are split by motion.js) */
.split.reveal { opacity: 1; transform: none; }
.split .w {
  display: inline-block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
  vertical-align: top;
}
.split .w > span {
  display: inline-block;
  transform: translateY(108%);
  transition: transform 1.1s var(--ease);
  transition-delay: calc(var(--i, 0) * 55ms + var(--d, 0s));
}
.split.in .w > span { transform: none; }

/* ============================================================ type */
.h2 {
  max-width: 20ch;
  margin: 0;
  font-size: clamp(34px, 4.4vw, 60px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.042em;
  text-wrap: balance;
}
.body-l {
  max-width: 56ch;
  margin: 28px 0 0;
  font-size: clamp(16px, 1.3vw, 18px);
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* ============================================================ hero */
/* the headline fills the first screen on its own; Fig. 1 starts exactly at the fold */
.hero { position: relative; display: flex; flex-direction: column; }

/* behind everything: a faint field of agents talking (network.js), kept inside the sheet's column.
   It fades out under the nav and before Fig. 1. */
.hero-net {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  width: min(100%, var(--maxw));
  height: 100vh;
  transform: translateX(-50%);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent 60px, #000 170px, #000 calc(100% - 110px), transparent);
  mask-image: linear-gradient(transparent 60px, #000 170px, #000 calc(100% - 110px), transparent);
}

/* "Agents forget." is drawn by particles.js; its DOM text stays for selection and screen readers */
.hero-px { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.px .h-forget { color: transparent; }
/* copy sits above the particles in flight; Fig. 1 sits below them, so they land on its thread */
.hero > .wrap { position: relative; z-index: 3; display: flex; flex-direction: column; justify-content: center; box-sizing: border-box; min-height: 100vh; min-height: 100svh; padding-top: 60px; }
.h-keep { --d: 0.35s; }


.hero-grid { padding: clamp(28px, 7vh, 112px) 0 clamp(28px, 4vh, 72px); }
.hero-h {
  margin: 0;
  font-size: clamp(50px, min(9.4vw, 14vh), 136px);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.058em;
}
.hero-side {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  margin-top: clamp(28px, 5vh, 64px);
}
.lede {
  max-width: 42ch;
  margin: 0;
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }

.fig.hero-fig { margin-top: 0; }
.hero-fig canvas { display: block; width: 100%; height: clamp(132px, 20vh, 240px); }
/* the message count runs away; the context beside it barely moves */
.hero-fig figcaption { flex-wrap: wrap; }
.hero-fig .fig-t { flex: 1 1 0; min-width: 0; }
.hero-read { display: flex; gap: 16px; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) { .hero-read { flex-basis: 100%; padding-left: calc(6ch + 14px); } }
.hero-read b { font-weight: 500; color: var(--ink); }
.hero-read [data-msgs] { display: inline-block; min-width: 3ch; text-align: right; }

/* ============================================================ figures */
.fig { margin: clamp(48px, 7vw, 80px) 0 0; }
.fig-frame {
  position: relative;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  /* a quiet dot grid, the only texture on the page */
  background-color: var(--bg);
  background-image: radial-gradient(var(--line-2) 0.8px, transparent 0.8px);
  background-size: 16px 16px;
  background-position: center;
}
.fig figcaption {
  display: flex;
  gap: 14px;
  padding-top: 14px;
  padding-bottom: 14px;
  font: 12px/1.5 var(--mono);
  color: var(--muted);
}
.fig-n { flex: none; color: var(--ink); }
/* a figure that closes its section sits on the next rule, like Fig. 1 */
.sec:has(> .fig:last-child) { padding-bottom: 0; }

/* ============================================================ sections */
.sec {
  position: relative;
  padding: clamp(80px, 11vw, 140px) 0;
  border-top: 1px solid var(--line);
}
/* "+" registration marks where the section rule meets the frame */
.sec::before,
.sec::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  background:
    linear-gradient(var(--muted), var(--muted)) center / 9px 1px no-repeat,
    linear-gradient(var(--muted), var(--muted)) center / 1px 9px no-repeat;
}
.sec::before { left: max(4px, calc(50% - var(--maxw) / 2)); }
.sec::after { left: min(calc(100% - 5px), calc(50% + var(--maxw) / 2)); }

.sec-grid {
  display: grid;
  grid-template-columns: minmax(150px, 3fr) minmax(0, 9fr);
  gap: 24px 40px;
}
.sec-k {
  display: flex;
  gap: 12px;
  padding-top: 0.9em;
  font: 500 12px/1 var(--mono);
  color: var(--ink-2);
}
.sec-k .n { color: var(--signal); }

@media (max-width: 860px) {
  .sec-grid { grid-template-columns: 1fr; }
  .sec-k { padding-top: 0; }
}

/* ============================================================ 01 · problem */
.ledger {
  position: relative;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}
/* the ink rule draws across, then the three facts land one by one */
.ledger::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease) 0.1s;
}
.ledger.in::before { transform: none; }
.ledger li { opacity: 0; transform: translateY(10px); transition: opacity 0.7s var(--ease), transform 0.8s var(--ease); }
.ledger.in li { opacity: 1; transform: none; }
.ledger li:nth-child(1) { transition-delay: 0.25s; }
.ledger li:nth-child(2) { transition-delay: 0.37s; }
.ledger li:nth-child(3) { transition-delay: 0.49s; }
.ledger li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.ledger .n { font: 500 12px var(--mono); color: var(--muted); }
.ledger .t { font-size: clamp(18px, 1.7vw, 22px); letter-spacing: -0.02em; }
.ledger code { font-size: 12px; color: var(--muted); }

/* the three costs of a long thread: each meter lands at its "before", then slides to its "after" */
.woes li { grid-template-columns: 28px minmax(0, 1fr) clamp(90px, 16vw, 200px) 19ch; align-items: center; }
.woes code { text-align: right; font-variant-numeric: tabular-nums; }
.meter { position: relative; height: 6px; overflow: hidden; background: var(--line); }
.meter i {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleX(var(--a));
  transform-origin: left;
  transition: transform 1.4s var(--ease), background-color 0.6s var(--ease);
}
.woes.in .meter i { transform: scaleX(var(--b)); background-color: var(--signal); }
.woes li:nth-child(1) .meter i { transition-delay: 0.9s; }
.woes li:nth-child(2) .meter i { transition-delay: 1.05s; }
.woes li:nth-child(3) .meter i { transition-delay: 1.2s; }
.woes + .source { margin-top: 16px; }

@media (max-width: 620px) {
  .ledger li { grid-template-columns: 22px 1fr; }
  .ledger code { grid-column: 2; }
  .woes li { grid-template-columns: 22px minmax(0, 1fr) 132px; row-gap: 10px; }
  .woes .t { grid-column: 2 / -1; }
  .woes .meter { grid-column: 2; }
  .woes code { grid-column: 3; }
}

/* ============================================================ 02 · mechanism (email → state diff) */
.diff {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1.15fr);
  align-items: center;
  padding-top: clamp(32px, 5vw, 56px);
  padding-bottom: clamp(32px, 5vw, 56px);
}
.diff-in,
.diff-out {
  padding: 20px 22px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.diff-h {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.diff-h span:last-child { letter-spacing: 0; text-transform: none; }
.mail { margin: 0; font: 14px/1.65 var(--mono); color: var(--ink); }
.mail-stack { display: grid; }
.mail-stack > * { grid-area: 1 / 1; }
.mail-ghost { visibility: hidden; }
.mail mark {
  padding: 0 1px;
  color: inherit;
  background:
    linear-gradient(var(--signal), var(--signal)) no-repeat 0 100% / 0% 1px,
    linear-gradient(var(--signal-bg), var(--signal-bg)) no-repeat 0 0 / 0% 100%;
  transition: background-size 0.7s var(--ease);
}
.mail mark.lit { background-size: 100% 1px, 100% 100%; }
.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--ink);
  animation: blink 0.9s steps(2) infinite;
}

/* connectors from phrase to state line, measured and drawn by mechanism.js */
.diff { position: relative; }
.diff .links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.links .link { fill: none; stroke: var(--signal); stroke-width: 1.25; }
.links .end { fill: var(--surface); stroke: var(--signal); stroke-width: 1.25; opacity: 0; transition: opacity 0.3s; }
.links .end.on { opacity: 1; }
.links .packet { fill: var(--signal); }

.dl {
  display: grid;
  grid-template-columns: 14px 70px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  font-size: 14.5px;
  line-height: 1.4;
}
.dl b { font: 500 13px var(--mono); color: var(--muted); }
.dl code { font-size: 12px; color: var(--muted); }
.dl { transition: opacity 0.5s var(--ease), transform 0.6s var(--ease); }
.dl.del span {
  justify-self: start;
  color: var(--muted);
  background: linear-gradient(var(--signal), var(--signal)) no-repeat 0 58% / 100% 1.5px;
  transition: background-size 0.7s var(--ease), color 0.6s;
}
/* while the sequence plays: lines not yet reached are hidden, the old date is not yet struck */
.diff.armed .dl:not(.done):not(.base) { opacity: 0; transform: translateX(-8px); }
.diff.armed .dl.del:not(.done) span { color: var(--ink); background-size: 0% 1.5px; }
.diff.armed .dl.del:not(.done) b { opacity: 0; }
.dl.warn.done b { animation: blink 0.5s steps(2) 3; }
.dl.flip em { display: inline-block; animation: roll 0.7s var(--ease); }
@keyframes roll {
  from { opacity: 0; transform: translateY(70%); }
  to   { opacity: 1; transform: none; }
}

.replay {
  flex: none;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  font: 12px/1.5 var(--mono);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
}
.replay::before { content: "↻ "; }
.replay:hover { color: var(--ink); }
.dl.add b { color: var(--ok); }
.dl.warn,
.dl.warn b,
.dl.warn code { color: var(--signal-ink); }
.dl em { font-style: normal; font-weight: 600; color: var(--signal); }

.diff-arrow { position: relative; height: 1px; margin: 0 12px; background: var(--line-2); }
.diff-arrow i {
  position: absolute;
  top: -3px;
  width: 7px;
  height: 7px;
  background: var(--ink);
  animation: travel 2.4s var(--ease-in-out) infinite;
}
@keyframes travel {
  from { left: 0; opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  to   { left: calc(100% - 7px); opacity: 0; }
}
@media (min-width: 761px) {
  .diff-arrow { visibility: hidden; }
}
@media (max-width: 760px) {
  .diff { grid-template-columns: 1fr; gap: 0; }
  .diff-arrow { width: 1px; height: 32px; margin: 0 auto; }
  .diff-arrow i { display: none; }
  .dl { grid-template-columns: 14px 60px minmax(0, 1fr); font-size: 13.5px; }
}

/* ============================================================ 03 · replay (relay.js)
   A pinned scene: the latest email → the state, as a departures board → the agent on shift.
   The section is tall; the scene sticks while it scrolls, one beat per screen. */
.story-sec { padding-bottom: 0; }
.relay {
  position: relative;
  height: calc(var(--beats, 8) * 75vh + 100vh);
  margin-top: clamp(16px, 3vw, 40px);
}
.rl-pin {
  position: sticky;
  top: 60px;
  display: flex;
  align-items: center;
  height: calc(100vh - 60px);
  height: calc(100svh - 60px);
}
.rl-in { display: grid; gap: clamp(18px, 3.4vh, 40px); }

/* top: the deal, a thread of beats with the agents' shifts above it, the counter */
.rl-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  font: 500 11px/1 var(--mono);
  color: var(--muted);
}
.rl-po { padding-bottom: 3px; }
.rl-count { padding-bottom: 3px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rl-track { position: relative; height: 36px; }
.rl-line,
.rl-track::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 6px;
  height: 1px;
}
.rl-line { right: 0; background: var(--line-2); }
.rl-track::after { width: var(--head, 0); background: var(--ink); transition: width 0.7s var(--ease); }
.rl-node {
  position: absolute;
  bottom: 2px;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  padding: 0;
  border: 1px solid var(--faint);
  border-radius: 0;
  background: var(--bg);
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.rl-node::before { content: ""; position: absolute; inset: -9px; }
.rl-node:hover { border-color: var(--ink); }
.rl-node.past { background: var(--ink); border-color: var(--ink); }
.rl-node.now { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-bg); }
.rl-shift {
  position: absolute;
  top: 0;
  height: 22px;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.4s, color 0.4s;
}
.rl-shift::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease);
}
.rl-shift em { position: absolute; left: 8px; top: 0; font: 500 10.5px/1 var(--mono); font-style: normal; white-space: nowrap; }
.rl-shift.on { opacity: 1; }
.rl-shift.on::before { transform: none; }
.rl-shift.dead { color: var(--signal); }

/* the caption beside the scene, in large type: the story is told here, the scene shows it */
.rl-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
}
.rl-cap { display: grid; align-content: center; gap: 16px; }
.rl-cap-n { font: 500 12px var(--mono); color: var(--signal); font-variant-numeric: tabular-nums; }
.rl-cap h3 { margin: 0; font-size: clamp(30px, 3.4vw, 50px); font-weight: 500; line-height: 1.02; letter-spacing: -0.042em; text-wrap: balance; }
.rl-cap.kill h3 { color: var(--signal-ink); }
.rl-cap.roll h3 { animation: cap-in 0.6s var(--ease) both; }
@keyframes cap-in { from { opacity: 0; transform: translateY(10px); } }

/* the scene: the latest email → the board → the agent, top to bottom */
.rl-scene { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 580px; justify-self: end; }
.rl-lab {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.rl-lab b { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* store: the log, one tile per event, in order; the newest email in one line beneath */
.rl-scene { position: relative; }
.rl-log {
  padding: 10px 12px 11px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: opacity 0.4s;
}
.rl-log.skip { opacity: 0.3; }
.rl-tiles { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.rl-tile {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--bg);
  font: 500 10px/1 var(--mono);
  font-style: normal;
  color: var(--muted);
}
.rl-tile.out { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.rl-tile.now { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--signal); }
.rl-tile.add { animation: tile-in 0.5s var(--ease); }
@keyframes tile-in { from { opacity: 0; transform: translateY(-10px) scale(0.6); } }
.rl-latest {
  margin: 9px 0 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink-2);
  transition: opacity 0.4s;
}
.rl-latest b { margin-right: 8px; font-weight: 600; color: var(--ink); }
.rl-latest.stale { opacity: 0.5; }
.rl-latest.caret span::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; background: var(--signal); }
.rl-lab.sort { margin-top: 20px; }
.rl-packet { position: absolute; top: 0; left: 0; z-index: 3; width: 7px; height: 7px; background: var(--signal); pointer-events: none; }

/* a wire between pieces; a square runs along it when something flows */
.rl-wire { position: relative; height: 22px; }
.rl-wire::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed var(--line-2); }
.rl-wire i { position: absolute; top: 0; left: calc(50% - 3px); width: 7px; height: 7px; background: var(--signal); opacity: 0; }

/* the board: the state as a departures board, the one dark object in the scene */
.rl-board {
  --tile: color-mix(in srgb, var(--on-ink) 9%, transparent);
  --dim: color-mix(in srgb, var(--on-ink) 55%, transparent);
  position: relative;
  padding: 12px 14px 14px;
  overflow: hidden;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow);
}
.rl-bh {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--on-ink) 14%, transparent);
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rl-bh b { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--dim); font-variant-numeric: tabular-nums; }
.rl-mark { display: inline-block; width: 6px; height: 6px; margin-right: 8px; vertical-align: 1px; background: var(--signal); }
.rl-brow {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 -6px;
  padding: 4px 6px;
  border-radius: 6px;
}
.rl-bl { font: 500 10px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.rl-flaps { display: grid; grid-template-columns: repeat(23, minmax(0, 1fr)); gap: 2px; font: 500 clamp(12px, 1.25vw, 17px)/1 var(--mono); }
.fl,
.rl-bs {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  height: 1.8em;
  border-radius: 2px;
  background: var(--tile);
  font-style: normal;
}
.rl-bs { width: 1.8em; font: 600 12px/1 var(--mono); }
.fl b,
.rl-bs b { display: block; font-weight: inherit; }
/* the hinge across every flap */
.fl::after,
.rl-bs::after { content: ""; position: absolute; top: 50%; right: 0; left: 0; height: 1px; background: var(--ink); opacity: 0.55; }
.rl-brow.fail .fl b,
.rl-brow.us .fl b { color: var(--signal); }
.rl-brow.fail .rl-bs,
.rl-brow.us .rl-bs { background: var(--signal); color: var(--on-ink); }
.rl-brow.unknown .fl b,
.rl-brow.unknown .rl-bs { color: var(--dim); }
.rl-brow[data-k="next"] { margin-top: 6px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--on-ink) 14%, transparent); border-radius: 0 0 6px 6px; }
.rl-brow.chg { animation: row-lit 1.6s var(--ease); }
@keyframes row-lit { from { background: color-mix(in srgb, var(--signal) 26%, transparent); } }
.rl-scan {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 48px;
  border-bottom: 2px solid var(--signal);
  background: linear-gradient(transparent, color-mix(in srgb, var(--signal) 24%, transparent));
  opacity: 0;
  pointer-events: none;
}

/* the agent: one strip that comes and goes */
.rl-agentst { position: relative; }
.rl-agent {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.4s, background 0.4s;
}
.rl-agent.enter { animation: ag-in 0.5s var(--ease); }
@keyframes ag-in { from { opacity: 0; transform: translateY(8px); } }
.rl-ag-name { font: 600 17px/1 var(--sans); letter-spacing: -0.02em; }
.rl-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: breathe 2.4s var(--ease-in-out) infinite; }
.rl-x { font: 600 15px/1 var(--mono); color: var(--signal); }
.rl-chip {
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--bg-2);
  font: 500 11px/1.2 var(--mono);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s;
}
.rl-chip b { font-weight: 500; }
.rl-chip.new { background: var(--ok-bg); color: var(--ok); text-transform: uppercase; }
.rl-chip.tok { margin-left: auto; background: var(--signal-bg); color: var(--signal-ink); }
.rl-chip.tok.wait { opacity: 0.35; }
.rl-none { font: 500 12px var(--mono); color: var(--muted); }
.rl-agentst[data-state="none"] .rl-agent { border-style: dashed; background: transparent; box-shadow: none; }
.rl-agentst[data-state="killed"] .rl-agent { border-color: var(--signal); }
.rl-agentst[data-state="killed"] .rl-ag-name { color: var(--signal-ink); text-decoration: line-through; text-decoration-color: var(--signal); }
.rl-agentst.dying .rl-agent { border-color: var(--signal); opacity: 0.5; animation: glitch 0.38s steps(4); }
@keyframes glitch {
  25% { transform: translate(-3px, 1px); }
  50% { transform: translate(3px, -1px); }
  75% { transform: translate(-2px, 0); }
}
.rl-burst { position: absolute; inset: -60px -24px; width: calc(100% + 48px); height: calc(100% + 120px); pointer-events: none; }

@media (max-width: 960px) {
  .relay { height: calc(var(--beats, 8) * 85vh + 100vh); }
  .rl-pin { align-items: flex-start; padding-top: 14px; }
  .rl-in { gap: 16px; }
  .rl-top { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
  .rl-po { display: none; }
  .rl-body { grid-template-columns: 1fr; gap: 16px; }
  .rl-cap { gap: 6px; }
  .rl-cap-n { display: none; }
  .rl-cap h3 { font-size: 23px; }
  .rl-scene { max-width: none; justify-self: stretch; }
  .rl-latest { font-size: 12.5px; }
  .rl-lab.sort { margin-top: 14px; }
  .rl-wire { height: 14px; }
  .rl-lab { margin-bottom: 6px; }
}
@media (max-width: 520px) {
  .rl-board { padding: 10px 10px 12px; }
  .rl-brow { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 6px; }
  .rl-bl { grid-column: 1 / -1; }
  .rl-flaps { gap: 1px; font-size: 12.5px; }
  .rl-agent { min-height: 44px; padding: 8px 10px; }
  .rl-ag-name { font-size: 15px; }
}

/* ============================================================ 04 · results
   The win first: three big numbers, then one panel per named benchmark. In each panel Primitive
   alone rises first, then Continuity rises past it in the signal colour and the margin lands. */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 40px;
  border-top: 1px solid var(--ink);
}
.stat { padding: 18px 20px 4px 0; }
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--line); }
.stat b {
  display: block;
  font: 500 clamp(36px, 4.6vw, 68px)/0.95 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
}
.stat.win b { color: var(--signal); }
.stat span {
  display: block;
  margin-top: 12px;
  font: 500 11px/1.3 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.lb-key { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 48px; font: 500 11.5px/1 var(--mono); color: var(--muted); }
.lb-key span { display: inline-flex; align-items: center; gap: 8px; }
.lb-key i { width: 10px; height: 10px; background: var(--line-2); }
.lb-key .me { color: var(--ink); }
.lb-key .me i { background: var(--signal); }
.lb-key .lb-unit { margin-left: auto; color: var(--faint); }
.lb {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--line);
}
.bench {
  position: relative;
  margin: 0;
  padding: 16px 14px 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.bench figcaption b { display: block; font: 600 15px/1.2 var(--sans); letter-spacing: -0.02em; }
.bench figcaption span {
  display: block;
  margin-top: 5px;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
/* the margin of the win, the loudest thing in the panel */
.bench em {
  display: block;
  margin-top: 14px;
  font: 600 clamp(26px, 2.6vw, 36px)/1 var(--sans);
  font-style: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  color: var(--signal);
  transform-origin: left bottom;
  transition: opacity 0.4s var(--ease) calc(var(--d, 0s) + 1.15s), transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--d, 0s) + 1.15s);
}
.bench:not(.in) em { opacity: 0; transform: scale(0.6); }
.bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 34px));
  justify-content: center;
  gap: 8px;
  height: 140px;
  margin-top: 10px;
}
.col { display: flex; flex-direction: column; justify-content: flex-end; }
.col b {
  padding-bottom: 6px;
  font: 500 12.5px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
  color: var(--muted);
}
.col.me b { font-weight: 600; color: var(--signal-ink); }
.col i {
  display: block;
  height: calc(var(--h) * 112px);
  border-radius: 2px 2px 0 0;
  background: var(--line-2);
  transform-origin: bottom;
  transition: transform 0.8s var(--ease) calc(var(--d, 0s) + 0.15s);
}
.col.me i { background: var(--signal); transition: transform 1.1s var(--ease) calc(var(--d, 0s) + 0.45s); }
.bench:not(.in) .col i { transform: scaleY(0); }

.source { margin: 20px 0 0; font: 12px/1.5 var(--mono); color: var(--muted); }

/* a benchmark's spec: what it is, how it ran, three numbers */
#proof .sec-body { position: relative; }
.bench { cursor: default; outline: none; transition: background 0.25s; }
.bench.picked { background: var(--surface); }
.bench:focus-visible { box-shadow: inset 0 0 0 2px var(--signal); }
.lb-spec { margin-top: 20px; }
.lb-spec.beside { position: absolute; top: 0; right: calc(100% + 40px); margin: 0; }
.spec { display: none; padding-top: 14px; border-top: 1px solid var(--ink); }
.spec.on { display: block; animation: spec-in 0.35s var(--ease); }
@keyframes spec-in { from { opacity: 0; transform: translateY(6px); } }
.spec-hint { margin: 0; border-top-color: var(--line); font: 500 11.5px/1 var(--mono); color: var(--faint); }
.spec-n { display: block; font: 600 17px/1.2 var(--sans); letter-spacing: -0.02em; }
.spec p { margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.spec .spec-m { font: 11px/1.55 var(--mono); color: var(--muted); }
.spec table { width: 100%; margin-top: 12px; border-collapse: collapse; font: 500 12px/1 var(--mono); font-variant-numeric: tabular-nums; }
.spec th,
.spec td { padding: 7px 0 7px 10px; border-top: 1px solid var(--line); text-align: right; }
.spec th:first-child,
.spec td:first-child { padding-left: 0; text-align: left; color: var(--muted); }
.spec td:nth-child(2) { font-weight: 600; color: var(--signal-ink); }
.spec th i { display: inline-block; width: 9px; height: 9px; background: var(--line-2); }
.spec th i.me { background: var(--signal); }
@media (hover: hover) { .h-touch { display: none; } }
@media (hover: none) { .h-mouse { display: none; } }

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .lb { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .stat { padding-right: 10px; }
  .stat + .stat { padding-left: 10px; }
  .stat:nth-child(3) { padding-left: 0; }
  .stat b { font-size: 40px; }
  .stat span { font-size: 10px; }
  .lb-key .lb-unit { margin-left: 0; }
}

/* ============================================================ end */
.end { position: relative; overflow: hidden; padding-top: clamp(72px, 10vw, 128px); border-top: 1px solid var(--line); }
.end-in { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px; }
.end-line {
  margin: 0;
  font-size: clamp(44px, 6.4vw, 96px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

/* the one dithered moment: the wordmark, quiet, lit by the pointer */
.wordmark {
  display: block;
  width: 100%;
  height: clamp(110px, 22vw, 320px);
  margin-top: clamp(64px, 10vw, 120px);
  image-rendering: pixelated;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 24px;
  border-top: 1px solid var(--line);
  font: 11.5px var(--mono);
  color: var(--muted);
}
