/* Component styles. Every colour is a theme token, so light and dark follow the page theme. */
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--f-body); margin: 0; padding: 24px 16px 36px; }
.wrap { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
h1 { font: 600 clamp(20px, 2.4vw, 26px)/1.15 var(--f-display); margin: 0; letter-spacing: -0.01em; }
h2 { font: 600 18px var(--f-display); margin: 0; }
.lede { margin: 6px 0 0; color: var(--muted); max-width: 84ch; font-size: 13.5px; }
.tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
button { font: 500 12.5px var(--f-body); color: var(--bg); background: var(--ink); border: 0; border-radius: 7px; padding: 6px 12px; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--rt); outline-offset: 2px; }
.canvas { overflow-x: auto; }
svg.band { display: block; width: 100%; min-width: 1000px; height: auto; }
.vmsec { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.foot { font-size: 12px; color: var(--muted); max-width: 110ch; margin: 0; }

/* LLM pad */
.pad { fill: none; stroke: var(--line); }
.llmtag rect { fill: var(--llm); }
.llmtag text { font: 700 9.5px var(--f-mono); fill: var(--panel); text-anchor: middle; }
.docbar { fill: var(--bar); }
.frag { font: 500 10px var(--f-mono); fill: var(--muted); }
.frag.hl, .frag.strong { fill: var(--ink); font-weight: 700; }
.fragbg { fill: transparent; }
.fragbg.hl { fill: var(--hl); }
.grp { font: 700 9px var(--f-body); fill: var(--muted); letter-spacing: 0.06em; }

/* sun */
.ring { fill: none; stroke: var(--line); }
.arc { fill: none; stroke-width: 10; }
.beam { stroke-width: 1.5; }
.pill rect { fill: var(--panel); stroke-width: 1.4; }
.pill text { font: 600 10.5px var(--f-mono); fill: var(--ink); }
.pill.unused { opacity: 0.45; }
.core circle { fill: var(--graph); }
.core text { font: 700 11px var(--f-mono); fill: var(--panel); text-anchor: middle; }

/* MLIR matrix */
.grpbox { fill: var(--grpbg); }
.blk .sh { fill: var(--shadow); }
.blk .bd { fill: var(--blk); stroke: var(--blk-line); stroke-width: 1.2; }
.blk text { font: 600 9.5px var(--f-body); fill: var(--ink); }
.blk.flesh .sh { fill: var(--flesh-sh); }
.blk.flesh .bd { fill: var(--flesh); stroke: var(--flesh-line); }
.blk.token-ring .bd { stroke: var(--token); stroke-width: 2; }
.rule { stroke: var(--ink); stroke-width: 1.2; }
.rule.thin { stroke: var(--line); stroke-width: 1; }
.wire { stroke: var(--wire); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.ah { fill: var(--wire); }
.hole { fill: none; stroke: var(--hole); stroke-width: 1.3; stroke-dasharray: 2 1.8; }
.stem { stroke: var(--line); stroke-width: 1; }

/* VM tape */
.rowhl { fill: var(--hl); }
.token { fill: var(--token); }

/* generated interface */
.ball { fill: var(--panel); stroke: var(--ink); stroke-width: 1.3; }

/* timeline */
.tick { stroke: var(--muted); stroke-width: 0.8; }
.checkpoint { stroke: var(--ink); stroke-width: 1.4; }
.toolbox { fill: var(--panel); stroke: var(--wire); stroke-width: 1.2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fx { pointer-events: none; }
.token { transition: none; }
/* Phone chapter tabs: text tabs, shown only on phones; desktop shows every chapter and diagram */
.stages { display: none; }
.stage-off { display: none !important; }
@media (max-width: 760px) {
  .stages { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0 4px; }
  .stages button { min-height: 44px; padding: 10px 0; font: inherit; font-size: 15px; color: var(--muted); background: none; border: 0; cursor: pointer; }
  .stages button[aria-selected="true"] { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 6px; }
  svg.band { min-width: 0; }
  .canvas { overflow-x: visible; }
}

/* VM listing: taken jumps */
.vm-tape .row { font-size: 9px; }
.jump { stroke: var(--wire); stroke-width: 1; opacity: 0.55; }
.jump.live { stroke: var(--token); opacity: 1; stroke-width: 1.4; }
.jump.loop { stroke: var(--token); opacity: 0.9; stroke-width: 1.4; }
.jah { fill: var(--wire); }
.jah.loop { fill: var(--token); }
.jump-label { fill: var(--token); font: 600 8.5px var(--f-mono); }
/* A step the shown programme does not have (S5 real values): kept in place, dimmed, dashed. */
.blk.absent { opacity: 0.35; }
.blk.absent .bd { stroke-dasharray: 3 2; }
