/* ibm-1 site ------------------------------------------------------------
   the opener is one committed visual world: ink-blue black, the substrate's own
   atlas colours, and one amber chrome.  a materialization drains the atlas
   colour away and puts the traced route's own ramp in its place -- red at the
   input, purple at the output -- which is also what the input and output
   annotations are coloured, so a label and the end of the path it points at
   agree.  the paper below is themed: bone paper by day, the same ink by night. */

:root {
  /* the opener, single-theme */
  --ink: #07090f;
  --ink-2: #0d1019;
  --on-ink: #e9e7e0;
  --on-ink-muted: #8d93a1;
  --on-ink-faint: rgba(233, 231, 224, 0.28);
  /* the traced route's two ends.  brain.js owns this pair (TRACE) and writes it
     back onto :root at load; these are the same values, for before it runs. */
  --trace-in: #f5424d;    /* observed — where a signal enters the trace */
  --trace-out: #a159fa;   /* target — where it leaves */
  --accent-ink: #f0b34a;  /* the opener's chrome: ring, titles, focus */
  --clamp: #c9a4ff;       /* clamped / intervention */

  /* the paper, light */
  --paper: #f1f1ec;
  --paper-2: #e8e8e1;
  --text: #14161c;
  --muted: #5f6470;
  --rule: #d3d3cb;
  --accent: #a8690f;
  --accent-soft: rgba(240, 179, 74, 0.18);
  --fail: #b23a2f;
  --moved: #2f7a58;
  --half: #8a6d1d;
  --fig-in: #bd2f3b;      /* the trace ramp's two ends, weighted for bone paper */
  --fig-out: #6d34c0;
  --fig-note: #14161c;
  --fig-muted: #5f6470;
  --fig-panel: rgba(241, 241, 236, 0.72);

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --display: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1117; --paper-2: #161a23; --text: #e6e4dd; --muted: #9198a6; --rule: #2a2e38;
    --accent: #f0b34a; --accent-soft: rgba(240, 179, 74, 0.14); --fail: #e5766a; --moved: #6fc39a; --half: #d9b25a;
    --fig-in: var(--trace-in); --fig-out: var(--trace-out); --fig-note: #e6e4dd; --fig-muted: #9198a6; --fig-panel: rgba(15, 17, 23, 0.6);
  }
}
:root[data-theme="dark"] {
  --paper: #0f1117; --paper-2: #161a23; --text: #e6e4dd; --muted: #9198a6; --rule: #2a2e38;
  --accent: #f0b34a; --accent-soft: rgba(240, 179, 74, 0.14); --fail: #e5766a; --moved: #6fc39a; --half: #d9b25a;
  --fig-in: var(--trace-in); --fig-out: var(--trace-out); --fig-note: #e6e4dd; --fig-muted: #9198a6; --fig-panel: rgba(15, 17, 23, 0.6);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--text); position: relative;
  font-family: var(--serif); font-size: 18px; line-height: 1.55;
  font-optical-sizing: auto; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.16em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.82em; background: var(--paper-2); padding: 0.05em 0.35em; border-radius: 3px; }
