/* Article pages: hero, chapter rail, reading column, figures, and the
   components the interactive figures are built from. */

/* ---------- levels: 1 the practitioner's guide, 2 how it works, 3 the math and the code ---------- */
html[data-depth="1"] .lv2,
html:not([data-depth="3"]) .lv3:not(details) { display: none !important; }
html:not([data-depth="1"]) .descend { display: none; }

.topbar { flex-wrap: nowrap; }
/* "TMI? Dial it down": a faded arrow under the depth switch, only while the page is at its default and unscrolled */
.depth-wrap { position: relative; flex: none; }
.dial-hint { display: none; align-items: flex-end; gap: 4px; color: var(--gold); opacity: 0.92; pointer-events: none; white-space: nowrap; transition: opacity 0.5s; }
.dial-hint .dh-t { font: italic 400 1.28rem/1 var(--f-display); padding-bottom: 1px; text-shadow: 0 0 14px var(--bg), 0 0 6px var(--bg); }
.depth-wrap .dial-hint { position: absolute; top: calc(100% + 3px); left: 8px; }
.depth-pick .dial-hint { position: relative; left: -58px; margin-top: -2px; }
/* the button it points at wears a gold ring until the reader chooses */
html[data-depth="3"]:not([data-chosen]) .depth-seg button[data-depth="1"] { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--gold) 80%, transparent); color: var(--ink); }
html[data-depth="3"]:not([data-chosen]) .dial-hint { display: flex; }
html.dial-away .dial-hint { opacity: 0; }
@media (max-width: 980px) { .depth-wrap { display: none; } }
.depth-seg { flex: none; }
@media (max-width: 980px) { .topbar .depth-seg { display: none; } }
@media (max-width: 720px) { .crumbs { display: none; } }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); }

/* ---------- hero ---------- */
.a-hero {
  position: relative; overflow: hidden;
  padding: clamp(40px, 8vw, 90px) var(--gutter) 34px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(70% 60% at 50% 0%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(40% 40% at 100% 100%, color-mix(in oklab, var(--gold) 8%, transparent), transparent 70%);
}
.a-hero-art { max-width: 1180px; margin: 0 auto; }
.a-hero-art svg { width: 100%; height: auto; overflow: visible; }
.a-hero-inner { position: relative; max-width: 1180px; margin: 0 auto; text-align: center; }
.a-hero .kicker { margin: 10px 0 18px; }
.a-hero .display { font-size: clamp(3.2rem, 11vw, 9rem); }
.dek {
  max-width: 44rem; margin: 26px auto 18px;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem); line-height: 1.5; color: var(--ink-2); text-wrap: pretty;
}
.dek strong { color: var(--ink); font-weight: 500; }
.a-hero-meta { font-size: 0.8rem; color: var(--ink-3); max-width: 44rem; margin: 0 auto 26px; }
.a-hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; }
.depth-pick { flex-basis: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 18px; }
.hero-depth-note { font-size: 0.8rem; color: var(--ink-3); }
.hero-depth-note b { color: var(--ink-2); font-weight: 500; }
.art-note { position: relative; text-align: center; font-size: 0.72rem; color: var(--ink-3); margin: 34px 0 0; }
.hero-word { font: 400 30px var(--f-body); fill: var(--ink-3); transition: fill 0.5s; }
.hero-word.src { fill: var(--ink); font-style: italic; }
.hero-word.hot { fill: var(--ink-2); }
.hero-arc { fill: none; stroke-linecap: round; }

/* ---------- layout ---------- */
.a-layout {
  display: grid; grid-template-columns: minmax(0, 1fr);
  max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter);
}
@media (min-width: 1240px) {
  .a-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 48px; }
}
.rail { display: none; }
@media (min-width: 1240px) {
  .rail {
    display: block; position: sticky; top: 92px; align-self: start;
    max-height: calc(100vh - 110px); overflow: auto; padding-top: 72px;
  }
  .rail ol { list-style: none; margin: 14px 0 0; padding: 0; counter-reset: c -1; border-left: 1px solid var(--line); }
  .rail li { counter-increment: c; }
  .rail a {
    display: block; padding: 6px 0 6px 16px; margin-left: -1px; border-left: 2px solid transparent;
    font: 0.84rem/1.3 var(--f-ui); color: var(--ink-3); text-decoration: none; transition: color 0.2s, border-color 0.2s;
  }
  .rail a:hover { color: var(--ink); }
  .rail a.on { color: var(--ink); border-left-color: var(--accent); }
}

