/* ============================================================
   The mIF Playbook — distill / ultra-scale-playbook layout
   Three columns: [sticky TOC] · [centered content] · [margin notes]
   Restrained, near-monochrome chrome. Color lives only in the
   data visualizations, not in the prose furniture.
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f6f3;
  --bg-elev: #fbfaf8;
  --ink: #1b1b1b;
  --ink-soft: #41414a;
  --ink-faint: #8a8a92;
  --rule: #e9e7e1;
  --rule-strong: #d4d2ca;
  --accent: #2b6cb0;          /* the single accent — links, active TOC */

  /* marker channel palette — used ONLY inside visualizations */
  --dapi: #3aa0ff;
  --tumor: #e0507f;
  --cd8: #28b673;
  --cd68: #e69a1f;
  --stroma: #17a8a8;
  --pd1: #e8623a;
  --ki67: #a85fe0;

  --content: 780px;
  --toc-w: 210px;
  --note-w: 218px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

html[data-theme="dark"] {
  --bg: #0f1115;
  --bg-soft: #161922;
  --bg-elev: #161922;
  --ink: #e7e8ea;
  --ink-soft: #b3b6be;
  --ink-faint: #777b85;
  --rule: #242833;
  --rule-strong: #333845;
  --accent: #6fa8e6;
}

/* ============================================================
   Figure palette — read by the PXR post's inline SVG figures
   (pxr.js) via getComputedStyle so diagrams re-theme with the
   light / dark toggle. Kept separate from the marker channel
   palette above, which belongs to the mIF canvases only.
   ============================================================ */
:root {
  --fig-panel: #f4f2ec;
  --fig-ink: #1b1b1b;
  --fig-mut: #7c7d86;
  --fig-line: #d4d2ca;
  --fig-accent: #2b6cb0;
  --fig-accent2: #6d5cd6;
  --fig-good: #1f9d6b;
  --fig-bad: #cf5b34;
  --fig-warn: #b4831a;
}
html[data-theme="dark"] {
  --fig-panel: #171b24;
  --fig-ink: #e9eef3;
  --fig-mut: #8a95a3;
  --fig-line: #313846;
  --fig-accent: #5db2ff;
  --fig-accent2: #8a7bff;
  --fig-good: #4ec9a3;
  --fig-bad: #e6825f;
  --fig-warn: #e8c35b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--accent); z-index: 100; transition: width .08s linear;
}

/* ---------------- hero ---------------- */
header.hero {
  max-width: 820px; margin: 0 auto; padding: 72px 24px 22px; text-align: center;
}
.eyebrow {
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 20px;
}
header.hero h1 {
  font-size: clamp(34px, 5vw, 56px); line-height: 1.08; letter-spacing: -.015em;
  margin: 0 0 18px; font-weight: 600;
}
header.hero .sub {
  font-size: clamp(17px, 2.2vw, 21px); color: var(--ink-soft);
  max-width: 680px; margin: 0 auto 24px; line-height: 1.5;
}
.byline {
  font-family: var(--sans); font-size: 13.5px; color: var(--ink-faint);
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; align-items: center;
}
.byline .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-faint); }
.byline a { color: var(--accent); text-decoration: none; }

.hero-figure { max-width: 1080px; margin: 28px auto 0; padding: 0 24px; }
.hero-figure canvas {
  width: 100%; height: 300px; border-radius: 10px; background: #05070d; display: block;
  border: 1px solid var(--rule);
}
.hero-figure .cap {
  font-family: var(--sans); font-size: 12.5px; color: var(--ink-faint);
  text-align: center; margin-top: 10px;
}

/* ---------------- 3-column page ---------------- */
.page {
  max-width: 1380px; margin: 36px auto 0; padding: 0 32px;
  display: grid; grid-template-columns: var(--toc-w) minmax(0, 1fr); column-gap: 52px;
  align-items: start;
}

/* TOC */
nav.toc {
  position: sticky; top: 68px; font-family: var(--sans); font-size: 13px;
  max-height: calc(100vh - 92px); overflow-y: auto; padding-right: 6px;
}
nav.toc .toc-title {
  text-transform: uppercase; letter-spacing: .13em; font-size: 10.5px;
  color: var(--ink-faint); font-weight: 700; margin-bottom: 12px;
}
nav.toc ol { list-style: none; margin: 0; padding: 0; }
nav.toc li { margin: 1px 0; }
nav.toc a {
  display: block; color: var(--ink-soft); text-decoration: none; line-height: 1.35;
  padding: 4px 10px; border-left: 2px solid transparent; transition: color .12s, border-color .12s;
}
nav.toc a:hover { color: var(--ink); }
nav.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
nav.toc a.sub { padding-left: 22px; font-size: 12px; color: var(--ink-faint); }