.mono { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

.bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero, .paper { position: relative; z-index: 1; }

/* ===================================================================== hero */
.hero {
  position: relative; height: 100svh; min-height: 640px; overflow: hidden;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(18, 22, 39, 0.55) 0%, rgba(7, 9, 15, 0.7) 65%);
  color: var(--on-ink); user-select: none;
}
.hero.dragging { cursor: grabbing; }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero.near #hero-canvas { cursor: grab; }
.hero.dragging #hero-canvas { cursor: grabbing; }
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.leader { fill: none; stroke: var(--on-ink-faint); stroke-width: 1; color: var(--on-ink-faint); transition: stroke 0.25s, color 0.25s, opacity 0.4s; }
.ring-leader { marker-end: url(#arrow); }
.hero.narrow .ring-leader { marker-end: none; }
.ring-join { fill: var(--on-ink); opacity: 0.8; }
.hero.is-hovering .ring-leader { stroke: rgba(233, 231, 224, 0.1); color: rgba(233, 231, 224, 0.1); }
.ann-svg .leader { stroke-width: 1.2; }
.ann-svg .loop { stroke-dasharray: 3 3; stroke-width: 1; opacity: 0.9; }
.ann-svg .branches { stroke-width: 0.9; opacity: 0.85; }
.ann-svg .leader-dot { fill: currentColor; }
.ann-svg.ann-in { color: var(--trace-in); } .ann-svg.ann-in .leader { stroke: var(--trace-in); }
.ann-svg.ann-out { color: var(--trace-out); } .ann-svg.ann-out .leader { stroke: var(--trace-out); }
.ann-svg.ann-note { color: var(--on-ink); } .ann-svg.ann-note .leader { stroke: var(--on-ink); opacity: 0.8; }
.ann-svg.hover-ann { color: var(--accent-ink); } .ann-svg.hover-ann .leader { stroke: var(--accent-ink); }
.ann-svg { animation: ann-in 0.6s 0.9s both; }
.ann-svg.hover-ann { animation: none; }

.wordmark {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  margin: 0; font-family: var(--display); font-weight: 300; font-variation-settings: "opsz" 60;
  font-size: clamp(84px, 17vw, 260px); line-height: 0.9; letter-spacing: -0.03em;
  color: var(--on-ink); mix-blend-mode: screen; opacity: 0.92; pointer-events: none; white-space: nowrap;
  transition: opacity 0.6s, transform 0.8s cubic-bezier(.2,.7,.2,1);
}
.wordmark .wm-dash { font-weight: 300; margin: 0 -0.04em; opacity: 0.55; }
.hero.has-selection .wordmark { opacity: 0.1; transform: translate(-50%, -50%) scale(0.94); transition-duration: 1.2s; }

.hero-down {
  position: absolute; bottom: 18px; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em;
  color: var(--on-ink-muted); text-transform: uppercase; transition: opacity 0.8s;
  right: 22px; bottom: 14px; text-decoration: none; font-size: 1rem;
}
.hero-down:hover { color: var(--accent-ink); }

/* the ring of materializations ------------------------------------------- */
.ring { position: absolute; inset: 0; pointer-events: none; transition: opacity 0.35s; }
.hero.has-selection .ring { opacity: 0; pointer-events: none; }
.ring-item {
  position: absolute; pointer-events: auto; appearance: none; background: none; border: 0; padding: 4px 6px; margin: 0;
  color: var(--on-ink); font: 500 0.72rem/1.1 var(--mono); letter-spacing: 0.06em; cursor: pointer;
  white-space: nowrap; transform: translate(-50%, -50%); opacity: 0.86;
  transition: color 0.2s, opacity 0.2s, transform 0.3s;
}
.ring-item[data-side="l"] { transform: translate(-100%, -50%); text-align: right; }
.ring-item[data-side="r"] { transform: translate(0, -50%); text-align: left; }
.ring-item:hover, .ring-item.is-hover, .ring-item:focus-visible { color: var(--accent-ink); opacity: 1; }
.hero.is-hovering .ring-item:not(.is-hover) { opacity: 0.35; }
.ring-item .ring-label { position: relative; }
.ring-item .ring-label::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; opacity: 0; transition: opacity 0.2s;
}
.ring-item:hover .ring-label::after, .ring-item.is-hover .ring-label::after { opacity: 0.7; }
.ring-group {
  display: block; font-size: 0.58rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-ink); opacity: 0.85; margin-bottom: 4px;
}
.ring-item[data-side="l"] .ring-group { text-align: right; }

/* selected mode ------------------------------------------------------------ */
.selected { position: absolute; inset: 0; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.4s 0.1s, visibility 0s 0.5s; }
.hero.has-selection .selected { opacity: 1; visibility: visible; transition: opacity 0.7s 0.5s, visibility 0s; }
.sel-close {
  position: absolute; top: 18px; right: 18px; pointer-events: auto; appearance: none; cursor: pointer;
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--on-ink-faint); background: rgba(7, 9, 15, 0.5);
  color: var(--on-ink); font: 300 28px/1 var(--display); display: grid; place-items: center; backdrop-filter: blur(6px);
  transition: border-color 0.2s, color 0.2s, transform 0.3s;
}
.sel-close:hover { border-color: var(--accent-ink); color: var(--accent-ink); transform: rotate(90deg); }
.sel-close-hint { position: absolute; top: 100%; margin-top: 6px; font: 400 0.58rem/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--on-ink-muted); }
.sel-head { position: absolute; top: 22px; left: 26px; max-width: min(46ch, 44vw); pointer-events: auto; }
.sel-title { margin: 0 0 10px; font-family: var(--display); font-weight: 600; font-style: normal; font-variation-settings: "opsz" 60; font-size: clamp(38px, 4.6vw, 66px); line-height: 1; letter-spacing: -0.02em; text-wrap: balance; color: var(--accent-ink); }
.sel-doc { margin: 0; font-size: 0.98rem; line-height: 1.45; color: var(--on-ink); opacity: 0.85; max-width: 44ch; }