.a-body { min-width: 0; }
.chapter { padding: clamp(64px, 9vw, 110px) 0 0; }
.chapter > * { max-width: var(--text-w); margin-left: auto; margin-right: auto; }
.chapter > .wide, .chapter > .fig.wide, .chapter > .scrolly, .chapter > .minute-grid, .chapter > .lineage,
.chapter > .facts, .chapter > .three-uses, .chapter > .build-card, .chapter > [data-component] { max-width: var(--wide-w); }
[data-component] .scrolly { margin-left: auto; margin-right: auto; }
.chapter > .lv2, .chapter > .lv3 { max-width: var(--text-w); }
.chapter p { text-wrap: pretty; }
.ch-head { margin-bottom: 28px; }
.ch-head .kicker { display: flex; gap: 12px; align-items: center; }
.ch-head .src { font: inherit; color: var(--ink-3); text-decoration: none; border: 1px solid var(--line-2); padding: 3px 8px; border-radius: 999px; letter-spacing: 0.08em; }
.ch-head .src:hover { color: var(--accent-ink); border-color: var(--accent); }
.ch-head h2 { margin-top: 14px; font-size: clamp(2.4rem, 6vw, 4rem); }
h3.rung { font: 400 1.9rem/1.1 var(--f-display); letter-spacing: -0.01em; margin: 2.2em 0 0.6em; }
.note { font-size: 1rem; color: var(--ink-2); border-left: 2px solid var(--gold); padding-left: 16px; }
.note::before { content: "Researcher's note"; display: block; font: 500 0.7rem var(--f-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.small { font-size: 0.8rem; }

.quote {
  margin: 44px auto; padding: 0 0 0 22px; border-left: 2px solid var(--accent);
  font: italic 400 1.35rem/1.45 var(--f-body); color: var(--ink);
}
.quote cite { display: block; margin-top: 10px; font: normal 0.78rem var(--f-ui); color: var(--ink-3); }

/* ---------- in one minute ---------- */
.minute-grid { display: grid; gap: 40px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .minute-grid { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.minute h2 { margin-top: 12px; }
.beats { list-style: none; padding: 0; margin: 26px 0 0; counter-reset: b; }
.beats li { counter-increment: b; position: relative; padding: 0 0 18px 46px; }
.beats li::before {
  content: counter(b); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font: 500 0.8rem var(--f-mono); color: var(--accent-ink);
  background: var(--accent-soft); border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
}
.beats b { color: var(--ink); font-weight: 500; }
.glance { padding: 22px 24px; position: sticky; top: 90px; }
.glance dl { margin: 12px 0 0; }
.glance dl div { padding: 11px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 90px 1fr; gap: 12px; }
.glance dt { font: 500 0.78rem var(--f-ui); color: var(--ink-3); padding-top: 2px; }
.glance dd { margin: 0; font: 0.9rem/1.45 var(--f-ui); color: var(--ink-2); }
.glance .num { font: 400 1.35rem var(--f-display); color: var(--ink); }

/* ---------- figures ---------- */
.fig { margin: 44px auto; padding: 22px clamp(16px, 3vw, 28px) 20px; }
.fig-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.fig-head h3 { margin: 0; font: 400 1.6rem/1.1 var(--f-display); letter-spacing: -0.01em; }
.fig figcaption { font: 0.88rem/1.6 var(--f-ui); color: var(--ink-2); margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.fig figcaption b { color: var(--ink); font-weight: 600; }
.controls { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; margin-top: 14px; font-size: 0.85rem; }
.btn.small { height: 36px; padding: 0 14px; font-size: 0.85rem; }
.slider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); flex-wrap: wrap; }
.slider b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3ch; }
input[type="range"] { accent-color: var(--accent); width: min(260px, 60vw); }
.readout { font-size: 0.85rem; color: var(--ink-2); min-height: 1.4em; margin: 10px 0 0; font-variant-numeric: tabular-nums; }
.readout b { color: var(--ink); }

/* race */
.race { display: grid; gap: 18px; }
.lane { display: grid; grid-template-columns: 118px 1fr; gap: 12px; align-items: center; }
.lane-label { font: 500 0.8rem/1.3 var(--f-ui); color: var(--ink-2); }
.lane-label small { display: block; color: var(--ink-3); font-weight: 400; }
.lane-track { position: relative; display: flex; gap: 6px; flex-wrap: nowrap; padding: 12px 0; }
.tok {
  flex: 1 1 0; min-width: 0; height: 36px; border-radius: 9px; display: grid; place-items: center;
  font: 0.8rem var(--f-ui); color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line);
  transition: background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s; overflow: hidden; white-space: nowrap;
}
.tok.done { color: var(--ink); border-color: color-mix(in oklab, var(--accent) 50%, transparent); background: var(--accent-soft); }
.tok.now { box-shadow: 0 0 0 2px var(--accent), 0 0 22px var(--glow); color: var(--ink); }
.pill {
  position: absolute; top: 2px; height: 8px; border-radius: 8px; background: var(--gold); box-shadow: 0 0 14px var(--gold);
  transition: left 0.28s var(--ease); opacity: 0;
}
.lane-arcs { position: absolute; inset: -34px 0 auto 0; height: 40px; pointer-events: none; overflow: visible; }
.lane-arcs path { fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: 0; transition: opacity 0.4s; }
.lane-arcs.on path { opacity: 0.55; }
.lane.tx .lane-track { margin-top: 30px; }
.step-count { font: 400 1.6rem var(--f-display); color: var(--ink); }
@media (max-width: 640px) { .lane { grid-template-columns: 1fr; } .tok { font-size: 0.7rem; } }

/* explorer */
.explorer { position: relative; }
.explorer svg { width: 100%; height: auto; overflow: visible; }
.ex-word { cursor: pointer; }
.ex-word text { font: 400 22px var(--f-body); fill: var(--ink-2); transition: fill 0.2s; }
.ex-word rect { fill: transparent; rx: 8; transition: fill 0.2s; }
.ex-word:hover rect { fill: var(--surface-2); }
.ex-word.sel text { fill: var(--ink); font-style: italic; }
.ex-word.sel rect { fill: var(--accent-soft); }
.ex-word:focus-visible { outline: none; }
.ex-word:focus-visible rect { stroke: var(--accent); stroke-width: 2; }
.ex-bar { fill: var(--accent); transition: height 0.4s var(--ease), y 0.4s var(--ease); }
.ex-pct { font: 11px var(--f-mono); fill: var(--ink-3); }
.ex-arc { fill: none; stroke: var(--accent); stroke-linecap: round; }

/* scrollytelling */
.scrolly { position: relative; display: grid; grid-template-columns: 1fr; gap: 0; margin: 40px auto; }
@media (min-width: 980px) { .scrolly { grid-template-columns: 1.1fr 0.9fr; gap: 48px; } }
.scrolly-fig {
  position: sticky; top: 76px; z-index: 2; align-self: start;
  padding: 18px 18px 14px; margin-bottom: 20px;
}
@media (min-width: 980px) { .scrolly-fig { top: 110px; } }
.scrolly-steps { position: relative; z-index: 1; }
.step {
  min-height: 70vh; display: flex; flex-direction: column; justify-content: center;
  padding: 24px 0; opacity: 0.28; transition: opacity 0.4s;
}
.step.on { opacity: 1; }
.step h3 { font: 400 1.7rem/1.12 var(--f-display); margin: 4px 0 10px; letter-spacing: -0.01em; }
.step-n { font: 500 0.72rem var(--f-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink); margin: 0; }
@media (max-width: 979px) {
  .scrolly-fig { padding: 12px 12px 10px; margin: 0 -4px 12px; }
  .step { min-height: 72vh; justify-content: flex-end; padding-bottom: 14vh; }
  /* on a phone the sheet shows the table for steps 1 to 4 and the plane for 5 and 6 */
  [data-sheet] .sheet-bottom { display: none; }
  [data-sheet][data-step="5"] .sheet-bottom, [data-sheet][data-step="6"] .sheet-bottom { display: grid; }
  [data-sheet][data-step="5"] .sheet, [data-sheet][data-step="6"] .sheet, [data-sheet][data-step="5"] .sheet-q, [data-sheet][data-step="6"] .sheet-q { display: none; }
  [data-blend] { max-width: 250px; }
  .grid-all { position: static; margin: 10px auto; }
  [data-sheet][data-step="6"] [data-blend] { display: none; }
  .sheet { font-size: 0.74rem; }
  .sheet th, .sheet td { padding: 7px 3px; }
  .vec i { width: 13px; height: 16px; font-size: 0.6rem; }
  .share i { width: calc(var(--p) * 44px); }
}
.sheet-q { font-size: 0.85rem; color: var(--ink-3); display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet-q .w { font: italic 1.3rem var(--f-body); color: var(--ink); }
.sheet { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.sheet th, .sheet td { padding: 8px 6px; text-align: left; border-top: 1px solid var(--line); transition: opacity 0.4s, background 0.4s; }
.sheet thead th { font: 500 0.68rem var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); border-top: 0; }
.sheet tbody th { font: italic 400 1.02rem var(--f-body); color: var(--ink); }
.sheet td { font-variant-numeric: tabular-nums; color: var(--ink); }
.vec { display: inline-flex; gap: 2px; vertical-align: middle; }
.vec i { width: 16px; height: 18px; border-radius: 3px; display: grid; place-items: center; font: normal 0.66rem var(--f-mono); color: var(--ink); background: color-mix(in oklab, var(--accent) calc(var(--a) * 55%), var(--surface-2)); }
.share { display: inline-flex; align-items: center; gap: 6px; }
.share i { display: inline-block; height: 8px; width: calc(var(--p) * 90px); border-radius: 4px; background: var(--gold); transition: width 0.6s var(--ease); }
[data-sheet] .c-score, [data-sheet] .c-scale, [data-sheet] .c-share, [data-sheet] .c-val { opacity: 0.12; }
[data-sheet][data-step="2"] .c-score, [data-sheet][data-step="3"] .c-score, [data-sheet][data-step="4"] .c-score, [data-sheet][data-step="5"] .c-score, [data-sheet][data-step="6"] .c-score { opacity: 1; }
[data-sheet][data-step="3"] .c-scale, [data-sheet][data-step="4"] .c-scale, [data-sheet][data-step="5"] .c-scale, [data-sheet][data-step="6"] .c-scale { opacity: 1; }
[data-sheet][data-step="4"] .c-share, [data-sheet][data-step="5"] .c-share, [data-sheet][data-step="6"] .c-share { opacity: 1; }
[data-sheet][data-step="5"] .c-val, [data-sheet][data-step="6"] .c-val { opacity: 1; }
[data-sheet][data-step="2"] td.c-score, [data-sheet][data-step="3"] td.c-scale, [data-sheet][data-step="4"] td.c-share, [data-sheet][data-step="5"] td.c-val { background: var(--accent-soft); }
[data-sheet]:not([data-step="4"]):not([data-step="5"]):not([data-step="6"]) .share i { width: 0; }
.sheet-bottom { display: grid; grid-template-columns: 1fr; margin-top: 10px; position: relative; }
[data-blend] { width: 100%; max-width: 300px; margin: 0 auto; height: auto; opacity: 0.15; transition: opacity 0.5s; }
[data-sheet][data-step="5"] [data-blend], [data-sheet][data-step="6"] [data-blend] { opacity: 1; }
[data-sheet][data-step="6"] [data-blend] { opacity: 0; }
.grid-all {
  position: absolute; inset: 0; margin: auto; width: min(200px, 60%); aspect-ratio: 1; display: grid;
  grid-template-columns: repeat(6, 1fr); gap: 3px; opacity: 0; transition: opacity 0.5s; pointer-events: none;
}
[data-sheet][data-step="6"] .grid-all { opacity: 1; }
.grid-all i { border-radius: 3px; background: color-mix(in oklab, var(--accent) calc(var(--a) * 100%), var(--surface-2)); animation: cell 1.6s ease-in-out infinite alternate; animation-delay: calc(var(--d) * 40ms); }
@keyframes cell { to { filter: brightness(1.35); } }
.sheet-caption { font-size: 0.78rem; color: var(--ink-3); text-align: center; margin: 8px 0 0; min-height: 1.3em; }
.blend-axis { stroke: var(--line-2); }
.blend-v { stroke-width: 2; fill: none; }
.blend-lbl { font: italic 13px var(--f-body); fill: var(--ink-2); }
.blend-out { fill: var(--gold); }

/* equations */
.eq-card { padding: 22px clamp(16px, 3vw, 26px); margin: 26px auto; }
.eq { font-size: 1.25rem; overflow-x: auto; overflow-y: hidden; padding: 8px 0; color: var(--ink); text-align: center; }
.eq .katex { font-size: 1.15em; }
.eq [class*="s-"] { transition: color 0.2s, background 0.2s; border-radius: 4px; }
.eq .hl { color: var(--gold); background: var(--gold-soft); }
.syms { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 16px 0 10px; }
.syms button {
  text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-1);
  padding: 10px 12px; font-size: 0.8rem; line-height: 1.45; color: var(--ink-2); cursor: default;
}
.syms button b { display: block; font: 400 1.1rem var(--f-body); color: var(--ink); margin-bottom: 2px; }
.syms button:hover, .syms button.hl { border-color: var(--gold); }
.inwords { font-size: 1rem; color: var(--ink-2); margin: 12px 0 0; }
.inwords b { color: var(--ink); font-weight: 500; }
.code { margin: 20px auto; padding: 0; overflow: hidden; }
.code summary { padding: 14px 18px; cursor: pointer; font-size: 0.85rem; color: var(--ink-2); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; border-top: 1px solid var(--line); background: var(--bg-2); }
.code code { background: none; padding: 0; font-size: 0.8rem; line-height: 1.6; color: var(--ink-2); }

/* scale demo */
.scale-demo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sd-panel h4 { margin: 0 0 8px; font: 500 0.8rem var(--f-ui); color: var(--ink-2); }
.sd-bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; border-bottom: 1px solid var(--line-2); }
.sd-bars i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; transition: height 0.4s var(--ease); min-height: 1px; }
.sd-panel.raw .sd-bars i { background: var(--bad); }
.sd-panel p { font: 0.78rem var(--f-ui); color: var(--ink-3); margin: 8px 0 0; }