/* ---------------- article (inner grid: text | gap | notes) ---------------- */
article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px var(--note-w);
  align-items: start;
}
article > * { grid-column: 1; min-width: 0; }
article > .margin-note { grid-column: 3; }
/* figures align to the main content column (same width as body text).
   add .bleed to a figure to span into the right note-gutter instead. */
article > figure.wide, article > .fig-block { grid-column: 1; }
article > figure.bleed { grid-column: 1 / -1; }

article p { margin: 18px 0; }
article > p:first-child { margin-top: 0; }

/* headings — monochrome, distill-like with hairline rule */
.kicker {
  grid-column: 1; font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
  margin: 60px 0 0; display: block;
}
article h2 {
  font-size: 27px; line-height: 1.2; letter-spacing: -.01em; font-weight: 600;
  margin: 8px 0 4px; padding-bottom: 10px; border-bottom: 1px solid var(--rule);
  scroll-margin-top: 64px;
}
article h3 { scroll-margin-top: 64px; }
article :where(p, ul, ol, figure, div, details)[id] { scroll-margin-top: 64px; }
.kicker + h2 { margin-top: 8px; }
article h3 { font-size: 20px; font-weight: 600; margin: 34px 0 2px; }

article a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
article a:hover { border-bottom-color: var(--accent); }
article strong { font-weight: 600; }
article em { font-style: italic; color: var(--ink-soft); }

ul, ol { padding-left: 22px; }
li { margin: 7px 0; }

code {
  font-family: var(--mono); font-size: .8em; background: var(--bg-soft);
  padding: 1px 5px; border-radius: 4px; border: 1px solid var(--rule);
}
pre {
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  background: var(--bg-soft); border: 1px solid var(--rule);
  border-radius: 8px; padding: 14px 16px; overflow-x: auto;
}
pre code { background: none; border: none; padding: 0; }

/* blockquote — distill style */
blockquote {
  margin: 26px 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--rule-strong);
  color: var(--ink-soft); font-size: 18px; line-height: 1.55;
}
blockquote p { margin: 8px 0; }
blockquote cite {
  display: block; font-family: var(--sans); font-size: 13px; font-style: normal;
  color: var(--ink-faint); margin-top: 8px;
}

/* ONE restrained note style (no rainbow) */
.note {
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  background: var(--bg-soft); border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  border-radius: 6px; padding: 16px 18px; margin: 26px 0;
}
.note.key { border-left-color: var(--accent); }
.note .label {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 7px;
}
.note.key .label { color: var(--accent); }
.note p { margin: 10px 0; }
.note p:first-of-type { margin-top: 0; }
.note p:last-child { margin-bottom: 0; }

/* plain-language primer: ADMET glossary + the PXR cause-effect chain */
.admet-defs { font-family: var(--sans); font-size: 14px; margin: 12px 0 4px; display: grid; gap: 7px; }
.admet-defs .d { display: flex; gap: 10px; align-items: baseline; line-height: 1.5; }
.admet-defs .d b { flex: 0 0 auto; color: var(--ink); font-weight: 700; min-width: 104px; }
.admet-defs .d b i { color: var(--accent); font-style: normal; }
.admet-defs .d span { color: var(--ink-soft); }
.chain {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  font-family: var(--sans); font-size: 13px; margin: 14px 0 6px;
}
.chain .step {
  background: var(--bg); border: 1px solid var(--rule-strong); border-radius: 6px;
  padding: 7px 11px; color: var(--ink); line-height: 1.35;
}
.chain .step b { color: var(--accent); }
.chain .arr { color: var(--ink-faint); font-weight: 700; }
@media (max-width: 640px) { .chain { flex-direction: column; align-items: stretch; } .chain .arr { text-align: center; } }

