/*
 * /research/ — page-specific layer on top of base.css + paper.css.
 *
 * One figure language throughout: hairline strokes (--line / --line-2), ink
 * for the thing being compared against, amber (--ai / --ai-deep) for the model
 * you play and its descendants, board colours only on board drawings, red
 * (--alarm) only in the bug log. Figure numbers in Geist Mono, labels and
 * reading text in Geist, display in Instrument Serif. Nothing below 12px.
 */

.research { --fig-pad: var(--s-5); }

/* ── Header */
/* The header sits on the article's own grid, so the eyebrow, title, dek and
   meta share the reading column's left edge at every width. */
.research-head { padding-left: 0; padding-right: 0; }
.research-head h1 { max-width: 13ch; }
.research-head .lead { max-width: 40rem; }
.research-head .doc-meta { max-width: 52rem; margin-right: var(--gutter); }
.research-head .doc-meta a { color: var(--text-2); }

/* ── Contents pill (phones and tablets; the sidebar list is hidden there) ── */
.toc-pill {
  position: sticky;
  top: var(--bar-h);
  z-index: 20;
  align-self: start;
  margin-bottom: var(--s-5);
  /* A band of paper behind the pill, so text scrolling under the bar
     doesn't show between the bar and the pill. */
  padding: var(--s-2) 0 var(--s-3);
  background: linear-gradient(var(--bg) 78%, transparent);
  font-family: var(--sans);
  font-size: var(--t-2);
}
.toc-pill summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  cursor: pointer;
  list-style: none;
  color: var(--text);
}
.toc-pill summary::-webkit-details-marker { display: none; }
.tp-k { font-weight: 600; flex: none; }
.tp-cur { flex: 1; min-width: 0; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-cur:not(:empty)::before { content: '·'; margin-right: var(--s-2); color: var(--text-3); }
.tp-chev { width: 12px; height: 12px; flex: none; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 1.6; transition: transform 0.2s var(--ease-out); }
.toc-pill[open] .tp-chev { transform: rotate(180deg); }
.toc-pill nav {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 6px);
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  padding: var(--s-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow);
}
.toc-pill ol { list-style: none; margin: 0; padding: 0; }
.toc-pill a { display: block; padding: 0.6rem var(--s-3); border-radius: var(--radius-s); color: var(--text-2); text-decoration: none; }
.toc-pill a:hover { background: var(--surface); color: var(--text); }
.toc-pill a[aria-current="true"] { color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
@media (min-width: 1101px) { .toc-pill { display: none; } }
@media print { .toc-pill { display: none; } }

/* ── TL;DR */
.tldr { padding: var(--s-5) var(--s-5) var(--s-4); }
.tldr .callout-title {
  font-family: var(--sans);
  font-size: var(--t-1);
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
.tl-stats {
  display: block;
  border: 0;
  border-radius: 0;
  background: none;
  margin-top: var(--s-3);
}
.tl-stats .stat {
  display: grid;
  /* Wide enough for the longest value, "84.7% → 76.8%". */
  grid-template-columns: 12.5rem 1fr;
  align-items: baseline;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  background: none;
  border-top: 1px solid var(--line);
}
.tl-stats .stat:first-child { border-top: 0; }
.tl-stats .stat .v { font-size: 1.75rem; white-space: nowrap; }
.tl-stats .stat .k { margin: 0; font-size: var(--t-2); color: var(--text-2); }
.tl-points { margin-top: var(--s-3); padding: var(--s-3) 0 0 1.1em; border-top: 1px solid var(--line); color: var(--text-2); }
.tl-points li + li { margin-top: var(--s-2); }
@media (max-width: 520px) {
  .tl-stats .stat { grid-template-columns: 1fr; gap: 2px; }
  .tl-stats .stat .v { font-size: 1.6rem; }
}

/* ── Reading helpers */
.research > .prose:first-of-type { margin-top: 0; }
.research > .prose + .prose { margin-top: 1.1em; }
.prose .small, .small { font-family: var(--sans); font-size: var(--t-2); color: var(--text-2); line-height: 1.6; }
.src {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-3);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
figcaption .src, .note .src, .small .src { display: block; margin-top: var(--s-1); }
.note {
  padding: var(--s-4) var(--s-5);
  border-left: 2px solid var(--emph);
  background: var(--bg-raised);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--sans);
  font-size: var(--t-2);
  line-height: 1.6;
  color: var(--text-2);
}
.note b { color: var(--text); font-weight: 650; }
.prose .note { margin-top: var(--s-6); margin-bottom: var(--s-2); }
.note.caveat { border-left-color: var(--text-2); }
.prose ol.stages { padding-left: 1.5em; }
.prose ol.stages li { padding-left: 0.2em; }
.prose ol.stages li + li { margin-top: 0.8em; }
.prose ol.stages li::marker { font-family: var(--mono); font-size: 0.8em; color: var(--text-3); }

/* ── Figures */
.research figure.fig { margin: var(--s-7) 0; }
/* Wide figures borrow the empty right margin when there is one. */
.fig.bleed { margin-right: calc(-1 * clamp(0px, (100vw - 40rem - 6rem) / 2 - 2rem, 16rem)) !important; }
.research .fig-frame { padding: var(--fig-pad); overflow: visible; }
.fig-n {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin-right: 0.35em;
}
.research figcaption { font-family: var(--sans); }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Board drawing (shared symbol) */
.bd-bg { fill: #fffdf8; }
.bd-t { fill: #fffdf8; stroke: var(--line-2); stroke-width: 0.7; }
.bd-c { stroke: var(--line-2); stroke-width: 0.7; }
.bd-c.you { fill: color-mix(in srgb, var(--you) 42%, #fffdf8); }
.bd-c.crimson { fill: color-mix(in srgb, var(--crimson) 36%, #fffdf8); }
.bd-c.ai { fill: color-mix(in srgb, var(--ai) 48%, #fffdf8); }
.bd-c.sapphire { fill: color-mix(in srgb, var(--sapphire) 36%, #fffdf8); }
.bd-base { stroke: var(--line-2); stroke-width: 0.7; }
.bd-base.you { fill: color-mix(in srgb, var(--you) 30%, #fffdf8); }
.bd-base.crimson { fill: color-mix(in srgb, var(--crimson) 26%, #fffdf8); }
.bd-base.ai { fill: color-mix(in srgb, var(--ai) 36%, #fffdf8); }
.bd-base.sapphire { fill: color-mix(in srgb, var(--sapphire) 26%, #fffdf8); }
.bd-yard { fill: #fffdf8; stroke: var(--line); }
.bd-slot { fill: none; stroke-width: 1.2; }
.bd-slot.you { stroke: var(--you); }
.bd-slot.crimson { stroke: var(--crimson); }
.bd-slot.ai { stroke: var(--ai-deep); }
.bd-slot.sapphire { stroke: var(--sapphire); }
.bd-star { fill: var(--text-3); opacity: 0.55; }
.bd-home { stroke: #fffdf8; stroke-width: 1; }
.bd-home.you { fill: color-mix(in srgb, var(--you) 70%, #fffdf8); }
.bd-home.crimson { fill: color-mix(in srgb, var(--crimson) 65%, #fffdf8); }
.bd-home.ai { fill: color-mix(in srgb, var(--ai) 78%, #fffdf8); }
.bd-home.sapphire { fill: color-mix(in srgb, var(--sapphire) 65%, #fffdf8); }
.bd-edge { fill: none; stroke: var(--line-2); }
.dim-board { opacity: 0.62; }

/* SVG type */
.research svg text { font-family: var(--sans); }
.svg-k { font-size: 13px; font-weight: 650; fill: var(--text-2); }
.svg-l { font-size: 13.5px; font-weight: 600; fill: var(--text); }
.svg-m { font-family: var(--mono) !important; font-size: 12.5px; fill: var(--text); }
.svg-l.mute, .svg-m.mute { fill: var(--text-3); font-weight: 400; }
.ai-t { fill: var(--ai-text); }

/* ── Figure: the model */
.model-grid { display: grid; grid-template-columns: minmax(0, 21.25rem) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.model-svg { width: 100%; height: auto; }
.model-svg .tok { fill: var(--surface-2); stroke: var(--line-2); }
.model-svg .tok.cls { fill: color-mix(in srgb, var(--ai) 40%, var(--bg-raised)); stroke: var(--ai-deep); }
.model-svg .blk { fill: var(--bg); stroke: var(--line-2); }
.model-svg .flow { stroke: var(--text-3); stroke-width: 1.2; fill: none; }
.model-svg .pol { fill: var(--ai); }
.model-svg .vbar { fill: var(--surface-2); }
.model-svg .vbar-fill { fill: var(--ai); }
.model-notes {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: mn;
  font-family: var(--sans);
  font-size: var(--t-2);
  line-height: 1.6;
  color: var(--text-2);
}
.model-notes li { counter-increment: mn; position: relative; padding: 0 0 var(--s-4) 2rem; }
.model-notes li + li { padding-top: var(--s-4); border-top: 1px solid var(--line); }
.model-notes li::before {
  content: counter(mn);
  position: absolute;
  left: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text-3);
}
.model-notes li + li::before { top: var(--s-4); }
.model-notes b { color: var(--text); font-weight: 650; }
@media (max-width: 760px) {
  .model-grid { grid-template-columns: 1fr; }
  .model-svg { max-width: 21.25rem; margin: 0 auto; }
}

/* ── Figure: the pipeline */
.flow-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--s-5);
  font-family: var(--sans);
}
.flow-step { position: relative; display: grid; gap: var(--s-1); align-content: start; }
.flow-step::after {
  /* the connector to the next stage */
  content: '';
  position: absolute;
  top: 1.05rem;
  left: 2.75rem;
  right: calc(-1 * var(--s-5) + 0.35rem);
  height: 1px;
  background: var(--line-2);
}
.flow-step:last-child::after { display: none; }
.fs-n {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--bg-raised);
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text-2);
  margin-bottom: var(--s-2);
}
.fs-t { font-weight: 650; font-size: var(--t-2); color: var(--text); line-height: 1.3; }
.fs-d { font-size: var(--t-1); color: var(--text-2); line-height: 1.45; }
.flow-step.key .fs-n { background: var(--emph); border-color: var(--emph); color: var(--accent-ink); }
.flow-step.key .fs-t { color: var(--emph); }
.flow-loop {
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--line-2);
  font-family: var(--sans);
  font-size: var(--t-1);
  color: var(--text-2);
}
.flow-loop span { font-size: 1rem; margin-right: 0.35em; color: var(--text-3); }
@media (max-width: 720px) {
  .flow-steps { grid-template-columns: 1fr; gap: 0; }
  .flow-step { grid-template-columns: 2.2rem 1fr; column-gap: var(--s-4); row-gap: 0; padding-bottom: var(--s-4); }
  .flow-step .fs-n { grid-row: span 2; margin: 0; }
  .flow-step::after { top: 2.2rem; bottom: 0; left: 1.1rem; right: auto; width: 1px; height: auto; }
}

/* ── Figure: the generations */
.gantt { font-family: var(--sans); padding-top: var(--s-4); }
.gt-axis, .gt-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) 7.5rem;
  gap: var(--s-4);
  align-items: center;
}
.gt-axis { height: 2.4rem; align-items: start; }
.gt-axis .gt-track { position: relative; height: 100%; }
.gt-tick {
  position: absolute;
  top: 0;
  padding-left: 4px;
  border-left: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--text-3);
  white-space: nowrap;
}
.gt-tick i { display: block; font-style: normal; color: var(--text-2); }
.gt-tick:not(.yr) { height: 1.2rem; }
.gt-rows { list-style: none; margin: 0; padding: 0; }
.gt-row { padding: 0.3rem 0; border-top: 1px solid var(--line); }
.gt-ring { font-family: var(--mono); font-size: 0.8125rem; font-weight: 500; color: var(--text); white-space: nowrap; }
.gt-track { position: relative; height: 1.25rem; }
.gt-rows .gt-track {
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--months, 11)) 100%;
}
.gt-bar {
  position: absolute;
  top: 0.3rem;
  height: 0.65rem;
  border-radius: 3px;
  background: var(--text-2);
}
.gt-head { font-family: var(--mono); font-size: 0.8125rem; color: var(--text-2); text-align: right; white-space: nowrap; }
.is-ship .gt-bar { background: var(--ai); box-shadow: 0 0 0 1px var(--ai-deep) inset; }
.is-ship .gt-ring, .is-ship .gt-head { color: var(--ai-text); font-weight: 600; }
.is-back .gt-bar {
  background: repeating-linear-gradient(135deg, var(--text-3) 0 1.5px, transparent 1.5px 4.5px);
  box-shadow: 0 0 0 1px var(--text-3) inset;
}
@media (max-width: 600px) {
  /* Months are ~20px apart here: keep only the year ticks, and put each
     era's number under its bar instead of in a third column. */
  .gt-axis, .gt-row { grid-template-columns: 5.4rem minmax(0, 1fr); column-gap: var(--s-3); row-gap: 0; }
  .gt-axis .gt-head { display: none; }
  .gt-row .gt-head { grid-column: 2; text-align: left; font-size: 0.75rem; line-height: 1.2; }
  .gt-row .gt-head:empty { display: none; }
  .gt-tick:not(.yr) { display: none; }
  .gt-tick.yr { background: var(--bg-raised); padding-right: 4px; }
}

.eras { list-style: none; margin: 0 0 var(--s-6); padding: 0; }
.era {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: var(--s-5);
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line);
}
.era:last-child { border-bottom: 1px solid var(--line); }
.era-meta { display: grid; gap: 2px; align-content: start; font-family: var(--sans); }
.era-ring { font-family: var(--mono); font-size: 0.9375rem; font-weight: 500; }
.era-when { font-size: var(--t-1); color: var(--text-3); }
.era-body h3 { font-size: 1.5rem; line-height: 1.15; }
.era-body p { margin-top: var(--s-1); font-family: var(--sans); font-size: 0.9375rem; line-height: 1.65; color: var(--text); }
.era-body .src { display: block; margin-top: var(--s-1); }
.era-body .era-num { font-family: var(--sans); font-size: var(--t-2); color: var(--text-2); }
.era-num .v { font-family: var(--mono); font-size: 0.9375rem; font-weight: 500; color: var(--text); margin-right: 0.3em; }
.era.is-ship .era-ring, .era.is-ship .era-num .v { color: var(--ai-text); }
.era.is-ship { background: linear-gradient(90deg, color-mix(in srgb, var(--ai) 7%, transparent), transparent 70%); }
@media (max-width: 600px) {
  .era { grid-template-columns: 1fr; gap: var(--s-2); }
  .era-meta { grid-auto-flow: column; justify-content: start; gap: var(--s-3); align-items: baseline; }
}

/* ── Figure: the tournament */
.table-frame { padding: var(--s-3) var(--s-4); }
table.tourney { font-size: var(--t-2); }
.tourney th, .tourney td { padding: 0.7rem 0.75rem; vertical-align: middle; }
.tourney thead th { white-space: nowrap; }
.tourney thead th.corner { font-weight: 600; color: var(--text-3); }
.tourney tbody th { font-family: var(--mono); font-size: 0.9375rem; font-weight: 500; white-space: nowrap; }
.tourney td.cell {
  background: color-mix(in srgb, var(--hc) calc(var(--h) * 100%), transparent);
  border-left: 2px solid var(--bg-raised);
}
.tourney td .p { display: block; font-size: 0.9375rem; color: var(--text); }
.tourney td .c { display: block; font-size: 0.75rem; color: var(--text-2); margin-top: 1px; }
.tourney td.self { text-align: center; color: var(--text-3); }
.tourney td.avg { border-left: 1px solid var(--line-2); }
.tourney td.avg .p { font-weight: 500; }
.tourney tr.champ th { color: var(--ai-text); }
.tourney tr.champ td.avg .p { color: var(--ai-text); }
.tourney tr.champ th, .tourney tr.champ td { border-bottom-color: var(--line-2); }
.tourney tr.scripted th { color: var(--text-2); }
.tag {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0.05em 0.5em;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  vertical-align: 0.1em;
}
.tag.ai { border-color: color-mix(in srgb, var(--ai-deep) 45%, transparent); color: var(--ai-text); }
/* Hovering a cell lights its column header and row header. */
.tourney tbody tr:hover th { color: var(--text); }
.tourney tbody tr.champ:hover th { color: var(--ai-text); }
.tourney:has(td[data-col="v13.5"]:hover) thead th[data-col="v13.5"],
.tourney:has(td[data-col="v13.6"]:hover) thead th[data-col="v13.6"],
.tourney:has(td[data-col="v15.2"]:hover) thead th[data-col="v15.2"],
.tourney:has(td[data-col="MCTS"]:hover) thead th[data-col="MCTS"] { color: var(--text); }
.tourney td.cell:hover { outline: 1px solid var(--line-2); outline-offset: -1px; }

@media (max-width: 640px) {
  .table-frame { padding: var(--s-3); }
  .tourney thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tourney, .tourney tbody { display: block; }
  .tourney tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--line);
  }
  .tourney tbody tr:last-child { border-bottom: 0; }
  .tourney th[scope="row"] { grid-column: 1 / -1; padding: 0 0 var(--s-1); border: 0; }
  .tourney td { display: block; padding: 0.45rem 0.5rem; border: 0 !important; border-radius: 6px; text-align: left; }
  .tourney td.self { display: none; }
  .tourney td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-3);
    margin-bottom: 2px;
  }
  .tourney td.avg { grid-column: 1 / -1; display: flex; gap: var(--s-3); align-items: baseline; padding-top: var(--s-1); }
  .tourney td.avg::before { margin: 0; }
}

/* ── Figure: sizes */
.sizes, .layers { font-family: var(--sans); font-size: var(--t-2); }
.sz-head, .sz-row, .sz-foot, .ly-head, .ly-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-5);
  align-items: center;
}
.sz-head, .ly-head { font-size: var(--t-1); font-weight: 600; color: var(--text-3); padding-bottom: var(--s-2); }
.sz-rows, .ly-rows { list-style: none; margin: 0; padding: 0; }
.sz-row, .ly-row { padding: var(--s-2) 0; border-top: 1px solid var(--line); }
.sz-name, .ly-n { font-family: var(--mono); font-size: 0.875rem; font-weight: 500; }
.sz-bar, .ly-bar { position: relative; display: flex; align-items: center; gap: var(--s-2); height: 1.5rem; }
.sz-bar .trk, .ly-bar .trk { flex: 1; height: 0.7rem; border-radius: 2px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.sz-bar .fill, .ly-bar .fill { display: block; height: 100%; border-radius: 2px; background: var(--text-2); min-width: 2px; }
.sz-bar b, .ly-bar b { min-width: 3.4rem; }
.sz-bar b, .ly-bar b { font-family: var(--mono); font-size: 0.8125rem; font-weight: 500; white-space: nowrap; }
.sz-dot { position: relative; height: 1.5rem; }
.sz-dot .axis { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-2); }
.sz-dot .dot {
  position: absolute; top: 50%;
  width: 0.8rem; height: 0.8rem; margin: -0.4rem 0 0 -0.4rem;
  border-radius: 50%;
  background: var(--text-2);
  border: 2px solid var(--bg-raised);
}
.sz-dot b {
  position: absolute; top: -0.95rem;
  transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500; white-space: nowrap;
}
.sz-row.champ .sz-name, .sz-row.champ b { color: var(--ai-text); }
.sz-row.champ .sz-bar .fill, .sz-row.champ .dot { background: var(--ai); }
.sz-row .sz-dot { margin-top: 0.7rem; }
.sz-ticks { position: relative; height: 1.1rem; }
.sz-ticks i, .ci-ticks i, .db-ticks i, .eq-t i, .ax-t i {
  position: absolute; top: 0;
  transform: translateX(-50%);
  font-family: var(--mono); font-style: normal; font-size: 0.75rem; color: var(--text-3); white-space: nowrap;
}
.sz-ticks i:first-child { transform: none; }
.sz-ticks i:last-child { transform: translateX(-100%); }
.ly-bar.lens .fill { background: var(--emph); }
.ly-row.low .ly-n { color: var(--text-3); }
@media (max-width: 520px) {
  .sz-head, .sz-row, .sz-foot, .ly-head, .ly-row { grid-template-columns: 3.6rem minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-3); }
  .ly-n { font-size: 0.75rem; }
}

/* ── Figure: the ceiling */
.ceiling { font-family: var(--sans); }
.ci-scale, .ci-row {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) 13rem 10rem;
  gap: var(--s-4);
  align-items: center;
}
.ci-scale { height: 1.2rem; }
.ci-ticks { position: relative; height: 100%; }
.ci-ticks i:first-child { transform: none; }
.ci-ticks i:last-child { transform: translateX(-100%); }
.ci-rows { list-style: none; margin: 0; padding: 0; }
.ci-row { padding: var(--s-3) 0; border-top: 1px solid var(--line); }
.ci-n { font-family: var(--mono); font-size: 0.875rem; color: var(--text-3); align-self: start; padding-top: 1px; }
.ci-what { font-size: var(--t-2); line-height: 1.45; }
.ci-what b { font-weight: 650; }
.ci-exp { font-family: var(--mono); font-size: 0.75rem; color: var(--text-3); margin-left: 0.3em; white-space: nowrap; }
.ci-desc { display: block; font-size: var(--t-1); color: var(--text-2); margin-top: 2px; }
.ci-res { font-family: var(--mono); font-size: 0.8125rem; font-weight: 500; line-height: 1.4; }
.ci-axis { position: relative; height: 1.75rem; border-radius: 4px; background: linear-gradient(var(--line-2), var(--line-2)) 0 50% / 100% 1px no-repeat; }
.ci-axis .mid { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--text-3); }
.ci-axis .wh {
  position: absolute; top: 50%; height: 0.7rem; margin-top: -0.35rem;
  border-left: 1.5px solid var(--text); border-right: 1.5px solid var(--text);
  background: linear-gradient(var(--text), var(--text)) 0 50% / 100% 1.5px no-repeat;
}
.ci-axis .pt, .ci-axis .pt.sm {
  position: absolute; top: 50%;
  width: 0.8rem; height: 0.8rem; margin: -0.4rem 0 0 -0.4rem;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg-raised);
}
.ci-axis .pt.sm { width: 0.5rem; height: 0.5rem; margin: -0.25rem 0 0 -0.25rem; background: var(--text-2); border: 0; }
.ci-axis .band { position: absolute; top: 50%; height: 0.9rem; margin-top: -0.45rem; background: color-mix(in srgb, var(--text) 10%, transparent); border-radius: 3px; }
.ci-axis.eq { background-color: color-mix(in srgb, var(--surface) 70%, transparent); }
.ci-axis .eq-t, .ci-axis .qual-t { position: absolute; left: 0; right: 0; top: 100%; height: 1rem; }
.ci-axis .eq-t i:first-child { transform: none; }
.ci-axis .eq-t i:last-child { transform: translateX(-100%); }
.ci-row:has(.eq) { padding-bottom: var(--s-5); }
.ci-axis.qual { background: none; }
.ci-axis .ax-t { display: none; position: absolute; left: 0; right: 0; top: 100%; height: 1rem; }
.ci-axis .ax-t i:first-child { transform: none; }
.ci-axis .ax-t i:last-child { transform: translateX(-100%); }
.ci-axis .qual-t { top: 50%; transform: translateY(-50%); height: auto; text-align: center; font-size: var(--t-1); color: var(--text-3); font-style: italic; }
.ci-axis.qual .mid { opacity: 0.4; }
@media (max-width: 820px) {
  .ci-scale { display: none; }
  .ci-row { grid-template-columns: 1.5rem minmax(0, 1fr); row-gap: var(--s-2); }
  .ci-axis, .ci-res { grid-column: 2; }
  .ci-axis .ax-t { display: block; }
  .ci-axis:not(.qual) { margin-bottom: 1.1rem; }
}

/* ── Figure: attention illustrations */
.studies { display: grid; gap: var(--s-4); }
.study {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--bg-raised);
}
.study-svg { width: 100%; height: auto; border-radius: 6px; }
.study .arc { fill: none; stroke-linecap: round; }
.study .arc.ai { stroke: var(--ai-deep); }
.study .arc.ink { stroke: var(--text-2); }
.study .arc.sec { stroke-dasharray: 4 4; opacity: 0.85; }
.mk-ai { fill: var(--ai-deep); }
.mk-ink { fill: var(--text-2); }
.study .piece { stroke: #fffdf8; stroke-width: 2; }
.study .piece.ai { fill: var(--ai); stroke: var(--ai-deep); stroke-width: 1.5; }
.study .piece.ink { fill: var(--text); stroke: #fffdf8; }
.study-t { font-family: var(--sans); font-size: var(--t-2); color: var(--text-2); line-height: 1.6; }
.study-tag { font-family: var(--mono); font-size: 0.75rem; color: var(--text-3); }
.study-t h3 { margin: var(--s-1) 0 var(--s-2); font-size: 1.5rem; line-height: 1.15; color: var(--text); }
@media (max-width: 640px) {
  .study { grid-template-columns: 1fr; padding: var(--s-4); }
  .study-svg { max-width: 15rem; }
}

/* ── Figure: V16 */
.v16 { font-family: var(--sans); }
.db-legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: var(--t-1); color: var(--text-2); padding-bottom: var(--s-4); border-bottom: 1px solid var(--line); }
.db-legend span { display: inline-flex; align-items: center; gap: 0.45em; }
.db-legend .db-pt { position: static; margin: 0; }
.panel-t { margin-top: var(--s-5); font-size: var(--t-2); font-weight: 650; }
.panel-t span { font-weight: 400; color: var(--text-3); font-size: var(--t-1); margin-left: 0.4em; }
.db-rows { list-style: none; margin: var(--s-2) 0 0; padding: 0; }
.db-row, .db-scale {
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr) 12.5rem;
  gap: var(--s-4);
  align-items: center;
}
.db-row { padding: var(--s-2) 0; border-top: 1px solid var(--line); }
.db-name { font-size: var(--t-2); }
.db-plot { position: relative; height: 1.6rem; background: linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat; }
.db-seg { position: absolute; top: 50%; height: 0; }
.db-seg.up { border-top: 2px solid var(--ai-deep); margin-top: -1px; }
.db-seg.down { border-top: 2px dotted var(--text-3); margin-top: -1px; }
.db-pt {
  position: absolute; top: 50%;
  display: inline-block;
  width: 0.8rem; height: 0.8rem; margin: -0.4rem 0 0 -0.4rem;
  border-radius: 50%;
  flex: none;
}
.db-pt.champ { background: var(--text); }
.db-pt.v16 { background: var(--ai); border: 1.5px solid var(--ai-deep); }
.db-pt.abl { background: var(--bg-raised); border: 2px solid var(--ai-deep); }
.db-vals { font-family: var(--mono); font-size: 0.8125rem; white-space: nowrap; }
.db-vals .c { color: var(--text); }
.db-vals .v { color: var(--ai-text); font-weight: 500; }
.db-vals .a { color: var(--text-3); }
.db-row.ctl .db-plot { opacity: 0.5; }
.db-row.ctl .db-name { color: var(--text-3); }
.db-row.ctl .db-vals { color: var(--text-3); }
.db-row.ctl .db-vals span { color: inherit; }
.db-scale { height: 1.2rem; border-top: 1px solid var(--line); padding-top: 4px; }
.db-ticks { position: relative; height: 100%; }
.db-ticks i:first-child { transform: none; }
.db-ticks i:last-child { transform: translateX(-100%); }
.beh { margin-top: var(--s-2); }
.beh-rows { list-style: none; margin: 0; padding: 0; }
.beh-row { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr) 12.5rem; gap: var(--s-4); align-items: center; padding: var(--s-2) 0; border-top: 1px solid var(--line); }
.beh-name { font-size: var(--t-2); }
.beh-plot { position: relative; height: 1.6rem; background: linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat; }
.beh-plot .start { position: absolute; top: 20%; bottom: 20%; width: 0; border-left: 1px dashed var(--text-3); }
.beh-plot .seg { position: absolute; top: 50%; height: 0; margin-top: -1px; border-top: 2px solid var(--ai-deep); }
.beh-plot .dot { position: absolute; top: 50%; width: 0.8rem; height: 0.8rem; margin: -0.4rem 0 0 -0.4rem; border-radius: 50%; background: var(--ai); border: 1.5px solid var(--ai-deep); }
.beh-row.champ .seg { border-top-color: var(--text); }
.beh-row.champ .dot { background: var(--text); border-color: var(--text); }
.beh-val { font-family: var(--mono); font-size: 0.8125rem; }
.beh-val .d { color: var(--text-3); margin-left: 0.5em; }
@media (max-width: 700px) {
  .db-row, .db-scale, .beh-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .db-plot, .beh-plot { grid-column: 1 / -1; grid-row: 2; }
  .db-scale { grid-template-columns: 1fr; }
  .db-scale > span:not(.db-ticks) { display: none; }
  .db-name, .beh-name { font-size: var(--t-1); }
}

/* ── Lessons */
.prose .lessons { list-style: none; padding: 0; display: grid; gap: var(--s-4); }
.prose .lessons li + li { margin-top: 0; }
.lesson {
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.lesson h3 { font-size: 1.5rem; line-height: 1.15; margin-top: var(--s-2); }
.lesson p { margin-top: var(--s-2); font-size: 1.0625rem; }
.lesson .lz-c { font-family: var(--sans); font-size: var(--t-2); color: var(--text-2); padding-top: var(--s-2); border-top: 1px solid var(--line); margin-top: var(--s-3); }
.lz { font-family: var(--sans); font-size: 0.75rem; font-weight: 650; letter-spacing: 0.02em; }
.lz::before { content: ''; display: inline-block; width: 0.5em; height: 0.5em; border-radius: 50%; margin-right: 0.45em; vertical-align: 0.05em; background: currentColor; }
.lz.failed { color: var(--text-2); }
.lz.failed::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.lz.revised { color: var(--emph); }
.lz.worked { color: var(--text); }

/* ── Bug log */
.prose .buglog { list-style: none; padding: 0; border-left: 2px solid color-mix(in srgb, var(--alarm) 55%, transparent); }
.prose .buglog li + li { margin-top: 0; }
.bug { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: var(--s-2); padding: var(--s-4) 0 var(--s-4) var(--s-4); }
.bug + .bug { border-top: 1px solid var(--line); }
.bug-n { font-family: var(--mono); font-size: 0.875rem; color: #a63b28; padding-top: 0.2rem; }
.prose .bug h3 { font-size: 1.5rem; line-height: 1.15; margin-top: 0; }
.bug p { margin-top: var(--s-2); font-size: 1.0625rem; }
.bug .src { display: block; margin-top: var(--s-2); }

/* ── Prior work */
.prose .prior { list-style: none; padding: 0; }
.prose .prior li + li { margin-top: 0; }
.pw { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); gap: var(--s-4); padding: var(--s-5) 0; border-top: 1px solid var(--line); }
.pw-year { font-family: var(--mono); font-size: 0.9375rem; color: var(--text-2); padding-top: 0.2rem; }
.pw-tag { font-family: var(--sans); font-size: 0.75rem; font-weight: 650; color: var(--text-3); letter-spacing: 0.02em; }
.pw h3 { margin-top: 2px; font-size: 1.625rem; line-height: 1.1; }
.pw-by { font-family: var(--sans); font-size: var(--t-2); font-weight: 450; color: var(--text-2); letter-spacing: 0; }
.pw-body > p:not(.pw-tag) { margin-top: var(--s-2); font-size: 1.0625rem; }
.pw-body > p.pw-cite { font-family: var(--sans); font-size: var(--t-2); color: var(--text-2); }
.pw-cite a { color: var(--text-2); }
.pw.self { border-bottom: 1px solid var(--line); }
.pw.self .pw-tag, .pw.self .pw-year { color: var(--ai-text); }
.also { font-family: var(--sans); font-size: var(--t-2); color: var(--text-2); }

.film { margin-top: var(--s-4); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: var(--night-1); }
.film iframe { display: block; width: 100%; height: 100%; border: 0; }
.prose .film-facade, .film-facade {
  position: relative;
  display: grid;
  align-content: end;
  gap: var(--s-1);
  height: 100%;
  padding: var(--s-5);
  color: var(--cream);
  text-decoration: none;
  font-family: var(--sans);
  line-height: 1.4;
  background:
    radial-gradient(circle at 50% 42%, rgba(244, 234, 219, 0.08), transparent 55%),
    repeating-linear-gradient(0deg, rgba(244, 234, 219, 0.07) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(244, 234, 219, 0.07) 0 1px, transparent 1px 28px),
    var(--night-1);
}
.film-play {
  position: absolute;
  left: var(--s-5); top: var(--s-5);
  width: 3.75rem; height: 3.75rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink-0);
  transition: transform 0.2s var(--ease-out);
}
.film-play svg { width: 1.7rem; height: 1.7rem; fill: currentColor; margin-left: 4px; }
@media (max-width: 520px) {
  .prose .film-facade { padding: var(--s-4); }
  .film-play { left: var(--s-4); top: var(--s-4); width: 3rem; height: 3rem; }
  .film-play svg { width: 1.35rem; height: 1.35rem; }
  .film-t { font-size: var(--t-3); }
}
.prose .film-facade:hover { text-decoration: none; }
.film-facade:hover .film-play { transform: scale(1.06); }
.film-facade:focus-visible { outline-offset: -4px; outline-color: var(--cream); }
.film-t { font-family: var(--serif); font-size: 1.625rem; font-weight: 400; line-height: 1.1; }
.film-k { font-size: var(--t-1); color: rgba(244, 234, 219, 0.75); }

/* ── Status */
.status { display: grid; gap: var(--s-4); font-family: var(--sans); font-size: var(--t-2); }
.st { padding: var(--s-4) var(--s-5); border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); }
.prose .st h3 { margin-top: 0; }
.st h3 { font-family: var(--sans); font-size: var(--t-1); font-weight: 650; letter-spacing: 0.02em; color: var(--text-3); }
.st ul { margin-top: var(--s-2); padding-left: 1.1em; color: var(--text-2); }
.st li + li { margin-top: var(--s-2); }
.st b { color: var(--text); font-weight: 650; }
.st.settled { border-left: 3px solid var(--text-2); }
.st.parked { border-left: 3px solid var(--line-2); }
.st.open { border-left: 3px solid var(--emph); }

/* ── Citation */
.cite-plain { font-family: var(--sans); font-size: var(--t-2); color: var(--text-2); }
.cite-box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); overflow: hidden; }
.cite-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 2.75rem; padding: var(--s-1) var(--s-2) var(--s-1) var(--s-5);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.75rem; color: var(--text-3);
}
.cite-box pre {
  margin: 0;
  padding: var(--s-4) var(--s-5);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}
.cite-box pre code { font-size: inherit; padding: 0; background: none; }
.copy-btn { min-height: 36px; font-size: var(--t-1); padding: 0 0.9em; }
.cite-box pre:focus-visible { outline-offset: -3px; }
@media (max-width: 520px) { .cite-box pre { padding: var(--s-4); } }

/* ── Phones */
@media (max-width: 560px) {
  .research { --fig-pad: var(--s-3); }
  .research .fig-frame { border-radius: var(--radius); }
  .lesson, .st { padding: var(--s-4); }
  .pw { grid-template-columns: 1fr; gap: var(--s-1); }
  .bug { padding-left: var(--s-3); grid-template-columns: 2rem minmax(0, 1fr); }
  .research-head .doc-meta { gap: var(--s-3) var(--s-5); }
}

/* ── Print */
@media print {
  .sitebar, .toc, .sitefoot, .next, .skip-link, .copy-btn, .film { display: none !important; }
  body { background: #fff; }
  .doc-head { padding: 0 0 1rem; background: none; }
  .doc { display: block; padding: 0; }
  .fig.bleed { margin-right: 0 !important; }
  .fig, .study, .lesson, .bug, .era, .ci-row, .st { break-inside: avoid; }
  .prose h2 { break-after: avoid; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.75em; color: #555; overflow-wrap: anywhere; }
  .fig-frame, .study, .lesson, .st, .note, .callout { background: #fff; }
}

/* Below 1100px the contents pill sits under the site bar, so a jump to a
   section has to clear both. */
@media (max-width: 1100px) {
  html { scroll-padding-top: calc(var(--bar-h) + 4.5rem); }
  .research .prose h2 { scroll-margin-top: calc(var(--bar-h) + 4.5rem); }
}