/* heads */
.heads { display: grid; gap: 22px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .heads { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.head h4 { margin: 0 0 8px; font: 500 0.85rem var(--f-ui); color: var(--ink); display: flex; gap: 8px; align-items: center; }
.head h4 i { width: 10px; height: 10px; border-radius: 3px; background: var(--hc); }
.head-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.head-grid span { aspect-ratio: 1; border-radius: 2px; background: color-mix(in oklab, var(--hc) calc(var(--a) * 100%), var(--surface-2)); cursor: crosshair; }
.head-grid span:hover { outline: 1.5px solid var(--ink); }
.head p { font: 0.76rem/1.4 var(--f-ui); color: var(--ink-3); margin: 8px 0 0; min-height: 2.8em; }
.split-bar { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin: 18px 0; }
.split-bar span {
  height: 34px; border-radius: 6px; display: grid; place-items: center; font: 500 0.75rem var(--f-mono); color: var(--bg);
  background: oklch(0.74 0.14 calc(285 + var(--i) * 12));
}

/* three uses */
.three-uses { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 26px auto; }
.use { padding: 18px; }
.use p:last-child { margin: 8px 0 0; font-size: 1rem; color: var(--ink-2); }

/* mask */
.mask { display: grid; grid-template-columns: 80px repeat(4, minmax(0, 72px)); gap: 4px; justify-content: center; font-family: var(--f-ui); }
.mask .h { font: italic 1rem var(--f-body); color: var(--ink-2); display: grid; place-items: center; padding: 4px; }
.mask .r { justify-content: end; }
.mask button {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); cursor: pointer;
  background: var(--surface-2); color: var(--ink-3); font: 0.72rem var(--f-mono);
}
.mask button.ok { background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 50%, transparent); color: var(--accent-ink); }
.mask button:hover, .mask button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.mask button.lit { box-shadow: 0 0 0 2px var(--gold) inset; }