/* collapsible background primer (details/summary) */
details.primer {
  margin: 26px 0; background: var(--bg-soft); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent); border-radius: 6px; padding: 0;
}
details.primer > summary {
  list-style: none; cursor: pointer; padding: 14px 18px;
  font-family: var(--sans); font-size: 14px; font-weight: 650; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
details.primer > summary::-webkit-details-marker { display: none; }
details.primer > summary .tw {
  color: var(--accent); font-weight: 700; transition: transform .15s ease;
  display: inline-block; font-size: 12px;
}
details.primer[open] > summary .tw { transform: rotate(90deg); }
details.primer > summary .hint { color: var(--ink-faint); font-weight: 400; font-size: 12.5px; }
details.primer > .primer-body { padding: 2px 18px 16px; }
details.primer > .primer-body > p { font-family: var(--sans); font-size: 14.5px; line-height: 1.55; margin: 12px 0; }
details.primer h4 {
  font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: .05em; margin: 20px 0 6px;
}
details.primer h4:first-of-type { margin-top: 8px; }

/* centered formula block (e.g. pEC50 definition) */
.formula {
  font-family: var(--mono); font-size: 15px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 6px;
  padding: 14px 18px; margin: 18px 0; text-align: center; overflow-x: auto;
}
.formula .sub { font-size: .75em; vertical-align: -.25em; }
.formula .note { display: block; font-family: var(--sans); font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; }

/* phased list (Phase 1 / Phase 2) */
ul.phases { list-style: none; padding: 0; margin: 16px 0; font-family: var(--sans); }
ul.phases li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
ul.phases li:last-child { border-bottom: none; }
ul.phases .ph {
  flex: 0 0 auto; min-width: 74px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule)); border-radius: 4px;
  padding: 3px 8px; text-align: center;
}
ul.phases .px { color: var(--ink-soft); line-height: 1.5; font-size: 14.5px; }
ul.phases .px b { color: var(--ink); font-weight: 650; }

/* breakthrough-spine ladder: RAE score pills instead of phase labels */
ul.phases.bt-ladder .ph {
  min-width: 62px; font-family: var(--mono); font-size: 12.5px; letter-spacing: 0;
  text-transform: none; color: var(--fig-good);
  background: color-mix(in srgb, var(--fig-good) 12%, transparent);
  border-color: color-mix(in srgb, var(--fig-good) 35%, var(--rule));
}
ul.phases.bt-ladder li:last-child .ph {
  color: var(--bg); background: var(--fig-good);
  border-color: var(--fig-good); font-weight: 700;
}

/* margin notes (right gutter) */
.margin-note {
  font-family: var(--sans); font-size: 12.5px; line-height: 1.5; color: var(--ink-faint);
  border-left: 2px solid var(--rule-strong); padding-left: 12px; margin: 18px 0;
}
.margin-note .mn-label {
  display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 5px;
}
.margin-note a { color: var(--accent); text-decoration: none; }

/* ---------------- figures ---------------- */
figure.wide {
  margin: 36px 0; background: var(--bg-elev); border: 1px solid var(--rule);
  border-radius: 10px; padding: 20px;
}
.fig-head {
  font-family: var(--sans); display: flex; justify-content: space-between;
  align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.fig-head .fig-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.fig-head .fig-tag {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-faint); border: 1px solid var(--rule-strong); padding: 2px 8px; border-radius: 4px;
}
figure.wide figcaption {
  font-family: var(--sans); font-size: 13px; color: var(--ink-faint);
  margin-top: 12px; line-height: 1.5;
}
figure.wide figcaption b { color: var(--ink-soft); font-weight: 600; }

.controls {
  font-family: var(--sans); display: flex; flex-wrap: wrap; gap: 10px 18px;
  align-items: center; margin: 2px 0 14px; font-size: 13px;
}
.controls .group { display: flex; align-items: center; gap: 8px; }
.controls label { color: var(--ink-soft); user-select: none; }
.chip {
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  border: 1px solid var(--rule-strong); background: var(--bg); color: var(--ink-soft);
  padding: 4px 10px; border-radius: 5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all .12s; user-select: none;
}
.chip .swatch { width: 9px; height: 9px; border-radius: 2px; }
.chip.on { color: var(--ink); border-color: var(--ink-faint); font-weight: 600; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 3px; border-radius: 3px;
  background: var(--rule-strong); outline: none; cursor: pointer; width: 140px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer;
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; }
.val { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); min-width: 42px; }

.toggle-pill { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 5px; overflow: hidden; }
.toggle-pill button {
  font-family: var(--sans); font-size: 12px; font-weight: 500; border: none;
  background: var(--bg); color: var(--ink-soft); padding: 5px 12px; cursor: pointer;
}
.toggle-pill button.on { background: var(--ink); color: var(--bg); }