.ann-col { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px; pointer-events: auto; max-height: 82%; }
.ann-col-in { left: 26px; align-items: flex-start; }
.ann-col-out { right: 26px; align-items: flex-end; }
.ann-col-title { font: 500 0.6rem/1 var(--mono); letter-spacing: 0.24em; text-transform: uppercase; color: var(--on-ink-muted); margin-bottom: 4px; }
.ann-col-in .ann-col-title { color: var(--trace-in); }
.ann-col-out .ann-col-title { color: var(--trace-out); }
/* the label carries the hue too, so the whole annotation — title, label, leader,
   and the node the leader lands on — is one colour */
.ann-in .ann-label { color: var(--trace-in); }
.ann-out .ann-label { color: var(--trace-out); }
.ann-col > div { display: flex; flex-direction: column; gap: 12px; }
.ann-col-out > div { align-items: flex-end; }
.ann { display: grid; gap: 2px; padding: 4px 10px; max-width: 24ch;
  animation: ann-in 0.6s 0.9s cubic-bezier(.2,.7,.2,1) both; }
.ann-out { text-align: right; }
.ann-label { font-family: var(--display); font-weight: 600; font-variation-settings: "opsz" 24; font-size: 1.05rem; line-height: 1.15; letter-spacing: -0.005em; }
.ann-id { font: 400 0.62rem/1.2 var(--mono); color: var(--on-ink-muted); letter-spacing: 0.02em; }
.ann:nth-child(2) { animation-delay: 1s; } .ann:nth-child(3) { animation-delay: 1.1s; } .ann:nth-child(4) { animation-delay: 1.2s; }
.ann:nth-child(5) { animation-delay: 1.3s; } .ann:nth-child(6) { animation-delay: 1.4s; } .ann:nth-child(7) { animation-delay: 1.5s; }
@keyframes ann-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ann, .ann-svg { animation: none; } .sel-close:hover { transform: none; } }

/* narrow layout: the same hero, but forty labels cannot ring a portrait
   figure.  brain.js packs them into a band above and a band below the brain
   instead, two columns about a centre gutter in each band, and a selection
   puts the inputs under the title and the outputs along the bottom the same
   way, leaders and all. */
