/* z-components.css: chips, figure component, TOC + progress rail, pager, display settings, depth, atlas, motion. */
@layer components {
/* status chips: shape + glyph + word, never colour alone. Page wording stays as small text after the chip. */
.chip { display: inline; margin: 0; font: inherit; text-transform: none; letter-spacing: normal; background: none; padding: 0; border: 0; white-space: normal; }
.chip-k { display: inline-flex; align-items: center; gap: .3em; font: 700 .72rem/1.2 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  padding: .12rem .5rem .12rem .4rem; border: 1.5px solid currentColor; border-radius: 999px; color: var(--c, var(--ink)); background: var(--bg); white-space: nowrap; vertical-align: .1em; }
.chip-k::before { font-size: .9em; }
.chip-sub { font: 600 .78rem var(--sans); color: var(--c, var(--muted)); margin-inline-start: .25em; }
.chip[data-status="settled"] { --c: var(--chip-settled); } .chip[data-status="settled"] .chip-k::before { content: "●"; }
.chip[data-status="open"] { --c: var(--chip-open); } .chip[data-status="open"] .chip-k::before { content: "○"; }
.chip[data-status="analogy"] { --c: var(--chip-analogy); } .chip[data-status="analogy"] .chip-k { border-style: dotted; } .chip[data-status="analogy"] .chip-k::before { content: "≈"; }
.chip[data-status="speculative"] { --c: var(--chip-speculative); } .chip[data-status="speculative"] .chip-k { border-style: dashed; } .chip[data-status="speculative"] .chip-k::before { content: "◇"; }

.status-band { background: var(--surface); border-block-end: 1px solid var(--rule); }
@media (max-width: 40rem) { .status-inner { font-size: .9rem; } .status-inner .kicker { font-size: .72rem; letter-spacing: .08em; } }
.draft-note { font: 600 var(--step--1) var(--sans); color: var(--chip-speculative); border: 1.5px dashed currentColor; padding: .3rem .6rem; display: inline-block; }
.draft-tag { font: 600 .7rem var(--sans); color: var(--chip-speculative); letter-spacing: 0; text-transform: none; }

/* figure component: head (number · title · chip) · finding (hook) · plate · caption */
.fig-head { font: var(--step--1)/1.4 var(--sans); margin: 0 0 var(--s1); display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
.fig-num { font-weight: 700; color: var(--accent); } .fig-title { font-weight: 600; color: var(--ink); }
.fig-finding { font: 600 var(--step-0)/1.45 var(--serif); margin: 0 0 var(--s1); } .fig-finding:empty { display: none; }
.fig .sketch-frame { background: var(--plate); border-color: var(--rule); }
.fig .sketch-frame.is-broken { min-height: 8rem; background: repeating-linear-gradient(45deg, var(--surface) 0 10px, var(--bg) 10px 20px); }
.fig .sketch-frame.is-broken img { font: var(--step--1) var(--sans); color: var(--ink); }
/* HOOK: when Math ships theme-aware SVGs, mark the figure data-theme-aware and the plate follows the page */
.fig[data-theme-aware] .sketch-frame { background: var(--surface); }
.fig-gallery img { aspect-ratio: 16 / 10; object-fit: cover; object-position: top; background: var(--plate); width: 100%; height: auto; }
.fig-strip-h .count { font: 400 var(--step--1) var(--sans); color: var(--muted); }

/* sidenote (hook: the source has none yet; aside.sidenote renders as a margin note) */
.sidenote { font: var(--step--1)/1.5 var(--sans); color: var(--ink-2); border-inline-start: 2px solid var(--rule); padding-inline-start: var(--s2); margin-block: var(--s1) var(--s2); }

/* TOC + progress rail */
.toc { border: 0; margin: 0; position: sticky; top: var(--s2); max-height: calc(100vh - 2rem); overflow: auto; font: var(--step--1)/1.4 var(--sans); padding: var(--s4) 0 var(--s2) .9rem; }
.toc summary { font-weight: 700; cursor: pointer; margin-block-end: var(--s1); }
.toc ol { list-style: none; padding: 0; margin: 0; } .toc ol ol { margin: .1rem 0 .4rem .8rem; }
.toc-stage { display: block; font-weight: 600; color: var(--muted); margin-block-start: var(--s1); }
.toc a { display: block; padding: .15rem 0; color: var(--ink-2); text-decoration: none; }
.toc a[aria-current="true"] { color: var(--ink); font-weight: 600; }
.rail { position: absolute; inset-block: calc(var(--s4) + 2.2rem) 0; inset-inline-start: 0; width: 2px; background: var(--rule); }
.rail span { display: block; height: 100%; background: var(--accent); transform-origin: top; transform: scaleY(0); }
@supports (animation-timeline: scroll()) { .rail span { animation: z-fill linear both; animation-timeline: scroll(root); } }
@keyframes z-fill { to { transform: scaleY(1); } }
@media (max-width: 64rem) { .toc { position: static; max-height: none; border: 1px solid var(--rule); border-radius: 6px; padding: var(--s1) var(--s2); margin-block: var(--s3) 0; }
  .toc details:not([open]) summary { margin: 0; } .rail { display: none; } }

/* reading path (riemann-hypothesis only) */
.start { margin-block: var(--s4); padding-block: var(--s3); border-block: 1px solid var(--rule); }
.start > h2 { margin-block-start: var(--s1); }
.start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: var(--s3); }
.see h3 { margin-block-start: 0; font-size: var(--step-0); font-family: var(--sans); }
.see ol { font: var(--step--1)/1.5 var(--sans); padding-inline-start: 1.4em; }
.one-thing { padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; margin-block-start: var(--s2); }
.stage-label { margin: var(--s5) 0 0; padding-block-end: var(--s1); border-block-end: 1px solid var(--rule); font: 600 var(--step-1)/1.2 var(--serif); color: var(--ink-2); }
.stage-label > span { display: block; font: 700 var(--step--1) var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-block-end: .2rem; }
.stage > .part:first-of-type > h2 { margin-block-start: var(--s3); }

/* depth: Summary shows [data-depth=core] once Math tags any; until then it keeps headings, first paragraphs, figures and chip lists.
   Technical reveals [data-depth=technical]. Content always stays in the HTML. */
[data-depth="technical"] { display: none; }
:root:has(#depth-technical:checked) [data-depth="technical"] { display: revert; }
:root:has(#depth-summary:checked) .part:not(:has([data-depth="core"])) > :not(h2, h2 + p, .fig, .table-wrap, ul:has(.chip)),
:root:has(#depth-summary:checked) .part:has([data-depth="core"]) > :not(h2, .fig, [data-depth="core"]),
:root:has(#depth-summary:checked) .fig figcaption { display: none; }

/* pager */
.pager a { border-color: var(--rule); background: var(--surface); color: var(--ink); }
.path-step { font: var(--step--1) var(--sans); color: var(--muted); }

/* display settings: JS-free radios read with :has(); z-prefs.js only remembers them */
.settings { margin-inline-start: auto; position: relative; }
.settings summary { cursor: pointer; padding: .3rem .6rem; border: 1px solid var(--rule); border-radius: 4px; }
.controls { position: absolute; inset-inline-end: 0; z-index: 5; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: var(--s2); display: grid; gap: var(--s1); min-width: 15rem; color: var(--ink); }
.controls fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .2rem .8rem; } .controls legend { font-weight: 700; padding: 0; }

/* atlas */
.acts { display: grid; grid-template-columns: 1fr; gap: var(--s3); max-width: 40rem; }
.act h3 { margin: var(--s3) 0 var(--s1); font: 700 var(--step--1) var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.act ol.site-map { grid-template-columns: 1fr; }

/* motion: only under no-preference, and off with Display › Motion: Off */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  :root:not(:has(#motion-off:checked)) { scroll-behavior: smooth; }
  @supports (animation-timeline: view()) {
    :root:not(:has(#motion-off:checked)) .fig .sketch-frame { animation: z-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
  }
}
:root:has(#motion-off:checked) *, :root:has(#motion-off:checked) *::before { animation-duration: 0s !important; transition-duration: 0s !important; }
@keyframes z-rise { from { opacity: .25; transform: translateY(14px); } }

.skip:focus { z-index: 9; }
@media (forced-colors: active) { .chip-k, .sketch-frame, .pager a { border-color: CanvasText; color: CanvasText; } .rail span { background: Highlight; } }
@media print { .masthead, .toc, .pager, .settings { display: none; } .doc { display: block; } }
}

/* legacy surfaces that hardcoded light colours: re-point at tokens so dark mode holds contrast */
@layer components {
.sketch-frame { --ink: #1d1914; --ink-2: #4a4038; --muted: #6a5e53; --ink-soft: #4a4038; color: var(--ink); color-scheme: light; } /* plates stay light in both themes */
.note { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.theme-card, .chips a { background: var(--surface); }
.spec-box { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.verdict-box { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
thead th { background: var(--surface-2); color: var(--ink); }
tbody th { background: var(--surface); color: var(--ink); }
.table-wrap {
  background: linear-gradient(90deg, var(--surface) 30%, transparent) left/2.5rem 100% no-repeat local,
              linear-gradient(270deg, var(--surface) 30%, transparent) right/2.5rem 100% no-repeat local,
              radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / .14), transparent) left/.8rem 100% no-repeat scroll,
              radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / .14), transparent) right/.8rem 100% no-repeat scroll, var(--surface); }
.path-step { opacity: 1; color: var(--muted); }
.sm-n { opacity: 1; color: var(--muted); }
.anim-canvas { background: var(--plate); }
.toc details::details-content { content-visibility: visible; display: contents; }
@media (max-width: 64rem) { .toc details:not([open])::details-content { content-visibility: hidden; display: block; } }
}

/* status tag links (tags_pass.py) */
.tag-link{color:inherit;text-decoration:underline dotted;text-underline-offset:2px}.tag-link:hover,.tag-link:focus{text-decoration-style:solid}
.tag-list{padding-left:1.4em}.tag-list li{margin:.55em 0;overflow-wrap:anywhere}.tag-snip{font-size:.9em;opacity:.85}.tag-map li,.tag-key li{margin:.35em 0;overflow-wrap:anywhere}