.canvas-wrap { position: relative; }
figure.wide canvas { display: block; width: 100%; border-radius: 6px; background: #05070d; }
canvas.light-canvas { background: var(--bg-soft); }

.readout { font-family: var(--sans); display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stat { background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 6px; padding: 9px 13px; min-width: 110px; }
.stat .k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 700; }
.stat .v { font-size: 20px; font-weight: 700; font-family: var(--sans); margin-top: 2px; }
.stat .v small { font-size: 12px; font-weight: 600; color: var(--ink-faint); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.legend { font-family: var(--sans); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* tables — distill style */
table.data { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 13.5px; margin: 24px 0; }
table.data th {
  text-align: left; padding: 8px 12px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-faint); font-weight: 700;
  border-bottom: 2px solid var(--rule-strong);
}
table.data td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); color: var(--ink-soft); }
table.data td:first-child { color: var(--ink); }

.mk { display: inline-flex; align-items: center; gap: 4px; font-family: var(--sans); font-size: .82em; font-weight: 600; }
.mk i { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- IHC vs mIF toggle diagram ---------- */
.compare-canvas { height: 300px; }

/* ---------- advantages grid ---------- */
.adv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
@media (max-width: 640px) { .adv-grid { grid-template-columns: 1fr; } }
.adv-card {
  font-family: var(--sans); background: var(--bg-soft); border: 1px solid var(--rule);
  border-radius: 8px; padding: 14px 15px;
}
.adv-card .ico { font-size: 18px; margin-bottom: 6px; display: block; }
.adv-card .t { font-size: 13.5px; font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.adv-card .d { font-size: 12.5px; color: var(--ink-faint); line-height: 1.45; }

/* ---------- biological findings list ---------- */
.bio-list { list-style: none; padding: 0; margin: 20px 0; font-family: var(--sans); font-size: 14.5px; }
.bio-list li {
  display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); align-items: flex-start;
}
.bio-list li:last-child { border-bottom: none; }
.bio-list .badge {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-soft); background: var(--bg-soft); border: 1px solid var(--rule-strong);
  border-radius: 4px; padding: 3px 8px; margin-top: 1px; min-width: 86px; text-align: center;
}
.bio-list .bx { color: var(--ink-soft); line-height: 1.5; }
.bio-list .bx b { color: var(--ink); }

/* ---------- technology comparison bar chart ---------- */
.tech-tools { font-family: var(--sans); }
.tech-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; margin: 7px 0; cursor: default; }
.tech-row .name { font-size: 13px; font-weight: 600; color: var(--ink); }
.tech-row .name small { display: block; font-size: 10.5px; font-weight: 500; color: var(--ink-faint); }
.tech-bar-track { position: relative; height: 22px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; }
.tech-bar-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.2,.7,.2,1); }
.tech-bar-val { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11.5px; font-weight: 700; color: var(--ink); font-family: var(--mono); }
.tech-row:hover .tech-bar-fill { filter: brightness(1.08); }
.tech-row.dim { opacity: .4; }

/* ---------- timeline ---------- */
.timeline { position: relative; font-family: var(--sans); padding: 8px 0 4px; }
.tl-track { position: relative; height: 2px; background: var(--rule-strong); margin: 60px 6px 18px; }
.tl-node {
  position: absolute; top: 50%; transform: translate(-50%, -50%); width: 13px; height: 13px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--ink-faint); cursor: pointer;
  transition: all .15s;
}
.tl-node:hover, .tl-node.on { border-color: var(--accent); background: var(--accent); transform: translate(-50%,-50%) scale(1.25); }
.tl-label {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 600; color: var(--ink-soft); white-space: nowrap;
}
.tl-year { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--ink-faint); font-family: var(--mono); }
.tl-detail { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; margin-top: 14px; background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 8px; padding: 16px; }
@media (max-width: 640px) { .tl-detail { grid-template-columns: 1fr; } }
.tl-detail canvas, .tl-detail img { width: 280px; height: 170px; object-fit: cover; background: #05070d; border-radius: 6px; display: block; }
@media (max-width: 640px) { .tl-detail img { width: 100%; } }

/* real micrograph images */
.real-img { width: 100%; max-height: 460px; object-fit: cover; display: block; border-radius: 8px; background: #05070d; }
.tl-detail .td-body h4 { font-family: var(--sans); margin: 0 0 4px; font-size: 15px; }
.tl-detail .td-body .meta { font-size: 11.5px; color: var(--ink-faint); font-family: var(--mono); margin-bottom: 8px; }
.tl-detail .td-body p { font-size: 13.5px; color: var(--ink-soft); margin: 0; line-height: 1.5; }

/* ---------- study explorer ---------- */
.study-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; font-family: var(--sans); }
.study-tab {
  font-size: 12.5px; font-weight: 600; border: 1px solid var(--rule-strong); background: var(--bg);
  color: var(--ink-soft); padding: 7px 13px; border-radius: 6px; cursor: pointer; transition: all .12s;
}
.study-tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.study-panel { font-family: var(--sans); }
.study-panel .sp-head { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: baseline; margin-bottom: 8px; }
.study-panel .sp-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.study-panel .sp-meta { font-size: 11.5px; color: var(--ink-faint); font-family: var(--mono); }
.study-panel .sp-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.55; margin: 8px 0 14px; }
.study-panel .sp-finding { font-size: 13.5px; color: var(--ink-soft); background: var(--bg-soft); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; padding: 10px 14px; margin-bottom: 14px; }
.sp-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sp-step {
  font-size: 11.5px; font-weight: 600; background: var(--bg); border: 1px solid var(--rule-strong);
  color: var(--ink-soft); padding: 6px 10px; border-radius: 6px; white-space: nowrap;
}
.sp-step code { font-size: 11px; background: none; border: none; padding: 0; color: var(--accent); }
.sp-arrow { color: var(--ink-faint); font-size: 13px; }