/* clocks */
.clocks { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.clock { text-align: center; }
.clock svg { width: 100%; max-width: 110px; margin: 0 auto; }
.clock .face { fill: var(--surface-2); stroke: var(--line-2); }
.clock .hand { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transition: transform 0.25s var(--ease); transform-origin: 50px 50px; }
.clock .tip-dot { fill: var(--gold); }
.clock .hub { fill: var(--ink); }
.clock p { font: 0.72rem/1.35 var(--f-ui); color: var(--ink-3); margin: 6px 0 0; }
.clock p b { display: block; color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.pe-wrap { margin-top: 22px; }
#pe { width: 100%; height: 150px; border-radius: var(--r-1); image-rendering: pixelated; }
.pe-axis { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--ink-3); margin: 6px 0 0; }

/* architecture */
.arch-wrap { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .arch-wrap { grid-template-columns: 1.15fr 0.85fr; align-items: start; } }
.arch-scroll { overflow-x: auto; }
.arch-hint { display: none; font: 0.76rem var(--f-ui); color: var(--ink-3); margin: 0 0 6px; }
@media (max-width: 600px) { .arch-hint { display: block; } }
#arch { width: 100%; min-width: 520px; height: auto; }
.blk { cursor: pointer; }
.blk rect, .blk circle { stroke-width: 1.5; transition: filter 0.2s, stroke 0.2s, opacity 0.3s; }
.blk text { font: 500 14px var(--f-ui); fill: var(--ink); pointer-events: none; }
.blk.attn rect { fill: oklch(0.74 0.14 285 / 0.2); stroke: oklch(0.74 0.14 285); }
.blk.ff rect { fill: oklch(0.78 0.13 190 / 0.18); stroke: oklch(0.78 0.13 190); }
.blk.norm rect { fill: oklch(0.83 0.14 80 / 0.16); stroke: oklch(0.83 0.14 80); }
.blk.emb rect { fill: oklch(0.72 0.16 351 / 0.18); stroke: oklch(0.72 0.16 351); }
.blk.lin rect, .blk.soft rect { fill: oklch(0.78 0.12 150 / 0.18); stroke: oklch(0.78 0.12 150); }
.blk.pe circle { fill: var(--surface-2); stroke: var(--ink-3); }
.blk.io text { fill: var(--ink-2); font-weight: 400; font-style: italic; font-family: var(--f-body); font-size: 16px; }
.blk.io rect { fill: transparent; stroke: transparent; }
.blk:hover rect, .blk:hover circle, .blk:focus-visible rect { filter: brightness(1.3); }
.blk:focus-visible { outline: none; }
.blk.on rect, .blk.on circle { stroke-width: 3; filter: drop-shadow(0 0 10px var(--glow)); }
#arch.flowing .blk:not(.on):not(.io) { opacity: 0.45; }
.wire { fill: none; stroke: var(--ink-3); stroke-width: 1.4; }
.wire.res { stroke-dasharray: 3 3; }
.frame { fill: none; stroke: var(--line-2); stroke-dasharray: 6 5; }
.arch-label { font: 500 13px var(--f-mono); fill: var(--ink-3); letter-spacing: 0.08em; }
.arch-panel { min-height: 300px; }
.arch-panel h3 { margin: 8px 0 10px; font: 400 1.8rem/1.1 var(--f-display); }
.arch-panel #arch-body p { font-size: 1.02rem; color: var(--ink-2); }
.arch-panel .shape { font-size: 0.8rem; color: var(--gold); min-height: 1.2em; }
.arch-nav { display: flex; gap: 8px; margin-top: 16px; }
.two-col { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .two-col { grid-template-columns: 1fr 1fr; } }
.two-col .eq { font-size: 1rem; }

/* tables */
.table-wrap { overflow-x: auto; margin: 26px auto; }
.data { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data caption { caption-side: bottom; text-align: left; font-size: 0.76rem; color: var(--ink-3); padding-top: 10px; }
.data th, .data td { padding: 12px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data thead th { font: 500 0.7rem var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.data tbody th { color: var(--ink); font-weight: 500; }
.data td { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.data tr.win { background: var(--accent-soft); }
.data tr.win td b { color: var(--accent-ink); }
.changed td:first-child { color: var(--ink-3); }
.changed td:nth-child(2) { color: var(--ink); font-weight: 500; }

/* cost */
.cost-row { display: grid; grid-template-columns: 140px 1fr 90px; gap: 12px; align-items: center; margin: 12px 0; font: 0.84rem var(--f-ui); }
.cost-row .bar { height: 26px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.cost-row .bar i { display: block; height: 100%; border-radius: 6px; transition: width 0.35s var(--ease); }
.cost-row .v { text-align: right; font: 0.8rem var(--f-mono); color: var(--ink-2); }
.cost-verdict { font: 400 1.4rem/1.2 var(--f-display); margin: 14px 0 0; }
@media (max-width: 560px) { .cost-row { grid-template-columns: 96px 1fr 70px; } }

/* charts (shared) */
.chart svg { width: 100%; height: auto; overflow: visible; }
.ax { stroke: var(--line-2); }
.grid-l { stroke: var(--line); }
.tick { font: 11px var(--f-mono); fill: var(--ink-3); }
.ax-title { font: 500 11.5px var(--f-ui); fill: var(--ink-3); }
.lr-line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.lr-area { fill: url(#lrgrad); }
.lr-peak { fill: var(--gold); }
.cross { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.pt { cursor: pointer; }
.pt circle { transition: r 0.2s; }
.pt text { font: 500 12.5px var(--f-ui); fill: var(--ink); }
.pt .sub { font: 11px var(--f-mono); fill: var(--ink-3); }
.pt.tx circle { fill: var(--gold); filter: drop-shadow(0 0 8px var(--gold)); }
.pt.old circle { fill: var(--ink-3); }
.better { font: italic 13px var(--f-body); fill: var(--ink-3); }
.abl-bar { fill: var(--accent); }
.abl-bar.best { fill: var(--gold); }

/* facts */
.facts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin: 10px auto 34px; }
.fact { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.fact .n { font: 400 2.6rem/1 var(--f-display); color: var(--ink); }
.fact .l { font: 0.82rem/1.45 var(--f-ui); color: var(--ink-3); }

/* lineage */
.lineage { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 30px auto; }
@media (min-width: 620px) { .lineage { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .lineage { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lin {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; text-decoration: none; color: var(--ink);
  transition: transform 0.3s var(--ease), border-color 0.3s;
}
.lin:hover { transform: translateY(-3px); border-color: var(--c); text-decoration: none; }
.lin .y { font: 500 0.72rem var(--f-mono); color: var(--c); letter-spacing: 0.1em; }
.lin .t { font: 400 1.4rem/1.1 var(--f-display); }
.lin p { margin: 0; font: 0.84rem/1.45 var(--f-ui); color: var(--ink-2); }
.lin .s { font: 500 0.72rem var(--f-ui); color: var(--ink-3); margin-top: auto; padding-top: 6px; }
.lin .s.ready { color: var(--good); }

/* quiz */
.quiz { display: grid; gap: 14px; }
.q { padding: 20px 22px; }
.q h3 { margin: 0 0 12px; font: 400 1.35rem/1.25 var(--f-display); }
.q h3 span { font: 500 0.72rem var(--f-mono); color: var(--accent-ink); letter-spacing: 0.12em; display: block; margin-bottom: 6px; }
.opts { display: grid; gap: 8px; }
.opts button {
  text-align: left; padding: 12px 14px; border-radius: var(--r-1); border: 1px solid var(--line-2);
  background: var(--surface-2); font: 0.92rem/1.4 var(--f-ui); color: var(--ink-2); cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.opts button:hover { border-color: var(--ink-3); color: var(--ink); }
.opts button.right { border-color: var(--good); background: color-mix(in oklab, var(--good) 14%, transparent); color: var(--ink); }
.opts button.wrong { border-color: var(--bad); background: color-mix(in oklab, var(--bad) 12%, transparent); }
.why { font: 0.9rem/1.55 var(--f-ui); color: var(--ink-2); margin: 12px 0 0; }
.score { font: 400 1.6rem var(--f-display); text-align: center; margin: 10px 0 0; }

/* build + about */
.build-card { padding: clamp(22px, 4vw, 40px); display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .build-card { grid-template-columns: 1fr 1fr; align-items: center; } }
.build-card h2 { margin: 10px 0 12px; }
.build-card p { color: var(--ink-2); margin: 0; }
.build-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.build-links a {
  display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r-1);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 500;
}
.build-links a span { color: var(--ink-3); font-weight: 400; font-size: 0.85rem; text-align: right; }
.build-links a:hover { border-color: var(--accent); }
.about { max-width: var(--text-w); margin: 80px auto 0; font-size: 0.82rem; line-height: 1.65; color: var(--ink-2); }

/* ---------- component: query-compass ---------- */
.compass { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .compass { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.compass-plane { width: 100%; max-width: 380px; margin: 0 auto; touch-action: none; cursor: crosshair; border-radius: 50%; }
.compass-plane:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.compass-ring { fill: none; stroke: var(--line-2); stroke-dasharray: 3 4; }
.compass-lbl { font: italic 13px var(--f-body); fill: var(--ink-2); }
.compass-lbl.q { fill: var(--gold); font-style: normal; font-weight: 600; font-family: var(--f-ui); font-size: 12px; }
.compass-handle { fill: var(--gold); opacity: 0.25; cursor: grab; }
.compass-side .kicker { margin-bottom: 12px; }
.cp-row { display: grid; grid-template-columns: 64px 48px 1fr 44px; gap: 10px; align-items: center; margin: 10px 0; font-size: 0.86rem; }
.cp-n { font: italic 1.05rem var(--f-body); color: var(--ink); }
.cp-s { color: var(--ink-3); font-size: 0.78rem; }
.cp-bar { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.cp-bar i { display: block; height: 100%; border-radius: 6px; transition: width 0.25s var(--ease); }
.cp-row b { text-align: right; font-variant-numeric: tabular-nums; }
.cp-note { font-size: 0.76rem; color: var(--ink-3); margin: 12px 0 0; }

/* ---------- component: attention-shapes ---------- */
.shapes-ctl { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-bottom: 18px; font-size: 0.85rem; }
.shapes-ctl input[type="range"] { width: 140px; }
.shapes { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 10px; overflow-x: auto; padding: 8px 0; }
.mx { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mx-box { border-radius: 4px; background: repeating-linear-gradient(0deg, transparent 0 12px, color-mix(in oklab, var(--bg) 60%, transparent) 12px 13px), color-mix(in oklab, var(--ink-3) 45%, var(--surface-2)); transition: width 0.3s var(--ease), height 0.3s var(--ease); }
.mx.q .mx-box { background-color: oklch(0.74 0.17 285 / 0.75); }
.mx.k .mx-box { background-color: oklch(0.78 0.13 190 / 0.75); }
.mx.v .mx-box { background-color: oklch(0.72 0.16 351 / 0.7); }
.mx.sc .mx-box { background-color: var(--gold); box-shadow: 0 0 24px var(--gold-soft); }
.mx-n { font: italic 0.95rem var(--f-body); color: var(--ink); }
.mx-d { font-size: 0.7rem; color: var(--ink-3); }
.mx-stack { display: flex; flex-direction: column; gap: 8px; }
.mx-stack .mx { flex-direction: row; gap: 8px; }
.op { font: 0.74rem var(--f-mono); color: var(--ink-3); white-space: nowrap; }

/* ---------- component: gqa-cache ---------- */
.gqa-heads { width: 100%; height: auto; margin-bottom: 14px; }
.gqa-q { fill: oklch(0.74 0.17 285); }
.gqa-kv { fill: var(--gold); transition: all 0.3s var(--ease); }
.gqa-wire { fill: none; stroke: var(--ink-3); stroke-width: 1; opacity: 0.55; }
.gqa-lbl { font: 500 11px var(--f-mono); fill: var(--ink-3); letter-spacing: 0.06em; }
.gqa-ctl { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; font-size: 0.85rem; }
.gqa-ctl .seg button { padding: 0 10px; }
.gqa-out { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 20px; }
.gqa-stat { padding: 14px 16px; border-radius: var(--r-2); background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.gqa-stat .n { font: 400 2.1rem/1 var(--f-display); color: var(--ink); }
.gqa-stat .l { font: 0.78rem var(--f-ui); color: var(--ink-3); }
.gqa-stat.hi { border-color: var(--gold); background: var(--gold-soft); }
.gqa-stat.hi .n { color: var(--gold); }
.gqa-bar { grid-column: 1 / -1; position: relative; height: 28px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.gqa-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width 0.4s var(--ease); border-radius: 8px; }
.gqa-bar span { position: relative; display: block; padding: 0 12px; line-height: 28px; font: 500 0.78rem var(--f-ui); color: var(--ink); }

/* ---------- component: attention-cost ---------- */
.cost2-bar { display: flex; height: 44px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.cost2-bar i { display: block; height: 100%; transition: width 0.35s var(--ease); }
.cost2 i.lin { background: var(--c1, oklch(0.72 0.15 255)); }
.cost2 i.quad { background: var(--gold); }
.cost2-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; font-size: 0.8rem; color: var(--ink-3); }
.cost2-legend span { display: inline-flex; align-items: center; gap: 8px; }
.cost2-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; padding: 0; } /* .lin is also the lineage card's class */

/* ---------- component: causal-replay ---------- */
.replay { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .replay { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; } }
.replay-grid { display: grid; gap: 3px; font: 0.7rem var(--f-ui); }
.rg-h { writing-mode: vertical-rl; transform: rotate(180deg); justify-self: center; color: var(--ink-3); padding-bottom: 4px; font-style: italic; font-family: var(--f-body); font-size: 0.82rem; }
.rg-r { color: var(--ink-3); text-align: right; padding-right: 8px; align-self: center; font-style: italic; font-family: var(--f-body); font-size: 0.86rem; }
.rg-h.on, .rg-r.on { color: var(--ink); }
.rg-c { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); transition: background 0.3s; }
.rg-c.masked { background: color-mix(in oklab, var(--bg) 70%, var(--surface-2)); background-image: repeating-linear-gradient(45deg, transparent 0 3px, var(--line) 3px 4px); }
.rg-c.locked { background: color-mix(in oklab, var(--accent) 45%, var(--surface-2)); }
.rg-c.new { background: var(--gold); box-shadow: 0 0 10px var(--gold-soft); }
.rg-c.redo { background: var(--bad); }
.replay-cache { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 18px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 46px; opacity: 0.25; transition: opacity 0.3s; }
.kv.on { opacity: 1; }
.kv i { font: normal 600 0.66rem var(--f-mono); text-align: center; padding: 3px 0; border-radius: 3px; background: oklch(0.78 0.13 190 / 0.35); color: var(--ink); }
.kv i + i { background: oklch(0.72 0.16 351 / 0.35); }
.kv.fresh i { outline: 1.5px solid var(--gold); }
.kv em { grid-column: 1 / -1; font: italic 0.68rem var(--f-body); color: var(--ink-3); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rc { padding: 12px 14px; border-radius: var(--r-2); background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.rc .n { font: 400 2rem/1 var(--f-display); color: var(--ink); }
.rc .l { font-size: 0.76rem; color: var(--ink-3); }
.rc.hi { border-color: var(--gold); background: var(--gold-soft); }
.rc.hi .n { color: var(--gold); }

/* the depth switch: in the header on wide screens, under the title on phones */
.depth-label { font-size: 0.78rem; color: var(--ink-3); }
.mobile-only { display: none !important; }
@media (max-width: 980px) { .depth-label { display: none; } .mobile-only { display: flex !important; } }
.kicker a.crumb { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.kicker a.crumb:hover { color: var(--ink); }