.hero.narrow .wordmark { font-size: clamp(64px, 20vw, 120px); }
.hero.narrow .ring-item { padding: 1px 4px; font-size: 0.64rem; transition: color 0.2s, opacity 0.2s, transform 0.3s, top 0.5s; }
.hero.narrow .ring-group { font-size: 0.52rem; margin: 3px 0 1px; }
.hero.narrow .hero-down { display: none; }
.hero.narrow .sel-close { top: 10px; right: 10px; width: 40px; height: 40px; font-size: 22px; }
.hero.narrow .sel-close-hint { display: none; }
.hero.narrow .sel-head { top: 12px; left: 14px; right: 60px; max-width: none; }
.hero.narrow .sel-title { font-size: clamp(26px, 7vw, 40px); margin-bottom: 6px; }
.hero.narrow .sel-doc { font-size: 0.8rem; line-height: 1.35; max-width: none; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.hero.narrow .ann-col { transform: none; top: auto; left: 12px; right: 12px; max-height: none; gap: 4px; align-items: center; }
.hero.narrow .ann-col-in { top: calc(12px + clamp(26px, 7vw, 40px) + 6px + 3.4rem + 14px); }
.hero.narrow .ann-col-out { bottom: 12px; }
.hero.narrow .ann-col > div { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 56px; align-items: start; align-self: stretch; }
.hero.narrow .ann { padding: 2px 4px; max-width: 20ch; }
.hero.narrow .ann:nth-child(odd) { justify-self: end; text-align: right; }
.hero.narrow .ann:nth-child(even) { justify-self: start; text-align: left; }
.hero.narrow .ann-label { font-size: 0.86rem; }

/* ==================================================================== paper */
.paper { max-width: none; margin: 0; padding: 0 clamp(18px, 4vw, 48px) 80px; background: color-mix(in srgb, var(--paper) 84%, transparent); }
.paper > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.masthead { padding: 64px 0 40px; border-bottom: 1px solid var(--rule); }
.eyebrow { margin: 0 0 28px; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.standfirst { margin: 0; max-width: 68ch; font-family: var(--display); font-weight: 400; font-variation-settings: "opsz" 32; font-size: clamp(20px, 2.3vw, 27px); line-height: 1.45; letter-spacing: -0.008em; text-wrap: pretty; }
.standfirst em { font-style: normal; font-weight: 600; color: var(--accent); }

.sec { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; padding: 56px 0; border-bottom: 1px solid var(--rule); }
.margin { display: grid; align-content: start; gap: 8px; position: sticky; top: 28px; align-self: start; z-index: 2; }
.margin .mono { color: var(--accent); }
.margin span:last-child { font-family: var(--display); font-style: normal; font-weight: 600; font-variation-settings: "opsz" 20; font-size: 1.25rem; line-height: 1.2; color: var(--text); }
.body { max-width: 68ch; }
.body p { margin: 0 0 1.2em; }
.body h3 { margin: 2em 0 0.5em; font-family: var(--display); font-weight: 500; font-variation-settings: "opsz" 24; font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
.note { font-size: 0.94rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 14px; }
.caption { font-size: 0.86rem; color: var(--muted); font-style: italic; }
.display-math { font-family: var(--display); font-weight: 400; font-variation-settings: "opsz" 24; font-size: 1.6rem; letter-spacing: 0.01em; margin: 0.6em 0 1.2em !important; padding-left: 1.2em; border-left: 2px solid var(--accent); }
.display-math sub { font-size: 0.6em; }
.math { font-family: var(--display); font-weight: 400; font-style: italic; font-size: 1.15rem; letter-spacing: 0.01em; }

/* the four primitives: a name and its formula on one line, one sentence or
   two beneath, and a single quiet line that opens the registry for it */
.prims { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 40px; margin: 8px 0 12px; }
.prim { display: grid; gap: 10px; align-content: start; padding-top: 14px; border-top: 1px solid var(--rule); min-width: 0; }
.prim-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.prim .mono { color: var(--accent); }
.prim .math { font-size: 1.08rem; }
.prim p { margin: 0; font-size: 0.94rem; line-height: 1.5; }
.prim-more { margin-top: 2px; }
.prim-more summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--muted); }
.prim-more summary::-webkit-details-marker { display: none; }
.prim-more summary::before { content: "+"; color: var(--accent); font-size: 0.85rem; }
.prim-more[open] summary::before { content: "−"; }
.prim-more summary:hover { color: var(--text); }
.prim-more summary em { font-style: normal; }
.prim-more .reg-list { padding: 6px 0 4px; display: grid; gap: 6px; }
/* the registry itself is fine print: one small paragraph per entry, nothing tabular */
.reg-list p { margin: 0; font-size: 0.7rem; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.reg-list code { font-size: 0.66rem; background: none; padding: 0; color: var(--text); }
.reg-list p > code:first-child { color: var(--accent); }

.pull { margin: 0 auto; padding: 64px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; }
.pull p { grid-column: 2; margin: 0; max-width: 34ch; font-family: var(--display); font-weight: 400; font-style: italic; font-variation-settings: "opsz" 60; font-size: clamp(22px, 2.4vw, 30px); line-height: 1.3; letter-spacing: -0.005em; text-wrap: balance; }
.pull cite { grid-column: 2; margin-top: 14px; font-family: var(--mono); font-style: normal; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.table-wrap { overflow-x: auto; margin: 8px 0 20px; }
.claims { width: 100%; border-collapse: collapse; font-size: 0.94rem; line-height: 1.4; min-width: 560px; }
.claims th { text-align: left; font-family: var(--mono); font-weight: 500; font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 0 12px 10px 0; border-bottom: 1px solid var(--text); }
.claims td { vertical-align: top; padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule); }
.claims td:first-child { font-family: var(--display); font-weight: 500; font-variation-settings: "opsz" 24; font-size: 1rem; width: 36%; }
.claims .num { text-align: right; padding-right: 0; white-space: nowrap; }
.tag { display: inline-block; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 7px; border: 1px solid currentColor; border-radius: 2px; }
.tag-fail { color: var(--fail); }
.tag-moved { color: var(--moved); }
.tag-half { color: var(--half); }

.arc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 10px 0 18px; border-top: 1px solid var(--text); }
.arc-step { display: grid; align-content: start; gap: 4px; padding: 14px 14px 14px 0; border-right: 1px solid var(--rule); margin-right: 14px; }
.arc-step:last-child { border-right: 0; margin-right: 0; }
.arc-n { font-family: var(--display); font-weight: 400; font-variation-settings: "opsz" 60; font-size: clamp(28px, 3.2vw, 44px); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.arc-step-hi .arc-n { color: var(--accent); }
.arc-l { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; }
.arc-d { font-size: 0.84rem; line-height: 1.35; color: var(--muted); }

.bars { display: grid; gap: 8px; margin: 12px 0 10px; }
.bar { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 12px; font-size: 0.9rem; }
.bar-l { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }
.bar-t { height: 12px; background: var(--paper-2); position: relative; }
.bar-t i { position: absolute; inset: 0; width: calc(var(--v) * 100%); background: var(--muted); }
.bar-hi .bar-t i { background: var(--accent); }
.bar-n { font-family: var(--mono); font-size: 0.8rem; text-align: right; font-variant-numeric: tabular-nums; }

.corpus { list-style: none; margin: 8px 0 20px; padding: 0; columns: 2; column-gap: 32px; font-size: 0.94rem; }
.corpus li { break-inside: avoid; padding: 6px 0; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; align-items: baseline; }
.corpus b { font-family: var(--display); font-weight: 500; font-size: 1.1rem; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }


.next { margin: 8px 0 22px; padding: 0; list-style: none; display: grid; gap: 10px; }
.next li { padding-left: 18px; position: relative; }
.next li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.next b { font-weight: 600; }

.colophon { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; padding: 40px 0 0; font-size: 0.9rem; color: var(--muted); }
.colophon p { margin: 0 0 6px; }
.colophon .mono { color: var(--accent); margin-bottom: 10px; }

@media (max-width: 960px) {
  /* minmax(0, …) rather than 1fr: a wide table inside must scroll, never push
     the section — and the page with it — past the viewport */
  .sec, .pull { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 44px 0; }
  .margin { position: static; grid-template-columns: auto 1fr; align-items: baseline; }
  .body { min-width: 0; }
  .pull p, .pull cite { grid-column: 1; }
  .arc { grid-template-columns: 1fr 1fr; }
  .arc-step:nth-child(2) { border-right: 0; }
  .colophon { grid-template-columns: 1fr; }
  .masthead { padding: 44px 0 32px; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .paper { padding-bottom: 56px; }
  .masthead { padding: 36px 0 28px; }
  .standfirst { font-size: 19px; line-height: 1.5; }
  .sec { padding: 36px 0; }
  .prims { grid-template-columns: 1fr; gap: 24px; }
  .display-math { font-size: 1.25rem; padding-left: 0.9em; }
  .corpus { columns: 1; }
  .arc { grid-template-columns: 1fr; }
  .arc-step { border-right: 0; margin-right: 0; border-bottom: 1px solid var(--rule); }
  .bar { grid-template-columns: 96px 1fr 50px; }
  /* the claims table stacks: claim and outcome on one line, the measurement under */
  .table-wrap { overflow: visible; margin: 4px 0 8px; }
  .claims { min-width: 0; border-top: 1px solid var(--text); }
  .claims thead { display: none; }
  .claims tbody { display: block; }
  .claims tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .claims td { display: block; padding: 0; border: 0; width: auto; }
  .claims td:first-child { width: auto; grid-column: 1; grid-row: 1; font-size: 0.98rem; }
  .claims td.num { grid-column: 2; grid-row: 1; }
  .claims td:nth-child(2) { grid-column: 1 / -1; font-size: 0.86rem; color: var(--muted); }
  .stages ol { gap: 18px; }
  .stage { grid-template-columns: 26px 1fr; gap: 0 12px; }
  .stage .dot { width: 26px; height: 26px; }
  .stage-text p { font-size: 0.7rem; }
  .tip { max-width: calc(100vw - 24px); }
  .tip.tip-wide { max-width: calc(100vw - 24px); }
}

/* ================================================================ figures */
.snap { position: relative; margin: 28px 0 32px; background: none; color: var(--fig-note); overflow: hidden; }
.snap canvas { display: block; width: 100%; height: var(--snap-h, auto); cursor: grab; touch-action: pan-y; user-select: none; }
.snap.dragging canvas { cursor: grabbing; }
.snap .leaders { position: absolute; left: 0; top: 0; width: 100%; height: var(--snap-h, 100%); pointer-events: none; }
.snap-labels { position: absolute; inset: 0; height: var(--snap-h, 100%); pointer-events: none; }
.snap .ann-snap { position: absolute; transform: translateY(-50%); animation: none; max-width: 21ch; color: var(--fig-note); }
.snap .ann-snap[data-side="l"] { left: 10px; }
.snap .ann-snap[data-side="r"] { right: 10px; text-align: right; }
.snap .ann-snap .ann-label { font-size: 0.92rem; }
/* the figures take the same two hues, at the weight their paper asks for */
.snap .ann-snap.ann-in .ann-label { color: var(--fig-in); }
.snap .ann-snap.ann-out .ann-label { color: var(--fig-out); }
.snap .ann-snap .ann-id { color: var(--fig-muted); }
.snap .ann-svg { animation: none; }
.snap .ann-svg.ann-in { color: var(--fig-in); } .snap .ann-svg.ann-in .leader { stroke: var(--fig-in); }
.snap .ann-svg.ann-out { color: var(--fig-out); } .snap .ann-svg.ann-out .leader { stroke: var(--fig-out); }
.snap .ann-svg.ann-note { color: var(--fig-note); } .snap .ann-svg.ann-note .leader { stroke: var(--fig-note); opacity: 0.75; }
/* a narrow figure has no room beside the brain: the labels sit in two columns
   under it and their leaders climb into the drawing (brain.js sets .narrow and
   stretches the leader layer over both) */
.snap.narrow .snap-labels { position: relative; inset: auto; height: auto; display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: row dense; gap: 12px 16px; padding: 18px 18px 4px; }
.snap.narrow .ann-snap { position: static; transform: none; max-width: none; padding: 0; }
.snap.narrow .ann-snap[data-side="l"] { grid-column: 1; }
.snap.narrow .ann-snap[data-side="r"] { grid-column: 2; text-align: right; }
.snap.narrow .ann-snap .ann-label { font-size: 0.88rem; }
.snap figcaption { position: relative; padding: 10px 0 0; font-size: 0.86rem; line-height: 1.45; color: var(--muted); border-top: 1px solid var(--rule); }
.snap figcaption b { color: var(--text); font-weight: 600; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; margin-right: 6px; }
.body figure.snap { max-width: none; }
.snap:not(.rendered) canvas { min-height: 200px; }

/* ================================================================= lineup */
.body-wide { max-width: none; }
.body-wide > .note { max-width: 68ch; }
.lineup { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 28px; margin: 24px 0 40px; }
.line { display: grid; gap: 0; align-content: start; }
.line .snap { margin: 0 0 6px; }
.line .snap-small canvas { height: var(--snap-h, auto); }
.line-text { display: grid; gap: 2px; }
.line-text .mono { color: var(--accent); }
.status { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 0 0; border-top: 1px solid var(--rule); margin-top: 4px; }
.status-built { color: var(--moved); }
.status-open { color: var(--half); }
.status-declared { color: var(--muted); }
.h-plain { margin: 8px 0 12px; font-size: 1.15rem; font-weight: 600; }
.wrong { margin: 6px 0 24px; padding: 0; list-style: none; counter-reset: wrong; display: grid; gap: 12px; }
.wrong li { counter-increment: wrong; padding-left: 34px; position: relative; font-size: 0.96rem; line-height: 1.5; }
.wrong li::before { content: counter(wrong); position: absolute; left: 0; top: 0.15em; font-family: var(--mono); font-size: 0.7rem; color: var(--fail); }
.wrong li span { font-weight: 600; }
@media (max-width: 960px) {
  .lineup { grid-template-columns: 1fr 1fr; }
  .compute { grid-template-columns: 1fr 1fr; }
  .compute > div:nth-child(2) { border-right: 0; }
  .traj { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  /* each release line is a thumbnail beside its list, not a full-width figure */
  .lineup { grid-template-columns: 1fr; gap: 22px; }
  .line { grid-template-columns: minmax(0, 32%) minmax(0, 1fr); gap: 14px; align-items: center; }
  .line .snap { margin: 0; }
  .models .model-toggle em { display: none; }   /* the count is one tap away, and the name needs the room */
  .models .model-toggle em + b { margin-left: auto; }
  .compute { grid-template-columns: 1fr; }
  .compute > div { border-right: 0; margin-right: 0; border-bottom: 1px solid var(--rule); }
  .snap .ann-snap { max-width: 14ch; }
}

/* ================================================================= models */
.models { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 5px; }
.models li { min-width: 0; }
.models .model { display: flex; align-items: baseline; gap: 8px; min-width: 0; width: 100%; font-size: 0.8rem; color: inherit; text-decoration: none; }
.models code { font-size: 0.7rem; background: none; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.models b { font-family: var(--mono); font-size: 0.7rem; font-weight: 500; color: var(--accent); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.models .wip b { color: var(--muted); }
.models a.model:hover code { color: var(--accent); }
.models .hf { font-size: 0.8rem; line-height: 1; }
/* a model that has weights: the name is a link that opens its checkpoints */
.models .model-toggle { appearance: none; background: none; border: 0; padding: 0; margin: 0; text-align: left; cursor: pointer; font-family: inherit; }
.models .model-toggle code { text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--accent); text-underline-offset: 0.2em; }
.models .model-toggle:hover code, .models .model-toggle[aria-expanded="true"] code { color: var(--accent); text-decoration-style: solid; }
.models .model-toggle::after { content: "▸"; order: -1; font-size: 0.6rem; color: var(--accent); transition: transform 0.15s; }
.models .model-toggle[aria-expanded="true"]::after { content: "▾"; }
.models .model-toggle em { font-family: var(--mono); font-style: normal; font-size: 0.6rem; letter-spacing: 0.06em; color: var(--muted); margin-left: auto; }
.models .model-toggle em + b { margin-left: 10px; }
.ckpts[hidden] { display: none; }   /* the display rule below would beat the UA one */
.ckpts { list-style: none; margin: 4px 0 6px; padding: 6px 0 6px 18px; display: grid; gap: 4px; max-height: 13.5em; overflow: auto; border-left: 1px solid var(--rule); }
.ckpts .model { font-size: 0.74rem; }
.ckpts code { font-size: 0.66rem; color: var(--muted); display: flex; min-width: 0; }
/* the step is what distinguishes one checkpoint from the next, so the run name
   gives way to it rather than the other way round */
.ckpts code i { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 2ch; }
.ckpts code span { white-space: nowrap; }
.ckpts b { color: var(--muted); font-size: 0.66rem; }
.ckpts a.model:hover code, .ckpts a.model:hover b { color: var(--accent); }

/* ============================================================= references */
.ref { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; cursor: help; }
.ref:hover, .ref.is-open { color: var(--accent); text-decoration-style: solid; }
.tip { position: absolute; z-index: 20; max-width: 30ch; padding: 10px 12px; font-size: 0.84rem; line-height: 1.4; color: var(--text); background: var(--paper); border: 1px solid var(--rule); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); display: grid; gap: 6px; }
.tip[hidden] { display: none; }
.tip.tip-wide { max-width: 44ch; }
.tip-extra { margin: 2px 0 0; }
.tip-extra[hidden] { display: none; }
.tip-extra .models { margin: 0; }
.tip-link { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--accent); text-decoration: none; }
.tip-link:hover { text-decoration: underline; }
.tip-link::after { content: " →"; }
.hero .ref { color: inherit; }

/* ================================================================= stages */
.stages { position: relative; margin: 8px 0 0; }
.stages .rail { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.stages .rail path { fill: none; stroke: var(--rule); stroke-width: 1.3; }
.stages .rail path.lit { stroke: var(--muted); }
.stages ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.stage { display: grid; grid-template-columns: 28px 1fr; gap: 0 18px; align-items: start; position: relative; }
.stage .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 0.72rem; font-weight: 500; color: var(--muted); background: var(--paper); border: 1.5px solid var(--rule); box-sizing: border-box; position: relative; z-index: 1; }
.stage .dot svg { width: 14px; height: 14px; fill: none; stroke: var(--paper); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.stage.done .dot { background: var(--moved); border-color: var(--moved); }
.stage.running .dot { background: var(--half); border-color: var(--half); color: var(--paper); animation: dag-pulse 1.6s ease-in-out infinite; }
.stage.ready .dot { border-style: dashed; border-color: var(--muted); }
.stage.failed .dot { border-color: var(--fail); color: var(--fail); }
.stage.blocked .dot { color: var(--muted); }
.stage-text h4 { margin: 3px 0 4px; font-size: 1.02rem; font-weight: 600; line-height: 1.25; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.stage-text h4 small { font-family: var(--mono); font-weight: 400; font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.stage.done h4 small { color: var(--moved); } .stage.running h4 small { color: var(--half); } .stage.failed h4 small { color: var(--fail); }
.stage-text p { margin: 3px 0 0; font-family: var(--mono); font-size: 0.72rem; line-height: 1.55; letter-spacing: 0.01em; color: var(--muted); max-width: 60ch; }
@keyframes dag-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .stage.running .dot { animation: none; } }

/* =================================================================== deck */
.deck { margin: 4px 0 34px; }
.deck-scroll { position: relative; height: 396px; overflow: hidden; margin: 0; cursor: grab; touch-action: pan-y; perspective: 1100px;
  /* whatever the fan is doing at the page edge, it dissolves there rather than being sliced */
  --edge: clamp(48px, 9vw, 120px);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--edge), #000 calc(100% - var(--edge)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--edge), #000 calc(100% - var(--edge)), transparent 100%); }
.deck-scroll.dragging { cursor: grabbing; user-select: none; }
.deck-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.card[hidden] { display: none; }   /* the .card display rule would otherwise beat the UA one */
.card { position: absolute; left: 50%; top: 34px; width: 214px; height: 318px; padding: 14px 15px; display: grid; grid-template-rows: auto auto 1fr; gap: 6px; background: color-mix(in srgb, var(--paper) 80%, var(--paper-2)); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26); will-change: transform, opacity; }
.card-n { display: block; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; color: var(--accent); text-decoration: none; font-weight: 500; }
.card-n:hover { text-decoration: underline; }
.card-title { margin: 2px 0 0; font-size: 0.92rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-desc { margin: 0; font-size: 0.78rem; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 10; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) { .deck-scroll { height: 370px; } .card { width: 190px; height: 300px; } }

/* ---- the reel: squircle tiles strewn across the hero/paper divide ---- */
.reel {
  position: relative; z-index: 3;
  /* the bottom margin used to be negative, which pulled the standfirst up UNDER
     the tiles.  the reel now sits ON the divide and the paper starts clear of
     it; only the top still overlaps the hero, which is the intended effect. */
  margin: -5rem auto 2.5rem; padding: 0 1.5rem;
  max-width: 1240px;
  display: flex; justify-content: center; align-items: flex-start;
  flex-wrap: wrap; row-gap: 1.6rem; column-gap: 0;
  pointer-events: none;
}
.reel .tile {
  pointer-events: auto;
  position: relative; margin: 0;
  width: 150px; height: 150px; flex: 0 0 auto;
  border-radius: 30% / 30%;               /* squircle-ish */
  overflow: hidden;
  background: #0d1013;
  box-shadow: 0 10px 34px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.07);
  transition: transform .28s cubic-bezier(.2,.7,.3,1), box-shadow .28s;
}
.reel .tile + .tile { margin-left: -28px; }   /* semi-overlapping */
.reel .tile video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.06);
}
/* strewn: each tile sits a little off the line */
.reel .t0 { transform: translateY(14px)  rotate(-3deg); z-index: 6; }
.reel .t1 { transform: translateY(-16px) rotate(2.5deg); z-index: 5; }
.reel .t2 { transform: translateY(22px)  rotate(-1.5deg); z-index: 4; }
.reel .t3 { transform: translateY(-10px) rotate(3deg);  z-index: 3; }
.reel .t4 { transform: translateY(18px)  rotate(-2deg); z-index: 2; }
.reel .t5 { transform: translateY(-6px)  rotate(1.5deg); z-index: 1; }
.reel .tile:hover {
  transform: translateY(-4px) rotate(0deg) scale(1.09); z-index: 20;
  box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.18);
}
.reel figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.4rem .8rem .7rem;
  background: linear-gradient(to top, rgba(6,8,10,.94) 30%, transparent);
  font-size: .62rem; line-height: 1.25; letter-spacing: .01em;
  opacity: 0; transition: opacity .25s;
}
.reel .tile:hover figcaption { opacity: 1; }
.reel figcaption b { display: block; color: #eaf2f6; font-weight: 600; }
.reel figcaption span { display: block; color: #9fb0ba; font-family: var(--mono, monospace); font-size: .58rem; margin-top: .18rem; }
@media (max-width: 900px) {
  .reel { margin: -2.5rem auto 1.75rem; }
  .reel .tile { width: 112px; height: 112px; }
  .reel .tile + .tile { margin-left: -22px; }
}
@media (prefers-reduced-motion: reduce) {
  .reel .tile { transition: none; }
}

/* ---- lightbox: a tile fills the screen with its caption and description ---- */
.lb { position: fixed; inset: 0; z-index: 999; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 1.2rem; padding: 3rem 2rem;
  background: rgba(4,6,8,.955); backdrop-filter: blur(14px);
  animation: lbin .18s ease-out; }
.lb[hidden] { display: none; }
@keyframes lbin { from { opacity: 0 } to { opacity: 1 } }
.lb-stage { max-width: min(1100px, 92vw); max-height: 62vh; display: flex; }
.lb-stage video, .lb-stage img {
  max-width: 100%; max-height: 62vh; width: auto; height: auto;
  border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.7); background: #0d1013; }
.lb-meta { max-width: 62ch; text-align: left; }
.lb-meta h3 { margin: 0 0 .3rem; font-size: 1.02rem; color: #eaf2f6; font-weight: 600; }
.lb-cap { margin: 0 0 .55rem; font-family: var(--mono, monospace);
  font-size: .74rem; color: #7fd7c4; letter-spacing: .01em; }
.lb-desc { margin: 0; font-size: .84rem; line-height: 1.55; color: #a9bac4; }
.lb-close { position: absolute; top: 1.1rem; right: 1.4rem;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.07); color: #dfe9ee;
  border: 1px solid rgba(255,255,255,.14); font-size: 1.4rem; line-height: 1; }
.lb-close:hover { background: rgba(255,255,255,.14); }
.reel .tile { cursor: zoom-in; }
.reel .tile:focus-visible { outline: 2px solid #7fd7c4; outline-offset: 3px; }
@media (max-width: 700px) { .lb { padding: 2rem 1.1rem; } .lb-stage { max-height: 46vh; } }