/* ---------- WSI viewer ---------- */
.wsi-wrap { position: relative; }
.wsi-canvas { height: 460px; cursor: grab; }
.wsi-canvas:active { cursor: grabbing; }
.wsi-hud {
  position: absolute; top: 12px; left: 12px; font-family: var(--mono); font-size: 11px;
  background: rgba(8,10,16,.7); color: #fff; padding: 5px 9px; border-radius: 5px; pointer-events: none;
}
.wsi-controls { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; }
.wsi-controls button {
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(8,10,16,.75); color: #fff; font-size: 17px; cursor: pointer; line-height: 1;
}
.wsi-controls button:hover { background: rgba(40,45,60,.9); }
.wsi-scalebar {
  position: absolute; bottom: 14px; left: 14px; font-family: var(--sans); font-size: 10.5px; color: #fff;
  text-align: center; pointer-events: none;
}
.wsi-scalebar .bar { height: 4px; background: #fff; border-radius: 1px; margin-top: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.wsi-mini {
  position: absolute; bottom: 14px; right: 14px; width: 120px; height: 78px; border: 1px solid rgba(255,255,255,.35);
  border-radius: 4px; overflow: hidden;
}
.wsi-mini canvas { width: 100%; height: 100%; display: block; }
.wsi-mini .vp { position: absolute; border: 1.5px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }

/* footer */
footer { max-width: 760px; margin: 70px auto 60px; padding: 0 24px; font-family: var(--sans); }
footer h2 { font-family: var(--serif); font-size: 24px; font-weight: 600; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.refs { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); padding-left: 20px; }
.refs li { margin: 9px 0; }
.refs a { color: var(--accent); text-decoration: none; }

#theme-toggle {
  position: fixed; right: 16px; bottom: 16px; z-index: 90; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--rule-strong); background: var(--bg-elev);
  color: var(--ink); cursor: pointer; font-size: 16px; display: grid; place-items: center;
}

.tooltip {
  position: fixed; pointer-events: none; z-index: 200; background: rgba(15,17,21,.96); color: #fff;
  font-family: var(--sans); font-size: 12px; padding: 8px 11px; border-radius: 6px; opacity: 0;
  transition: opacity .1s; max-width: 230px; line-height: 1.45;
}

/* ---------------- responsive ---------------- */
@media (max-width: 1140px) {
  .page { grid-template-columns: 1fr; }
  nav.toc { display: none; }
  article { display: block; max-width: 760px; margin: 0 auto; }
  .margin-note {
    background: var(--bg-soft); border: 1px solid var(--rule); border-left: 3px solid var(--rule-strong);
    border-radius: 6px; padding: 12px 14px;
  }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  header.hero { padding-top: 44px; }
}

/* ============================================================
   SHARED SITE CHROME — top bar linking the playbook posts.
   Used on the landing page and on top of every article.
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 80;
  display: flex; align-items: center; gap: 20px;
  padding: 11px 26px; font-family: var(--sans);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-nav .brand {
  font-weight: 700; font-size: 14px; letter-spacing: -.01em; color: var(--ink);
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.site-nav .brand .mark {
  width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
}
.site-nav .links { display: flex; gap: 4px; margin-left: 6px; flex-wrap: wrap; }
.site-nav .links a {
  font-size: 13px; font-weight: 500; color: var(--ink-soft); text-decoration: none;
  padding: 5px 11px; border-radius: 6px; transition: background .12s, color .12s;
}
.site-nav .links a:hover { background: var(--bg-soft); color: var(--ink); }
.site-nav .links a.current { color: var(--accent); font-weight: 600; }
.site-nav .spacer { flex: 1; }
.site-nav .ghost {
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft); text-decoration: none;
  border: 1px solid var(--rule-strong); padding: 5px 12px; border-radius: 6px;
}
.site-nav .ghost:hover { border-color: var(--ink-faint); color: var(--ink); }
@media (max-width: 600px) { .site-nav { padding: 9px 16px; gap: 12px; } .site-nav .ghost { display: none; } }

/* ============================================================
   LANDING PAGE — index of playbook posts
   ============================================================ */
.landing { max-width: 1000px; margin: 0 auto; padding: 74px 26px 40px; }
.landing .eyebrow { margin-bottom: 18px; }
.landing h1 {
  font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -.018em;
  font-weight: 600; margin: 0 0 18px; max-width: 760px;
}
.landing .lede { font-size: clamp(17px, 2.1vw, 20px); color: var(--ink-soft); max-width: 680px; line-height: 1.5; margin: 0 0 44px; }
.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (max-width: 760px) { .post-grid { grid-template-columns: 1fr; } }
.post-card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--bg-elev); border: 1px solid var(--rule); border-radius: 14px;
  overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.post-card:hover { border-color: var(--rule-strong); transform: translateY(-2px); box-shadow: 0 12px 34px -22px rgba(0,0,0,.5); }
.post-card .thumb { height: 150px; position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.post-card .thumb canvas { width: 100%; height: 100%; display: block; }
.post-card .body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.post-card .tag {
  font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
.post-card h2 { font-family: var(--serif); font-size: 22px; line-height: 1.22; font-weight: 600; margin: 0 0 8px; border: none; padding: 0; }
.post-card p { font-family: var(--sans); font-size: 14px; color: var(--ink-faint); line-height: 1.55; margin: 0 0 16px; }
.post-card .meta {
  font-family: var(--sans); font-size: 12px; color: var(--ink-faint); margin-top: auto;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.post-card .meta .go { margin-left: auto; color: var(--accent); font-weight: 600; }
.landing .foot-note { font-family: var(--sans); font-size: 12.5px; color: var(--ink-faint); margin-top: 46px; line-height: 1.6; }

/* ============================================================
   PXR POST — components not present in the mIF post
   ============================================================ */
/* lede metric band */
.metric-band { display: flex; gap: 14px; flex-wrap: wrap; margin: 30px 0 6px; }
.metric-band .m {
  flex: 1; min-width: 150px; background: var(--bg-soft); border: 1px solid var(--rule);
  border-radius: 10px; padding: 14px 18px;
}
.metric-band .m .v { font-family: var(--sans); font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric-band .m .k { font-family: var(--sans); font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; line-height: 1.4; }

/* process / ladder step list */
.proc { margin: 22px 0; border-top: 1px solid var(--rule); }
.proc .row { display: flex; gap: 16px; padding: 13px 2px; border-bottom: 1px solid var(--rule); }
.proc .row .n {
  flex: 0 0 104px; font-family: var(--sans); font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; font-size: 13.5px; padding-top: 1px;
}
.proc .row .t { font-family: var(--sans); font-weight: 650; font-size: 14.5px; color: var(--ink); }
.proc .row .d { font-family: var(--sans); color: var(--ink-faint); font-size: 13.5px; margin-top: 2px; line-height: 1.5; }
.proc .row .b { min-width: 0; }
.tagpill {
  display: inline-block; font-family: var(--sans); font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 20px; background: var(--bg-soft); color: var(--ink-faint);
  border: 1px solid var(--rule-strong); margin-left: 6px; vertical-align: 1px;
}
.tagpill.good { color: var(--fig-good); border-color: color-mix(in srgb, var(--fig-good) 45%, var(--rule)); }
.tagpill.warn { color: var(--fig-warn); border-color: color-mix(in srgb, var(--fig-warn) 45%, var(--rule)); }
.tagpill.bad { color: var(--fig-bad); border-color: color-mix(in srgb, var(--fig-bad) 45%, var(--rule)); }
.tagpill.mut { color: var(--ink-faint); border-color: var(--rule-strong); }

/* plain SVG figure block (distinct from the interactive figure.wide) */
figure.svgfig {
  margin: 32px 0; background: var(--bg-elev); border: 1px solid var(--rule);
  border-radius: 10px; padding: 20px 20px 8px;
}
figure.svgfig svg { width: 100%; height: auto; display: block; }
figure.svgfig img { width: 100%; border-radius: 8px; display: block; border: 1px solid var(--rule); }
figure.svgfig figcaption {
  font-family: var(--sans); font-size: 13px; color: var(--ink-faint);
  line-height: 1.5; padding: 12px 4px 4px;
}
figure.svgfig figcaption b { color: var(--ink-soft); font-weight: 600; }
/* inline legend under a chart (e.g. the pEC50 histogram series key) */
figure.svgfig .fig-legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--sans);
  font-size: 12.5px; color: var(--ink-faint); padding: 6px 4px 0;
}
figure.svgfig .fig-legend .lg { display: inline-flex; align-items: center; gap: 7px; }
figure.svgfig .fig-legend .lg .sw { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

/* breakout figure — breaks out of the content column into the full page width.
   Use on screenshots / UI captures that need to be read at full size. */
figure.breakout {
  /* bleed only into the right margin-note gutter. We deliberately do NOT
     use a negative left margin here: the page-level sticky TOC lives in
     that column, and a tall figure (e.g. the interactive tree) would
     slide over it. Spanning 1 / -1 already gives the content column plus
     the note gutter — wide enough for the tree without touching the TOC. */
  grid-column: 1 / -1;
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}
@media (max-width: 1140px) {
  figure.breakout { margin-left: 0; grid-column: unset; }
}
.imgph {
  display: none; align-items: center; justify-content: center; min-height: 220px;
  background: var(--bg-soft); border: 1px dashed var(--rule-strong); border-radius: 8px;
  color: var(--ink-faint); font-family: var(--sans); font-size: 13px; text-align: center;
  padding: 24px; line-height: 1.5;
}

/* right-aligned numeric table cells for the PXR data tables */
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   Interactive search-tree figure (the real PXR run)
   Two-pane: pannable/zoomable tree canvas + a node detail panel,
   modeled on the Discovery "Hierarchy View".
   ============================================================ */
.treefig { position: relative; }
.tree-toolbar {
  font-family: var(--sans); display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 14px; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-faint);
}
.tree-toolbar .tt-stat { color: var(--ink-soft); }
.tree-toolbar .tt-stat b { color: var(--ink); font-weight: 700; }
.tree-toolbar .tt-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-left: auto; }
.tree-toolbar .lg { display: inline-flex; align-items: center; gap: 5px; }
.tree-toolbar .lg .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tree-toolbar .lg .swline { width: 14px; height: 0; border-top: 2px dashed currentColor; display: inline-block; }

.tree-stage {
  position: relative; display: grid; grid-template-columns: 1fr; gap: 0;
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden;
  background: var(--bg-soft);
}
.tree-stage.has-panel { grid-template-columns: minmax(0,1fr) 322px; }
@media (max-width: 720px) { .tree-stage.has-panel { grid-template-columns: 1fr; } }

.tree-viewport {
  position: relative; height: 600px; overflow: hidden; cursor: grab;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink-faint) 20%, transparent) 1px, transparent 0);
  background-size: 24px 24px;
  touch-action: none;
}
.tree-viewport.dragging { cursor: grabbing; }

/* The panned/zoomed world. Edges (SVG) sit underneath the HTML cards. */
.tree-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
.tree-world > svg { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }

/* ---- node cards: absolute-positioned HTML, mirrors SessionHierarchyView ---- */
.tnode {
  position: absolute; box-sizing: border-box; display: flex; flex-direction: column;
  gap: 2px; padding: 7px 9px; border-radius: 8px; background: var(--bg-elev);
  border: 1px solid var(--rule); cursor: pointer; overflow: hidden;
  transition: box-shadow .14s ease, border-color .14s ease;
}
.tnode:hover { box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 1px 1px rgba(0,0,0,.05); }
.tnode .tn-top { display: flex; align-items: center; gap: 6px; }
.tnode .tn-label {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: 11px; font-weight: 600;
  line-height: 1.3; letter-spacing: .1px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tnode .tn-badge {
  flex-shrink: 0; font-family: var(--mono); font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 5px; letter-spacing: .2px;
  background: color-mix(in srgb, var(--ink-faint) 14%, transparent); color: var(--ink-soft);
}
.tnode .tn-sum {
  font-family: var(--sans); font-size: 9.8px; line-height: 1.25; color: var(--ink-faint);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* breakthrough spine — green left accent + green badge */
.tnode.brk { box-shadow: inset 3px 0 0 0 var(--fig-good); border-color: color-mix(in srgb, var(--fig-good) 30%, var(--rule)); }
.tnode.brk .tn-badge { background: color-mix(in srgb, var(--fig-good) 16%, transparent); color: var(--fig-good); }
.tnode.brk .tn-label { color: var(--ink); }
/* failed / rejected branch */
.tnode.fail { border-style: dashed; opacity: .8; }
.tnode.fail .tn-badge { background: color-mix(in srgb, var(--fig-bad) 15%, transparent); color: var(--fig-bad); }
/* merged-from-fork accent (purple right edge) */
.tnode.fork { box-shadow: inset -2px 0 0 0 color-mix(in srgb, var(--fig-accent2) 60%, transparent); }
.tnode.brk.fork { box-shadow: inset 3px 0 0 0 var(--fig-good), inset -2px 0 0 0 color-mix(in srgb, var(--fig-accent2) 60%, transparent); }
/* selected */
.tnode.sel { border: 2px solid var(--fig-good); }
/* preliminary ghost child — dashed, faded, same footprint as a committed card */
.tnode.ghost {
  border-style: dashed; border-color: var(--rule-strong); opacity: .82; background: var(--bg-soft);
}
.tnode.ghost .tn-label { font-weight: 600; color: var(--ink-soft); }
.tnode.ghost .tn-eyebrow {
  font-family: var(--sans); font-size: 8px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1px;
}
.tnode.ghost.sel { border: 2px dashed var(--fig-good); background: color-mix(in srgb, var(--fig-good) 8%, var(--bg-soft)); opacity: 1; }
/* the "+N more" chip at the end of a ghost row */
.tnode.morechip {
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  border-style: dashed; background: transparent; font-family: var(--sans);
  font-size: 11px; font-style: italic; color: var(--ink-faint); cursor: default;
}
.tnode.morechip:hover { box-shadow: none; }

.tree-zoom {
  position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column;
  gap: 6px; z-index: 4;
}
.tree-zoom button {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--rule-strong);
  background: var(--bg-elev); color: var(--ink-soft); font-size: 16px; font-weight: 600;
  cursor: pointer; font-family: var(--sans); line-height: 1; display: flex;
  align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.tree-zoom button:hover { color: var(--ink); border-color: var(--ink-faint); }

/* detail panel (HTML) beside the tree */
.tree-panel {
  border-left: 1px solid var(--rule); background: var(--bg-elev);
  font-family: var(--sans); padding: 0; overflow-y: auto; max-height: 560px;
}
@media (max-width: 720px) { .tree-panel { border-left: none; border-top: 1px solid var(--rule); max-height: 420px; } }
.tree-panel .tp-empty {
  padding: 30px 22px; color: var(--ink-faint); font-size: 13px; line-height: 1.6;
}
.tree-panel .tp-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--rule); }
.tree-panel .tp-kicker {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint); display: flex; justify-content: space-between; align-items: center;
}
.tree-panel .tp-title { font-size: 15.5px; font-weight: 700; color: var(--ink); margin-top: 7px; line-height: 1.3; }
.tree-panel .tp-score { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.tree-panel .tp-score .sv { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.tree-panel .tp-score .sl { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }
.tree-panel .tp-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; border: 1px solid transparent;
}
.tree-panel .tp-body { padding: 14px 18px 20px; }
.tree-panel .tp-sec { margin-bottom: 15px; }
.tree-panel .tp-sec:last-child { margin-bottom: 0; }
.tree-panel .tp-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 5px;
}
.tree-panel .tp-txt { font-size: 12.8px; line-height: 1.55; color: var(--ink-soft); }
.tree-panel .tp-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tree-panel .tp-metric {
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 6px; padding: 7px 9px;
}
.tree-panel .tp-metric .k { font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 700; }
.tree-panel .tp-metric .v { font-family: var(--mono); font-size: 14px; color: var(--ink); margin-top: 2px; }
.tree-panel .tp-path { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); line-height: 1.5; }
.tree-panel .tp-path b { color: var(--accent); }

/* Preliminary candidates are rendered inline as dashed ghost children
   (.tnode.ghost) fanned out under their parent — there is no separate
   strip, matching the operator Hierarchy View. */
