/* grug school: the look of the study site, taken from the VADemo cave school's grug.css.
   Dark by default (a cave at night, one fire); "day" for people who like a bright page. The two fonts sit beside
   this file and ship with the site; their licences (SIL Open Font License) ship beside them. */

@font-face { font-family: "Source Serif 4"; src: url("source-serif-4-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Public Sans";   src: url("public-sans-latin-wght-normal.woff2") format("woff2");   font-weight: 100 900; font-display: swap; }

:root {
  --cave:    #16120e;
  --cave-2:  #1d1812;
  --rock:    #281f17;
  --rock-2:  #342920;
  --line:    #4a3b2c;
  --bone:    #f0e6d2;
  --bone-2:  #cdbfa6;
  --ember:   #f2a33a;
  --ember-2: #ffc46b;
  --fire:    #ee7048;
  --moss:    #9cc27f;
  --sky:     #52a3c4;
  --clay:    #e0766a;
  --plum:    #c49ad6;
  --code-bg: #0f0c09;
  --shadow:  0 2px 0 #0008, 0 10px 30px #0006;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --display: var(--serif);
  --sans:  "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --on-ember: #1a1208;
  --mono:  ui-monospace, "JetBrains Mono", "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --stone: 14px 6px 12px 8px;       /* a rock is never a rectangle */
  --stone-2: 6px 14px 8px 12px;
}
:root[data-theme="day"] {
  --cave:    #f4ecda;
  --cave-2:  #efe5cf;
  --rock:    #e8dcc0;
  --rock-2:  #dccfae;
  --line:    #c3b18a;
  --bone:    #2a2017;
  --bone-2:  #5a4a38;
  --ember:   #8a4600;
  --ember-2: #8a4600;
  --on-ember: #fffaf0;
  --fire:    #9c3417;
  --moss:    #2f631f;
  --sky:     #1a5b78;
  --clay:    #a8362b;
  --plum:    #7a3d96;
  --code-bg: #fbf6ea;
  --shadow:  0 1px 0 #0002, 0 8px 24px #0001;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
body {
  margin: 0; background: var(--cave); color: var(--bone);
  font: 17px/1.68 var(--sans);
  background-image:
    radial-gradient(1200px 500px at 85% -10%, #f2a33a14, transparent 60%),
    radial-gradient(900px 600px at -10% 110%, #ee704810, transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ember-2); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--fire); }
::selection { background: var(--ember); color: var(--on-ember); }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; border-radius: 4px; }

/* ───────── frame ───────── */
.frame { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr) 15rem; min-height: 100vh; }
/* A page with no headings has no table of contents. Do not hold an empty 15rem rail open beside its copy. */
.frame:where(.no-toc) { grid-template-columns: 17.5rem minmax(0, 1fr); }
.side { position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto; scrollbar-gutter: stable; padding: 1.2rem 1rem 3rem; border-right: 2px dashed var(--line); background: var(--cave-2); }
.toc  { position: sticky; top: 4.6rem; align-self: start; max-height: calc(100vh - 5.5rem); overflow: auto; padding: 0 1.2rem 2rem 0.4rem; font-size: 0.86rem; }
main  { padding: 1.5rem 2.2rem 6rem; max-width: 56rem; width: 100%; margin-inline: auto; }
main h1, main p, main li, main blockquote, main td, main th, .card { overflow-wrap: anywhere; }
@media (max-width: 1200px) { .frame { grid-template-columns: 16rem minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 800px) { .frame { grid-template-columns: minmax(0, 1fr); } .side { position: static; height: auto; border-right: 0; border-bottom: 2px dashed var(--line); } main { padding: 1rem 1rem 5rem; } }

.brand { display: flex; gap: .7rem; align-items: center; text-decoration: none; color: var(--bone); margin-bottom: 1rem; }
.brand svg { width: 3rem; height: 3rem; flex: none; }
.brand strong, .brand b { font: 800 1.25rem/1.1 var(--serif); letter-spacing: -.01em; display: block; }
.brand small { color: var(--bone-2); font-size: .78rem; }
.side nav ol { list-style: none; margin: 0; padding: 0; counter-reset: ch; }
.side nav li { margin: .1rem 0; }
.side nav a { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); gap: .4rem; padding: .38rem .5rem; border-radius: var(--stone); text-decoration: none; color: var(--bone-2); font-size: .9rem; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.side nav a:hover { background: var(--rock); color: var(--bone); }
.side nav a[aria-current="page"] { background: var(--rock-2); color: var(--ember-2); font-weight: 650; }
/* The one current link the page writes before nav.js arrives. The script replaces this tree on the same frame. */
.side nav.here { margin-top: .5rem; }
.side nav a .n { font: 700 .8rem var(--mono); color: var(--ember); padding-top: .1rem; }
.side nav details.group > summary { cursor: pointer; padding: .38rem .5rem; color: var(--bone-2); font-size: .9rem; font-weight: 650; }
.side nav details.group > summary:hover { color: var(--bone); }
.side nav details.group > ol { margin-left: .5rem; }
.side nav a .tick { display: none; }
.side nav a.done .n::after { content: " ✓"; color: var(--moss); }
.side h2 { font: 700 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--bone-2); margin: 1.2rem .5rem .4rem; }
.tools { display: flex; gap: .4rem; flex-wrap: wrap; margin: .6rem 0 0; }
.tools button, .copy, .pill-btn { font: 600 .78rem var(--sans); color: var(--bone); background: var(--rock); border: 1.5px solid var(--line); border-radius: var(--stone); padding: .25rem .6rem; cursor: pointer; }
.tools button:hover, .copy:hover, .pill-btn:hover { background: var(--rock-2); border-color: var(--ember); }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: .8rem; align-items: center; padding: .6rem 0 .7rem; margin: -1.5rem 0 1rem; background: var(--cave); box-shadow: 0 12px 12px -10px var(--cave); }
.search { flex: 1; position: relative; }
.search input { width: 100%; font: 500 .95rem var(--sans); color: var(--bone); background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); padding: .5rem .8rem; }
.search input::placeholder { color: var(--bone-2); }
.search ul { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 9; list-style: none; margin: 0; padding: .3rem; background: var(--cave-2); border: 2px solid var(--ember); border-radius: var(--stone); max-height: 60vh; overflow: auto; box-shadow: var(--shadow); }
.search li a { display: block; padding: .4rem .6rem; border-radius: 6px; text-decoration: none; color: var(--bone); }
.search li a:hover, .search li a.on { background: var(--rock-2); }
.search li small { display: block; color: var(--bone-2); }
.search li.hit-cap { color: var(--bone-2); font: .8rem var(--sans); padding: .3rem .6rem; }
.search li.hit-loading { color: var(--ember-2); font: .85rem var(--sans); padding: .4rem .6rem; }
.search .hit-tier { color: var(--ember-2); font: 700 .72rem var(--sans); margin-right: .4rem; }
.search mark { background: #f2a33a55; color: inherit; border-radius: 3px; }
.search .kinds { display: flex; gap: .3rem; margin-top: .35rem; }
.search .kinds button { font: 600 .72rem var(--sans); color: var(--bone-2); background: var(--rock); border: 1px solid var(--line); border-radius: var(--stone); padding: .15rem .45rem; cursor: pointer; }
.search .kinds button.on { color: var(--on-ember); background: var(--ember); border-color: var(--ember); }

/* ───────── headings and prose ───────── */
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; letter-spacing: -.012em; }
h1 { font-weight: 850; font-size: clamp(2.2rem, 5vw, 3.3rem); margin: .2rem 0 .4rem; }
h1 + .lede { font-size: 1.2rem; color: var(--bone-2); max-width: 44rem; margin: 0 0 1.4rem; }
h2 { font-weight: 800; font-size: 1.85rem; margin: 3.2rem 0 .8rem; padding-bottom: .35rem; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='9' viewBox='0 0 260 9'%3E%3Cpath d='M2 6 C 40 2, 80 8, 130 4 S 220 7, 258 3' stroke='%23f2a33a' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") left bottom / 15rem 9px no-repeat; }
:root[data-theme="day"] h2 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='9' viewBox='0 0 260 9'%3E%3Cpath d='M2 6 C 40 2, 80 8, 130 4 S 220 7, 258 3' stroke='%238a4600' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
:root[data-theme="day"] .toc h2 { background-image: none; }
h3 { font-weight: 750; font-size: 1.3rem; margin: 2.2rem 0 .5rem; color: var(--ember-2); }
h4 { font-weight: 700; font-size: 1.05rem; margin: 1.6rem 0 .3rem; }
h2 .anchor, h3 .anchor { opacity: 0; margin-left: .4rem; text-decoration: none; font-size: .7em; }
h2:hover .anchor, h3:hover .anchor { opacity: .7; }
p { margin: .8rem 0; }
ul, ol { padding-left: 1.4rem; } li { margin: .3rem 0; }
li::marker { color: var(--ember); }
strong { color: var(--bone); font-weight: 700; }
hr { border: 0; border-top: 2px dashed var(--line); margin: 2.5rem 0; }
blockquote { margin: 1rem 0; padding: .1rem 1rem; border-left: 4px solid var(--ember); color: var(--bone-2); }
table { border-collapse: separate; border-spacing: 0; width: 100%; margin: 1.2rem 0; font-size: .93rem; border: 2px solid var(--line); border-radius: var(--stone); overflow: hidden; }
th, td { text-align: left; padding: .5rem .75rem; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--rock); font-weight: 700; color: var(--ember-2); }
tr:last-child td { border-bottom: 0; }
td code, p code, li code, th code { font: .88em var(--mono); background: var(--rock); padding: .08em .35em; border-radius: 5px; color: var(--ember-2); }
kbd { font: .85em var(--mono); background: var(--rock-2); border: 1.5px solid var(--line); border-bottom-width: 3px; padding: .05em .4em; border-radius: 6px; }

/* ───────── code and links into code ───────── */
pre { background: var(--code-bg); border: 2px solid var(--line); border-radius: var(--stone); padding: .8rem 1rem; overflow: auto; font: .84rem/1.55 var(--mono); box-shadow: inset 0 0 0 1px #0004; }
pre code { background: none; padding: 0; color: var(--bone); font: inherit; }
a.src { font: 600 .84em var(--mono); text-decoration: none; color: var(--ember-2); background: var(--rock); border: 1.5px solid var(--line); border-radius: 7px; padding: .08em .45em; white-space: nowrap; }
a.src::before { content: "⌥ "; color: var(--fire); }
a.src:hover { background: var(--rock-2); border-color: var(--ember); color: var(--bone); }
.copy { padding: .05rem .4rem; margin-left: .15rem; font-size: .7rem; vertical-align: middle; opacity: .75; }

/* ───────── grug and junior grug talk ───────── */
.say { display: grid; grid-template-columns: 4.2rem 1fr; gap: .9rem; margin: 1.3rem 0; align-items: start; }
.say .who { display: grid; justify-items: center; gap: .15rem; font: 700 .68rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--bone-2); text-align: center; }
.say .who svg { width: 3.6rem; height: 3.6rem; }
.say .bubble { position: relative; background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); padding: .2rem 1.1rem; box-shadow: var(--shadow); }
.say .bubble::before { content: ""; position: absolute; left: -11px; top: 1.2rem; width: 18px; height: 18px; background: inherit; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.say.junior .bubble { background: var(--cave-2); border-style: dashed; }
.say.junior .bubble p:first-child::before { content: "junior: "; font-weight: 800; color: var(--sky); }
.say.grug .bubble p:first-child::before { content: "grug: "; font-weight: 800; color: var(--ember-2); }
.say .bubble > *:first-child { margin-top: .6rem; } .say .bubble > *:last-child { margin-bottom: .6rem; }

/* ───────── callouts ───────── */
.callout { margin: 1.5rem 0; padding: .2rem 1.2rem .3rem; border: 2px solid var(--line); border-left-width: 8px; border-radius: var(--stone); background: var(--rock); box-shadow: var(--shadow); }
.callout > .callout-label:first-child { margin: .8rem 0 .2rem; font: 800 .78rem var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.callout.panic  { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 10%, var(--rock)); } .callout.panic > .callout-label { color: var(--moss); }
.callout.say-this { border-color: var(--ember); background: color-mix(in srgb, var(--ember) 9%, var(--rock)); } .callout.say-this > .callout-label { color: var(--ember-2); }
.callout.say-this blockquote { border-left-color: var(--ember); color: var(--bone); font: 600 1.05rem/1.5 var(--serif); }
.callout.trap   { border-color: var(--clay); background: color-mix(in srgb, var(--clay) 10%, var(--rock)); } .callout.trap > .callout-label { color: var(--clay); }
.callout.assume { border-color: var(--plum); background: color-mix(in srgb, var(--plum) 9%, var(--rock)); } .callout.assume > .callout-label { color: var(--plum); }
.callout.alt    { border-color: var(--sky); background: color-mix(in srgb, var(--sky) 9%, var(--rock)); } .callout.alt > .callout-label { color: var(--sky); }
.callout.change { border-color: var(--fire); background: color-mix(in srgb, var(--fire) 9%, var(--rock)); } .callout.change > .callout-label { color: var(--fire); }
.recommendation-note { margin: 0 0 1rem; font: 600 .95rem var(--sans); color: var(--plum); }
.callout.why    { border-color: var(--ember-2); } .callout.why > .callout-label { color: var(--ember-2); }
.callout.code-says { border-color: var(--bone-2); } .callout.code-says > .callout-label { color: var(--bone-2); }

/* the banner that says which job a page does, and the box that says where it sits in the path */
.callout.fit { border-color: var(--sky); } .callout.fit > .callout-label { color: var(--sky); }
.callout.kind-tutorial { border-color: var(--fire); } .callout.kind-tutorial > .callout-label { color: var(--fire); }
.callout.kind-how-to { border-color: var(--ember); } .callout.kind-how-to > .callout-label { color: var(--ember-2); }
.callout.kind-reference { border-color: var(--bone-2); } .callout.kind-reference > .callout-label { color: var(--bone-2); }
.callout.kind-explanation { border-color: var(--plum); } .callout.kind-explanation > .callout-label { color: var(--plum); }

/* the front door: a short box above the welcome, built only from data the school already holds */
.front-door { margin: 1rem 0 1.6rem; padding: 1rem 1.2rem; background: var(--cave-2); border: 2px solid var(--ember); border-radius: var(--stone-2); }
.front-door h2 { color: var(--ember-2); margin: .2rem 0 .5rem; font: 700 .95rem/1.5 var(--sans); }
.front-door q { color: var(--bone); }
.front-door p.front-nomachine { color: var(--bone-2); font: .88rem/1.5 var(--sans); margin: .2rem 0 .5rem; }
.front-door p.front-nomachine a { color: var(--ember-2); }
.front-door p.front-start { color: var(--ember-2); font: 700 .9rem/1.4 var(--sans); margin: .2rem 0 .3rem; }
/* The start line and the route are headings so a reader can jump to them; they keep the old cave voice size. */
.front-start h2 { color: var(--ember-2); font: 700 .9rem/1.4 var(--sans); margin: .2rem 0 .3rem; }
.front-start h2.front-secondary { color: var(--bone); font-weight: 600; }
.front-fence { color: var(--bone-2); font: .85rem/1.5 var(--serif); }
.front-door ol.front-five { margin: .4rem 0 .2rem; padding-left: 1.6rem; }
.front-door ol.front-five li { margin: .25rem 0; }
.front-door ol.front-five .front-purpose { color: var(--bone-2); font: .88rem/1.45 var(--sans); }
/* one plain line from the ledger and the survey, then the two ways out of the landing, then the standing words */
.front-strip { color: var(--bone-2); font-size: .92rem; border-left: 3px solid var(--ember); padding-left: .7rem; }
.front-count { color: var(--bone); font-size: .92rem; }
.front-links a, .front-vocab a { color: var(--ember-2); }
/* the way back on generated pages that carry the school's stylesheet, and the page a dead link lands on */
.doc-back, .school-nav { margin: 0 0 1rem; }
.school-back { color: var(--ember-2); font: 600 .85rem var(--sans); }
.wayfinder h1 { color: var(--ember-2); }
.wayfinder-missing code { color: var(--bone); }
.wayfinder-search input { padding: .4rem; min-width: 18rem; }
.wayfinder-results li { margin: .3rem 0; }
.front-words { color: var(--bone); font-size: .92rem; }
.front-vocab { color: var(--bone-2); font-size: .85rem; }
.front-vocab span { color: var(--bone-2); }
/* one voice: a small facts card above the lesson, with no switch and no hidden twin */
.page-facts { margin: .6rem 0 1rem; padding: .7rem .9rem; border: 2px solid var(--line); border-radius: var(--stone); background: var(--rock); }
.page-facts p { margin: .3rem 0; color: var(--bone); font: .92rem/1.45 var(--sans); }
.page-facts b { color: var(--ember-2); }
.page-facts ul { margin: .3rem 0 .2rem; padding-left: 1.2rem; }
.page-facts li { color: var(--bone-2); font: .85rem/1.4 var(--mono); }
.page-lesson h1 { color: var(--bone); font: 800 clamp(2rem, 3.6vw, 2.5rem)/1.1 var(--display); letter-spacing: -.03em; margin: .2rem 0 .5rem; }
.page-lesson h2, .page-lesson h3 { color: var(--bone-2); font: 700 1.05rem var(--sans); margin: .9rem 0 .35rem; }
.page-lesson a { color: var(--ember-2); }
.front-detail { margin: .8rem 0; }
.front-detail > summary { cursor: pointer; color: var(--bone-2); font: .85rem var(--sans); }
/* the snapshot of shipped evidence, with the place a live row must be checked */
.state-facts { margin: .8rem 0; padding: .7rem .9rem; border: 2px solid var(--line); border-radius: var(--stone); background: var(--rock); }
.state-facts p { margin: .3rem 0; color: var(--bone); font: .92rem/1.45 var(--sans); }
.state-facts b { color: var(--ember-2); }
.state-note { color: var(--bone-2); }
/* static pop quiz cards, replaced whole by the page script when it runs */
.pop-static { margin: .7rem 0; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--stone); }
/* the onward list and its map follow the lesson and open only on request */
details.fit { margin: 1.2rem 0 .2rem; border: 2px solid var(--line); border-radius: var(--stone); }
details.fit > summary { cursor: pointer; padding: .5rem .7rem; color: var(--sky); font: 700 .88rem var(--sans); }
/* the measured repo, the full path and the generated chapters open only for the reader who asks */
details.deep { margin: .8rem 0; border: 2px solid var(--line); border-radius: var(--stone); }
details.deep > summary { cursor: pointer; padding: .6rem .8rem; color: var(--ember-2); font: 700 .9rem var(--sans); }
details.deep > summary:hover { color: var(--bone); }
.side .plain-map { display: inline-block; color: var(--ember-2); font: 600 .78rem var(--sans); padding: .25rem .5rem; text-decoration: none; }
/* the ordered path on the first page: one row per topic, with its level and what to read first */
.path { list-style: none; margin: 1.2rem 0; padding: 0; counter-reset: path; }
.path > li { counter-increment: path; position: relative; margin: .35rem 0; padding: .55rem .8rem .55rem 3rem; background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); overflow-wrap: anywhere; }
.path > li::before { content: counter(path); position: absolute; left: .6rem; top: .55rem; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50% 40% 55% 45%; background: var(--ember); color: var(--on-ember); font: 800 .85rem var(--serif); }
.path > li small { display: block; color: var(--bone-2); font: .78rem var(--mono); margin-top: .15rem; }
/* one bounded drawing per level band, so a band with every step drawn scrolls inside its own box */
details.path-band { margin: .8rem 0; }
details.path-band > summary { cursor: pointer; color: var(--ember-2); font: 700 .9rem var(--sans); }
details.path-band figure.diagram { max-height: 24rem; }
/* one link from the last step of a band to the first of the next, so the levels read as one path */
.path-band-link { margin: .2rem 0 .2rem 1rem; color: var(--bone-2); font-size: .85rem; }
.path-band-link a { color: var(--ember-2); }

/* ───────── diagrams ───────── */
figure.diagram { margin: 1.6rem 0; padding: 1rem; background: var(--cave-2); border: 2px solid var(--line); border-radius: var(--stone-2); overflow: auto; }
figure.diagram figcaption { font: 600 .84rem var(--sans); color: var(--bone-2); margin-top: .6rem; text-align: center; }
figure.diagram .mermaid { display: block; text-align: center; }
figure.diagram svg { height: auto; min-width: min(40rem, 100%); margin-inline: auto; }
details.path-band figure.diagram { max-width: 27rem; margin-inline: auto; }
details.path-band figure.diagram svg { min-width: 0; max-width: 25rem; }
/* the band figure already draws the border, so the pre inside it must not draw a second one */
figure.diagram pre.mermaid { border: 0; box-shadow: none; padding: .4rem; background: transparent; }
figure.diagram .diagram-scroll { overflow: auto; }
/* the hint the script adds when a drawing is wider than its box, and removes when the box grows */
figure.diagram figcaption.scroll-cue { color: var(--ember-2); font-size: .8rem; }
figure.diagram figcaption.scroll-cue::before { content: "↔ "; }
/* the cue appended to a caption that already says what the band left out keeps the amber look */
figure.diagram figcaption .scroll-cue-text { color: var(--ember-2); font-size: .8rem; display: block; }
figure.diagram figcaption .scroll-cue-text::before { content: " ↔ "; }
.ascii { font: .82rem/1.35 var(--mono); }

/* ───────── council notes ───────── */
/* A council note is an aside in the lesson, not a second page. The full border and tinted ground keep it in the
   cave's visual language; nothing here needs a script. Long names and long evidence labels wrap at any width. */
.council-note { margin: 1.6rem 0; padding: .8rem 1rem; border: 2px solid var(--line); border-radius: var(--stone); background: color-mix(in srgb, var(--plum) 7%, var(--rock)); min-width: 0; overflow-wrap: anywhere; }
.council-note > h3 { margin: .2rem 0 .25rem; font: 750 1.05rem/1.3 var(--sans); color: var(--plum); }
.council-note > h4 { margin: 0 0 .5rem; font: 700 1rem/1.35 var(--serif); color: var(--bone); }
.council-note .council-copy { margin: .3rem 0 .6rem; color: var(--bone); font: .95rem/1.55 var(--sans); }
.council-note .council-evidence { margin: .3rem 0 .6rem; padding-left: 1.2rem; min-width: 0; }
.council-note .council-evidence li { color: var(--bone-2); font: .86rem/1.5 var(--sans); overflow-wrap: anywhere; }
.council-note .council-evidence a { font: 600 .84em var(--mono); color: var(--ember-2); overflow-wrap: anywhere; }
.council-note .council-evidence a:hover { color: var(--fire); }
.council-note figure.council-diagram { margin: .7rem 0 .3rem; padding: .5rem .7rem; background: var(--cave-2); border: 2px solid var(--line); border-radius: var(--stone); min-width: 0; }
.council-note figure.council-diagram figcaption { font: 600 .78rem/1.4 var(--sans); color: var(--bone-2); margin-top: .4rem; text-align: center; }
.council-flow { list-style: none; margin: 0; padding: 0; counter-reset: council; min-width: 0; }
.council-flow > li { counter-increment: council; position: relative; margin: .3rem 0; padding: .35rem .6rem .35rem 2.2rem; background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); overflow-wrap: anywhere; }
.council-flow > li::before { content: counter(council); position: absolute; left: .6rem; top: .35rem; width: 1.2rem; height: 1.2rem; display: grid; place-items: center; border-radius: 50% 40% 55% 45%; background: var(--ember); color: var(--on-ember); font: 800 .72rem var(--serif); }
.council-flow > li[data-next]::after { content: " then " attr(data-next); display: block; margin-top: .2rem; color: var(--ember-2); font: 600 .78rem/1.4 var(--sans); overflow-wrap: anywhere; }
.council-flow small { display: block; color: var(--bone-2); font: .82rem/1.45 var(--sans); overflow-wrap: anywhere; }
/* At 320px the note keeps its full border and gives the copy every pixel. No fixed width enters this block. */
@media (max-width: 320px) {
  .council-note { padding: .6rem .65rem; }
  .council-note > h3 { font-size: .98rem; }
  .council-note .council-evidence { padding-left: 1rem; }
  .council-flow > li { padding-left: 2rem; }
}

/* ───────── cards, steps, quiz ───────── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 1.4rem 0; }
.card { background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); padding: .2rem 1rem .6rem; box-shadow: var(--shadow); }
.card h4 { margin: .8rem 0 .2rem; color: var(--ember-2); }
.card p { font-size: .94rem; margin: .4rem 0; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding: .5rem .8rem .5rem 3.2rem; margin: .7rem 0; background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); }
.steps > li::before { content: counter(step); position: absolute; left: .7rem; top: .45rem; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50% 40% 55% 45%; background: var(--ember); color: var(--on-ember); font: 800 1rem var(--serif); }
details.quiz { margin: .8rem 0; background: var(--cave-2); border: 2px dashed var(--line); border-radius: var(--stone); padding: .1rem 1rem; }
details.quiz > summary { cursor: pointer; font-weight: 650; padding: .7rem 0; list-style: none; }
details.quiz > summary::before { content: "❓ "; }
details.quiz[open] > summary { color: var(--ember-2); }
details.quiz > div { padding: 0 0 .6rem; border-top: 1px dashed var(--line); }
details.fold { margin: 1rem 0; border: 2px solid var(--line); border-radius: var(--stone); background: var(--cave-2); padding: 0 1rem; }
details.fold > summary { cursor: pointer; padding: .7rem 0; font: 750 1rem var(--serif); color: var(--ember-2); }
.check { display: flex; gap: .6rem; align-items: start; padding: .35rem .2rem; }
.check input { margin-top: .35rem; accent-color: var(--ember); width: 1.1rem; height: 1.1rem; }
.check input:checked + span { text-decoration: line-through; color: var(--bone-2); }
.tag { display: inline-block; font: 700 .75rem var(--sans); letter-spacing: .08em; text-transform: uppercase; padding: .1rem .5rem; border-radius: 999px; border: 1.5px solid var(--line); color: var(--bone-2); vertical-align: middle; }
.tag.must { border-color: var(--fire); color: var(--fire); } .tag.nice { border-color: var(--sky); color: var(--sky); } .tag.skim { border-color: var(--moss); color: var(--moss); }
.tag-legend { color: var(--bone-2); font-size: .9rem; } .tag-legend .tag { font-size: .75rem; }
.grug-definition { color: var(--bone-2); font-size: .9rem; margin: .4rem 0 1rem; }
.meter { display: flex; gap: .3rem; align-items: center; font-size: .82rem; color: var(--bone-2); }
.next { display: flex; justify-content: space-between; gap: 1rem; margin-top: 4rem; padding-top: 1.4rem; border-top: 2px dashed var(--line); }
.next a { flex: 1; padding: .9rem 1.1rem; background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); text-decoration: none; color: var(--bone); }
.next a small { display: block; color: var(--bone-2); } .next a b { font: 800 1.1rem var(--serif); color: var(--ember-2); }
.next a:hover { border-color: var(--ember); } .next .r { text-align: right; }
.next span.foot-before, .next span.foot-next { color: var(--bone-2); font: .85rem/1.4 var(--sans); }
.next span.foot-next { text-align: right; }
.toc h2 { background: none; font: 700 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--bone-2); margin: 0 0 .5rem; padding: 0; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc li { margin: 0; } .toc li.h3 { padding-left: .8rem; font-size: .92em; }
.toc a { display: block; padding: .22rem .7rem; color: var(--bone-2); text-decoration: none; line-height: 1.3; }
.toc a:hover, .toc a.on { color: var(--ember-2); background: var(--rock); }
.toc a.on { box-shadow: inset 3px 0 0 var(--ember); }

@media print { .side, .toc, .top, .next, .tools { display: none; } .frame { display: block; } body { background: #fff; color: #000; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ───────── grill rounds, questions, walkthroughs, pop quiz ───────── */
section.round { margin: 2rem 0; padding: .1rem 1.2rem 1rem; border: 2px dashed var(--line); border-radius: var(--stone-2); background: color-mix(in srgb, var(--rock) 45%, transparent); }
section.round > h3 { margin-top: 1.1rem; }
.why-next { color: var(--bone-2); font-size: .94rem; margin-top: -.2rem; }
.q { margin: 1.1rem 0; padding: .1rem 1rem .5rem; background: var(--rock); border: 2px solid var(--line); border-left: 8px solid var(--sky); border-radius: var(--stone); box-shadow: var(--shadow); }
.q[data-level="1"] { border-left-color: var(--fire); } .q[data-level="2"] { border-left-color: var(--ember); } .q[data-level="3"] { border-left-color: var(--plum); }
.q[data-level="4"] { border-left-color: var(--sky); } .q[data-level="5"] { border-left-color: var(--moss); } .q[data-level="6"] { border-left-color: var(--clay); }
.q .qt { padding: .7rem 0 .3rem; font-size: 1.02rem; }
.q .qt b { font-family: var(--serif); color: var(--ember-2); }
.q .lv { float: right; margin-left: .6rem; }
details.qa { margin: .3rem 0 0; }
details.qa > summary { cursor: pointer; font: 700 .86rem var(--sans); color: var(--sky); padding: .35rem 0; list-style: none; }
details.qa > summary::before { content: "⮞ "; }
details.qa[open] > summary::before { content: "⮟ "; }
details.qa .rec { border-top: 1px dashed var(--line); padding-top: .4rem; }
details.qa .rec > p:first-child::before { content: "➡️ "; }
.rate { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 .2rem; font-size: .85rem; color: var(--bone-2); }
.rate button { font: 700 .8rem var(--sans); color: var(--bone); background: var(--cave-2); border: 2px solid var(--line); border-radius: var(--stone); padding: .3rem .8rem; cursor: pointer; }
.rate button:hover { border-color: var(--ember); } .rate button.on { background: var(--ember); color: var(--on-ember); border-color: var(--ember); }
.rate .got:hover, .rate .got.on { background: var(--moss); border-color: var(--moss); color: #10200a; }
.rate .blank:hover, .rate .blank.on { background: var(--clay); border-color: var(--clay); color: #2a0d09; }

.walk { margin: 1.8rem 0; border: 2px solid var(--ember); border-radius: var(--stone-2); background: var(--cave-2); box-shadow: var(--shadow); overflow: hidden; }
.walk > .bar { display: flex; gap: .8rem; align-items: center; justify-content: space-between; padding: .6rem 1rem; background: var(--rock-2); border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.walk > .bar b { font: 800 1rem var(--serif); color: var(--ember-2); }
.walk .dots { display: flex; gap: .3rem; flex-wrap: wrap; }
.walk .dots button { width: .9rem; height: .9rem; border-radius: 50%; border: 2px solid var(--line); background: var(--cave); padding: 0; cursor: pointer; }
.walk .dots button.here { background: var(--ember); border-color: var(--ember); } .walk .dots button.seen { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 45%, var(--cave)); }
.walk > .step { padding: .2rem 1.3rem 1rem; } .walk.js > .step { display: none; } .walk.js > .step.here { display: block; }
.walk > .step > .callout-label { font: 800 1.35rem var(--serif); margin-top: 1rem; }
.predict { margin: 1rem 0; padding: .1rem 1rem .4rem; border: 2px dashed var(--sky); border-radius: var(--stone); }
.predict > p:first-child { font-weight: 700; color: var(--sky); }
.walk > .foot { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; border-top: 2px solid var(--line); background: var(--rock); }

.pop { margin: 1.5rem 0; }
.pop .controls { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.pop select, .pop .pill-btn { font: 600 .9rem var(--sans); color: var(--bone); background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); padding: .4rem .7rem; }
.pop .card-q { padding: .4rem 1.3rem 1.2rem; background: var(--rock); border: 2px solid var(--ember); border-radius: var(--stone-2); box-shadow: var(--shadow); min-height: 12rem; }
.pop .meta { color: var(--bone-2); font-size: .82rem; margin-top: .9rem; }
.pop .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .7rem; margin: 1.4rem 0; }
.pop .stat { background: var(--cave-2); border: 2px solid var(--line); border-radius: var(--stone); padding: .6rem .9rem; } .pop .stat b { display: block; font: 800 1.7rem var(--serif); color: var(--ember-2); }
.copy { display: none; }
a.src:hover + .copy, a.src:focus + .copy, .copy:hover, .copy:focus { display: inline-block; }

/* ───────── what the engine adds to the cave look ───────── */
/* highlight.js tokens, in the cave's colours, so a fenced block reads like the snippets in the explainers. */
pre code.hljs { background: none; padding: 0; color: var(--bone); }
.hljs-comment, .hljs-quote { color: #8a7a64; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-doctag { color: #f2a33a; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #b6d28f; }
.hljs-title, .hljs-type, .hljs-class .hljs-title, .hljs-attr, .hljs-name { color: #86b9d0; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-variable, .hljs-bullet { color: #c49ad6; }
.hljs-meta, .hljs-deletion { color: #e0766a; }
:root[data-theme="day"] .hljs-comment, :root[data-theme="day"] .hljs-quote { color: #7c6c56; }
:root[data-theme="day"] .hljs-keyword, :root[data-theme="day"] .hljs-selector-tag, :root[data-theme="day"] .hljs-built_in, :root[data-theme="day"] .hljs-doctag { color: #a8590a; }
:root[data-theme="day"] .hljs-string, :root[data-theme="day"] .hljs-regexp, :root[data-theme="day"] .hljs-addition { color: #3d7a2a; }
:root[data-theme="day"] .hljs-title, :root[data-theme="day"] .hljs-type, :root[data-theme="day"] .hljs-attr, :root[data-theme="day"] .hljs-name { color: #1f6a8a; }
:root[data-theme="day"] .hljs-number, :root[data-theme="day"] .hljs-literal, :root[data-theme="day"] .hljs-symbol, :root[data-theme="day"] .hljs-variable, :root[data-theme="day"] .hljs-bullet { color: #7a3d96; }
:root[data-theme="day"] .hljs-meta, :root[data-theme="day"] .hljs-deletion { color: #a8362b; }

/* ───────── the source viewer: a cited file, one anchor per line, lit by the tokens above ───────── */
pre.src { margin: 0 0 1.4rem; }
pre.src .ln { display: inline-block; min-width: 3.4rem; margin-right: 1rem; padding-right: .8rem; text-align: right; color: var(--bone-2); opacity: .55; user-select: none; -webkit-user-select: none; }
:root[data-theme="day"] pre.src .ln { opacity: .8; }
body.source-viewer { padding: 1.6rem 1.4rem 5rem; }
body.source-viewer .back { margin: 0; font-size: .9rem; }
body.source-viewer h1 { font: 700 1.1rem var(--mono); color: var(--ember-2); margin: .2rem 0 1.2rem; overflow-wrap: anywhere; }

/* the line under a topic's heading: level, what it teaches, what it needs */
.meta { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1rem; }
a.card { display: block; min-width: 0; overflow-wrap: anywhere; text-decoration: none; color: var(--bone); }
li code, p code, td code, th code, blockquote code { overflow-wrap: anywhere; }
a.card:hover { border-color: var(--ember); }
a.card h4 { margin: .8rem 0 .2rem; }
a.card small { color: var(--bone-2); font-family: var(--mono); font-size: .78rem; overflow-wrap: anywhere; }
.side nav a .lv { display: none; }
.menu { display: none; }
@media (max-width: 800px) {
  .menu { display: inline-block; }
  .side nav { display: none; }
  .side.open nav { display: block; }
}
.done-row { margin-top: 3rem; }

/* ───────── answering a question on the page ───────── */
.grill-score { color: var(--bone-2); font-size: .9rem; margin: .8rem 0 0; }
.q .opts { list-style: none; margin: .4rem 0 .5rem; padding: 0; display: grid; gap: .5rem; }
.q .opts li { margin: 0; }
.q .opt { width: 100%; text-align: left; font: 600 .95rem/1.4 var(--sans); color: var(--bone); background: var(--cave-2); border: 2px solid var(--line); border-radius: var(--stone); padding: .65rem .9rem; cursor: pointer; }
.q .opt:hover:not(:disabled) { border-color: var(--ember); background: var(--rock-2); }
.q .opt:disabled { cursor: default; opacity: .8; }
.q .opt.is-right { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 18%, var(--cave-2)); opacity: 1; }
.q .opt.is-wrong { border-color: var(--clay); background: color-mix(in srgb, var(--clay) 18%, var(--cave-2)); opacity: 1; }
.q .exact { display: flex; gap: .5rem; margin: .4rem 0 .5rem; }
.q .exact input { flex: 1; min-width: 0; font: 500 1rem var(--mono); color: var(--bone); background: var(--cave-2); border: 2px solid var(--line); border-radius: var(--stone); padding: .55rem .8rem; }
.q .exact input:focus { border-color: var(--ember); outline: none; }
.q .fb { margin: .3rem 0 .4rem; padding: .5rem .8rem; border-radius: var(--stone); border: 2px solid var(--line); background: var(--cave-2); }
.q.right { border-left-color: var(--moss); } .q.wrong { border-left-color: var(--clay); }
.q.right .fb { border-color: var(--moss); } .q.wrong .fb { border-color: var(--clay); }
.q .fb .again { margin-left: .4rem; }
.qa-prompt { color: var(--sky); font-size: .85rem; margin: .3rem 0; }
.q.answered { border-left-color: var(--moss); }
.q.answered .fb { border-color: var(--moss); }
.toc li.h2 { font-weight: 650; margin-top: .4rem; }
.top { margin-bottom: 1.2rem; }
.search ul a.on { background: var(--rock-2); }
.pop .card-q .q { box-shadow: none; border: 0; background: none; padding: 0; }

/* ───────── the demon watch, and the why under an answer ───────── */
.callout.demon { border-color: var(--fire); background: color-mix(in srgb, var(--fire) 14%, var(--rock)); }
.callout.demon > .callout-label { color: var(--fire); }
.callout.demon > .callout-label::before { content: "⚠ "; }
.callout.demon ul { margin: .4rem 0; }
.why-answer { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--line); }
.why-answer > b { display: block; margin-bottom: .2rem; font: 800 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--sky); }

/* ───────── same job, two answers: where two implementations differ and why ───────── */
.callout.versus { border-color: var(--sky); background: color-mix(in srgb, var(--sky) 11%, var(--rock)); }
.callout.versus > .callout-label { color: var(--sky); }
.callout.versus > .callout-label::before { content: "⇄ "; }

/* ───────── the lay of the land table ───────── */
table.land th { text-align: left; vertical-align: top; width: 14rem; }
table.land td { font-family: var(--mono); font-size: .86rem; word-break: break-word; }
table.land details.fold summary { cursor: pointer; color: var(--ember-2); }
table.land tr.differs th::before { content: "⇄ "; color: var(--sky); }
table.land tr.differs td { color: var(--ember-2); }

/* ───────── the version table: a project, its version, and the line that carries it ───────── */
table.versions caption { text-align: left; padding: .5rem .75rem; color: var(--bone-2); font-size: .86rem; }
table.versions th[scope="row"] { font-weight: 600; white-space: nowrap; }
table.versions td { font-family: var(--mono); font-size: .88rem; word-break: break-word; }
table.versions td a { color: var(--ember-2); text-decoration: underline dotted; }

/* the coverage table: a component, its kind, its standing, the reason and the topics that cover it */
table.coverage caption { text-align: left; padding: .5rem .75rem; color: var(--bone-2); font-size: .86rem; }
table.coverage th[scope="row"] { font-weight: 600; }
table.coverage td { font-family: var(--mono); font-size: .88rem; word-break: break-word; vertical-align: top; }
table.coverage td a { color: var(--ember-2); text-decoration: underline dotted; }
table.coverage tr[data-standing="known-gap"] td:nth-child(3) { color: var(--ember-2); }
table.coverage tr[data-standing="not-applicable"] td:nth-child(3) { color: var(--bone-2); }

/* ───────── diagrams: the engine's own lay-of-the-land picture, and authored mermaid ───────── */
svg.land-diagram { min-width: 40rem; height: auto; max-width: 42rem; display: block; margin: 0 auto; }
svg.land-diagram .dg-box { fill: var(--rock); stroke: var(--line); stroke-width: 2; }
svg.land-diagram .dg-contract { fill: var(--cave-2); stroke: var(--bone-2); stroke-width: 2; stroke-dasharray: 6 4; }
svg.land-diagram .dg-a { stroke: var(--ember); } svg.land-diagram .dg-b { stroke: var(--sky); }
svg.land-diagram .dg-c { stroke: var(--moss); } svg.land-diagram .dg-d { stroke: var(--plum); }
svg.land-diagram .dg-loose { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 3 5; }
svg.land-diagram text { fill: var(--bone); font: 600 13px var(--sans); }
svg.land-diagram text.dg-small { fill: var(--bone-2); font: 500 11px var(--sans); }
svg.land-diagram path.dg-link { fill: none; stroke: var(--bone-2); stroke-width: 2; marker-end: url(#dg-arrow); }
svg.land-diagram #dg-arrow path { fill: var(--bone-2); }
.rung { color: var(--ember-2); font: 700 .95rem var(--sans); padding: .5rem .8rem; background: var(--rock); border: 2px solid var(--ember); border-radius: var(--stone); }
.rung[data-level="0"] { color: var(--bone-2); border-color: var(--line); }
.rung-note { color: var(--bone-2); font: .85rem var(--sans); margin: .3rem .8rem 1rem; }
.levels { counter-reset: step; list-style: none; padding: 0; margin: 1.2rem 0; }
.levels > li { counter-increment: step; position: relative; padding: .5rem .8rem .5rem 3.2rem; margin: .7rem 0; background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); }
.levels > li::before { content: counter(step); position: absolute; left: .7rem; top: .45rem; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50% 40% 55% 45%; background: var(--ember); color: var(--on-ember); font: 800 1rem var(--serif); }
.welcome-steps { counter-reset: step; list-style: none; padding: 0; }
.welcome-steps > li { counter-increment: step; position: relative; padding: .5rem .8rem .5rem 3.2rem; margin: .7rem 0; background: var(--rock); border: 2px solid var(--line); border-radius: var(--stone); }
.welcome-steps > li::before { content: counter(step); position: absolute; left: .7rem; top: .45rem; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50% 40% 55% 45%; background: var(--ember); color: var(--on-ember); font: 800 1rem var(--serif); }

/* ───────── proof and illustration: what the school ran, and what it invented ───────── */
.callout.proof { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 10%, var(--rock)); }
.callout.proof > .callout-label { color: var(--moss); }
.callout.proof > .callout-label::before { content: "✓ "; }
.callout.proof pre { margin: .3rem 0 .6rem; }
.illustration-tag { display: inline-block; margin: 1rem 0 .2rem; padding: .05rem .6rem; font: 700 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--plum); border: 1.5px dashed var(--plum); border-radius: 999px; }

/* The risk ledger: the verdict a school gives each failure mode, as a badge. Colour carries it, and the word does too. */
.verdict { display: inline-block; padding: .1rem .65rem; border-radius: 999px; border: 1px solid currentColor; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.verdict.v-handled { color: var(--moss); }
.verdict.v-partial { color: var(--ember); }
.verdict.v-missing { color: var(--fire); }
.verdict.v-not-applicable { color: var(--bone-2); }
.verdict.v-unreviewed { color: var(--sky); border-style: dashed; }
.risk-tally { display: flex; flex-wrap: wrap; gap: .5rem .8rem; margin: .6rem 0 1.2rem; padding: 0; list-style: none; }

/* bridge mode: the folds that teach this project's language by contrast with one the reader knows */
.bridges { margin-top: 2.2rem; }
.bridge { border: 1.5px solid var(--line); border-radius: var(--stone); background: var(--rock); margin: .7rem 0; padding: .2rem .9rem; }
.bridge > summary { cursor: pointer; font: 650 .95rem var(--sans); color: var(--bone); padding: .5rem 0; }
.bridge[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: .6rem; }
.bridge-note { font: .82rem var(--sans); color: var(--bone-2); border-left: 3px solid var(--ember); padding-left: .6rem; margin: .4rem 0 .8rem; }

/* the recorded offline track: a step list, then every saved front-door output the school actually ships */
.offline-track { max-width: 62rem; margin: 0 auto; padding: 1.2rem; }
.offline-caveat { color: var(--bone-2); font: .92rem/1.5 var(--sans); border-left: 3px solid var(--ember); padding-left: .7rem; }
.offline-steps { padding-left: 1.4rem; }
.offline-step { margin: .8rem 0 1.4rem; padding: .7rem .9rem; border: 1.5px solid var(--line); border-radius: var(--stone); background: var(--rock); list-style: none; }
.offline-job { color: var(--bone-2); font: .9rem/1.4 var(--sans); }
.offline-command, .offline-anchor { background: var(--cave, #101010); color: var(--bone); padding: .5rem .7rem; overflow-x: auto; }
.offline-command code, .offline-anchor code { font: .85rem/1.5 var(--mono); }
.offline-output-line { color: var(--ember-2); font: .85rem/1.4 var(--sans); }
.offline-recordings { margin: 1.6rem 0; padding: .7rem .9rem; border: 1.5px solid var(--line); border-radius: var(--stone); }
.offline-recordings h2 { font: 700 1.05rem var(--sans); color: var(--bone-2); }
.offline-recordings li { margin: .35rem 0; font: .85rem/1.4 var(--sans); }
.offline-recordings code { color: var(--ember-2); font: .84rem/1.4 var(--mono); }

/* the runnable lab: a toy world that actually runs in the browser, with a load-time self-check */
.lab-caveat { color: var(--bone-2); font: .9rem/1.55 var(--sans); border-left: 3px solid var(--ember); padding-left: .7rem; }
.lab-selfcheck { font: .8rem/1.4 var(--mono); padding: .4rem .6rem; border-radius: var(--stone); }
.lab-selfcheck.ok { color: #9fe0a0; background: #12301a; }
.lab-selfcheck.bad { color: #ffd0d0; background: #401515; }
.lab-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.lab-tabs button { padding: .35rem .7rem; background: var(--rock); color: var(--bone-2); border: 1.5px solid var(--line); border-radius: var(--stone); cursor: pointer; }
.lab-tabs button.on { color: var(--ember-2); border-color: var(--ember); }
.lab-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin: .6rem 0 1rem; }
.lab-controls label { color: var(--bone-2); font: .84rem var(--sans); }
.lab-controls input[type=number] { width: 5rem; padding: .3rem; background: var(--rock); color: var(--bone); border: 1px solid var(--line); }
.lab-controls .lab-defect { display: inline-flex; align-items: center; gap: .35rem; }
.lab-trace { border-collapse: collapse; width: 100%; margin: .6rem 0; font: .84rem/1.5 var(--mono); }
.lab-trace th, .lab-trace td { border: 1px solid var(--line); padding: .3rem .5rem; text-align: left; }
.lab-trace th { color: var(--ember-2); background: var(--rock); }
.lab-trace tr.broken td { color: #ffb0b0; }
.lab-verdict { font: .9rem/1.5 var(--sans); padding: .4rem .7rem; border-radius: var(--stone); }
.lab-verdict.green { color: #9fe0a0; background: #12301a; }
.lab-verdict.red { color: #ffd0d0; background: #401515; }
.lab-replay { font: .82rem/1.5 var(--sans); }
.lab-replay.ok { color: #9fe0a0; }
.lab-replay.bad { color: #ffd0d0; }
.lab-ledger { font: .82rem/1.6 var(--mono); color: var(--bone-2); }
.lab-ledger code { color: var(--ember-2); }
.lab-measurement { background: var(--rock); border: 1px solid var(--line); border-radius: var(--stone); padding: .7rem .9rem; color: var(--bone); font: .86rem/1.7 var(--mono); white-space: pre-wrap; }
.lab-warning { border-left: 4px solid var(--ember-2); padding-left: .7rem; color: var(--ember-2); }
/* Offline practice over saved output. One stylesheet owns these rules; the page no longer inlines a <style> block. */
.offline-track { max-width: 62rem; }
.practice-banner { border-left: 4px solid #8a6d3b; background: rgba(138,109,59,.18); padding: .75rem 1rem; }
.practice-scenario { border: 1px solid var(--line); border-radius: 6px; padding: 1rem; margin: 1.5rem 0; }
.practice-command, .practice-output { background: var(--rock); color: var(--bone); padding: .75rem; overflow-x: auto; white-space: pre-wrap; }
.practice-output { margin-top: .75rem; }
.practice-guess { display: block; width: 100%; max-width: 32rem; padding: .4rem; margin: .5rem 0; }
.practice-check, .practice-reveal { padding: .4rem .8rem; margin: .25rem .25rem .25rem 0; cursor: pointer; }
.callout.measurement { margin: .8rem 0; padding: .7rem .9rem; border-left: 4px solid var(--ember-2); background: var(--rock); }
.callout.measurement pre { margin: .5rem 0; white-space: pre-wrap; color: var(--bone); font: .84rem/1.6 var(--mono); }
.practice-options { display: flex; flex-direction: column; gap: .4rem; margin: .6rem 0; }
.practice-option { text-align: left; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--stone); background: var(--rock); color: var(--bone); cursor: pointer; }
.practice-option.on { border-color: var(--ember-2); color: var(--ember-2); }
.useful-resources { margin: 1.5rem 0; padding: .2rem 1.2rem .8rem; border: 2px solid var(--line); border-left-width: 8px; border-radius: var(--stone); background: var(--rock); }
.useful-resources h2 { margin: .8rem 0 .3rem; }
.useful-resources > p { color: var(--bone); opacity: .8; font-size: .9rem; }
.useful-resources ul { margin: .4rem 0; padding-left: 1.2rem; }
.useful-resources li { margin: .5rem 0; }
.useful-resources li p { margin: .15rem 0; color: var(--bone); font-size: .92rem; }
.resource-group dl { margin: .15rem 0; }
.resource-group dt { display: inline-block; font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ember-2); }
.resource-group dd { display: inline; margin: 0; }
.resource-group dd.resource-url { color: var(--bone-2); font-size: .85rem; overflow-wrap: anywhere; }
.resource-kind { font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ember-2); margin-left: .4rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ───────── narrative context and tool notes ─────────
   The page contract opens a lesson on context and explains a teaching tool once. Every colour here comes from the
   cave palette variables, so the day theme needs no second rule: the same vars flip under :root[data-theme="day"]. */
.lesson-context { max-width: 68ch; margin: 1.6rem 0 1.1rem; padding: .85rem 1.1rem; background: var(--rock); border: 1.5px solid var(--line); border-radius: var(--stone-2); }
.lesson-context p { margin: .3rem 0; font-size: .97rem; line-height: 1.6; }
.lesson-context .context-label { display: inline-block; min-width: 3.6rem; margin-right: .45rem; font: 700 .66rem var(--sans); letter-spacing: .11em; text-transform: uppercase; color: var(--bone-2); }
.lesson-context .already .context-label { color: var(--sky); }
.lesson-context .learns .context-label { color: var(--ember-2); }
.tool-notes { max-width: 68ch; margin: 0 0 1.3rem; display: flex; flex-direction: column; gap: .45rem; }
.tool-note.first { font-size: .9rem; color: var(--bone-2); background: var(--cave-2); border: 1px dashed var(--line); border-radius: var(--stone-2); padding: .55rem .85rem; }
.tool-note.first p { margin: 0 0 .3rem; }
.tool-note.again { font-size: .84rem; align-self: start; color: var(--bone-2); text-decoration-style: dotted; }
.tool-note.again:hover { color: var(--bone); }
/* The central tool reference: one section per tool, generous spacing over the 70ch measure. */
.tool-entry { max-width: 70ch; margin: 2.4rem 0; padding: 1.05rem 1.25rem 1.15rem; background: var(--rock); border: 1.5px solid var(--line); border-radius: var(--stone-2); }
.tool-entry h2 { margin: .2rem 0 .7rem; font-size: 1.5rem; }
.tool-entry p { margin: .45rem 0; font-size: .96rem; }
.tool-entry b { font: 700 .7rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--bone-2); margin-right: .4rem; }
.tool-entry .tool-why b { color: var(--ember-2); }

/* ───────── the visual thesis, and the mutation a lesson shows ─────────
   The thesis figure frames the one drawing a lesson opens with: generous space and a stone frame. A drawing wider
   than the frame scrolls inside its own box, with a fading edge and a short hint so the cut is visible. The
   mutation contrast puts the line as it was beside the line as the mutant carried it, with the declared
   expectation beside the recorded observation, in the cave's own colours. Day rules follow the night ones. */
.thesis-diagram { max-width: 62rem; margin: 2rem 0 1.6rem; padding: 1.2rem 1.4rem 1.1rem; background: var(--cave-2); border: 2px solid var(--line); border-bottom: 4px solid var(--ember); border-radius: var(--stone-2); box-shadow: var(--shadow); }
.thesis-frame { position: relative; display: flex; flex-direction: column; }
.thesis-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-color: var(--ember) var(--rock); scrollbar-width: thin; }
.thesis-scroll img { display: block; width: 100%; min-width: 46rem; max-width: 58rem; height: auto; margin-inline: auto; }
.thesis-diagram > img { display: block; max-width: 100%; height: auto; }
.thesis-diagram figcaption { margin-top: .8rem; font: 600 .84rem var(--sans); color: var(--bone-2); text-align: center; }
.thesis-hint { display: none; order: -1; margin: 0 0 .6rem; text-align: center; font: 600 .8rem var(--sans); color: var(--ember-2); }
.thesis-hint::before { content: "↔ "; }
@media (max-width: 86rem) {
  .thesis-frame::after { content: ""; position: absolute; top: 1.9rem; right: 0; bottom: 0; width: 3.5rem; background: linear-gradient(to right, transparent, var(--cave-2)); pointer-events: none; }
  .thesis-hint { display: block; }
}
:root[data-theme="day"] .thesis-diagram { border-color: var(--line); border-bottom-color: var(--ember); box-shadow: 0 1px 0 #0002, 0 8px 24px #0001; }
:root[data-theme="day"] .thesis-diagram figcaption { color: var(--bone-2); }

.mutation-contrast { max-width: 72ch; margin: 2rem 0 1.6rem; padding: 1rem 1.3rem 1.1rem; background: var(--rock); border: 2px solid var(--line); border-bottom: 4px solid var(--fire); border-radius: var(--stone-2); box-shadow: var(--shadow); }
.mutation-contrast .mutation-what { margin: .2rem 0 .8rem; font-size: .92rem; color: var(--bone-2); }
.mutation-contrast code { font: .88em var(--mono); background: var(--rock-2); padding: .08em .35em; border-radius: 5px; color: var(--ember-2); overflow-wrap: anywhere; }
.mutation-contrast .mutation-line { margin: 0 0 .6rem; padding: .55rem .8rem; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--stone); white-space: pre-wrap; overflow-x: auto; }
.mutation-contrast .mutation-line.original { border-bottom-color: var(--moss); }
.mutation-contrast .mutation-line.mutated { border-bottom-color: var(--fire); }
.mutation-contrast .mutation-verdict { margin: .7rem 0 .2rem; font: 650 .92rem var(--sans); color: var(--ember-2); }
.mutation-contrast .mutation-explain { margin: .4rem 0; font-size: .92rem; color: var(--sky); }
.mutation-contrast .mutation-evidence { margin: .7rem 0 .2rem; font-size: .85rem; color: var(--bone-2); }
:root[data-theme="day"] .mutation-contrast { border-bottom-color: var(--fire); }
:root[data-theme="day"] .mutation-contrast .mutation-line.original { border-bottom-color: var(--moss); }
:root[data-theme="day"] .mutation-contrast .mutation-line.mutated { border-bottom-color: var(--fire); }

/* Overturned decisions stay readable as history, never as current architecture. */
.adr-overturned { display: block; margin: 2.4rem 0 1.4rem; padding: 1.2rem 1.4rem 1.4rem; background: var(--rock); border: 2px dashed var(--clay); border-radius: var(--stone-2); }
.adr-overturned > h2 { margin-top: 0; color: var(--clay); text-transform: uppercase; letter-spacing: .06em; }
.adr-overturned h3 { color: var(--bone); border-bottom: 2px solid var(--line); padding-bottom: .4rem; }
.adr-overturned p { max-width: 72ch; }
:root[data-theme="day"] .adr-overturned { background: #f3e4d8; border-color: #a4583c; }
:root[data-theme="day"] .adr-overturned > h2 { color: #8a3418; }

/* An overturned decision stays in the document as history. The dashed edge and muted label keep it apart from the decisions that still hold. */
.overturned-decision { margin: 2rem 0 1.4rem; padding: 1rem 1.3rem 1.2rem; background: var(--rock-2); border: 2px dashed var(--clay); border-radius: var(--stone-2); }
.overturned-decision > h2 { margin-top: 0; color: var(--bone-2); }
.overturned-decision p { max-width: 72ch; }
.overturned-label { margin: 0 0 .8rem; font: 700 .78rem/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--clay); }
:root[data-theme="day"] .overturned-decision { background: var(--cave-2); border-color: var(--fire); }
:root[data-theme="day"] .overturned-decision > h2 { color: var(--bone); }
:root[data-theme="day"] .overturned-label { color: var(--fire); }

/* Design alternatives: one decision per section, one card per alternative. The badge carries the standing word so
   a proposal reads as a proposal even where colour is unavailable. The cave variables flip with the theme. */
.design-alternative { margin: 1rem 0; padding: .9rem 1.1rem 1rem; background: var(--rock); border-left: 3px solid var(--line); border-radius: var(--stone-2); }
.design-alternative > h4 { margin: 0 0 .5rem; color: var(--bone); }
.design-alternative p { max-width: 72ch; }
.design-id, .design-standing, .design-sources, .design-requirement, .design-improves, .design-sacrifices, .design-migration, .design-uncertainty, .design-question { max-width: 72ch; }
.design-id code, .design-sources a { font-family: var(--mono); font-size: .88em; }
[class^="standing-"] { display: inline-block; margin: 0 .25rem .25rem 0; padding: .1rem .5rem; border: 1.5px solid var(--line); border-radius: var(--stone); font: 700 .76rem/1.4 var(--sans); }
.standing-observed, .standing-behaviorally-verified, .standing-historically-established { color: var(--moss); }
.standing-inferred, .standing-recommended { color: var(--ember-2); }
.standing-hypothetical, .standing-unknown { color: var(--clay); }
:root[data-theme="day"] .design-alternative { background: var(--cave-2); border-left-color: var(--line); }
:root[data-theme="day"] [class^="standing-"] { border-color: var(--line); }
:root[data-theme="day"] .standing-inferred, :root[data-theme="day"] .standing-recommended { color: var(--ember); }
:root[data-theme="day"] .standing-hypothetical, :root[data-theme="day"] .standing-unknown { color: var(--fire); }

/* A declared hero sits in the same cave frame as the shared drawing, with its own words below the picture. The edge runs all the way round, and the colours are the cave's existing variables. */
figure.art-hero.art-hero-declared { margin: 1.2rem 0 1.6rem; padding: 1rem; background: var(--cave-2); border: 2px solid var(--line); border-radius: var(--stone-2); }
figure.art-hero.art-hero-declared img { display: block; width: 100%; max-height: 34rem; object-fit: contain; background: var(--cave); border: 2px solid var(--line); border-radius: var(--stone); }
figure.art-hero.art-hero-declared .hero-copy { position: static; max-width: none; margin: 1rem 0 .4rem; color: var(--bone); }
figure.art-hero.art-hero-declared .hero-copy h1 { color: var(--bone); }
figure.art-hero.art-hero-declared figcaption { margin-top: .6rem; text-align: right; font: .78rem var(--serif); color: var(--bone-2); }

/* ───────── the cave as a document ─────────
   The nested sections and lists already carry the structure. These rules only place them: six depth bands in a
   grid, chamber columns inside a band, and connector lines drawn from where an element sits. Every state word is
   printed by the view, so the colour of a chip never has to explain it. */
.cave-header { max-width: 62ch; margin: 1.2rem 0 1.6rem; }
.cave-header p { color: var(--bone-2); }
.depth-nav { position: sticky; top: .25rem; z-index: 4; margin: 0 0 1.2rem; padding: .5rem; background: var(--cave); border-bottom: 2px dashed var(--line); }
.depth-nav ol { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.depth-nav a { display: inline-block; padding: .25rem .55rem; border: 1px solid var(--line); border-radius: var(--stone); color: var(--bone-2); text-decoration: none; font: 600 .78rem var(--sans); }
.depth-nav a::before { content: "↧ "; color: var(--ember-2); }
.depth-nav a:hover { background: var(--rock); color: var(--bone); }

.cave-map { display: grid; gap: 1.2rem; align-items: start; }
.depth {
  --band: var(--ember);
  position: relative; min-width: 0; scroll-margin-top: 5rem;
  padding: 1.1rem 1.2rem 1.3rem; background: var(--cave-2);
  border: 2px solid var(--line); border-left: 5px solid var(--band); border-radius: var(--stone-2);
}
.depth[data-depth="1"] { --band: var(--ember); }
.depth[data-depth="2"] { --band: var(--sky); }
.depth[data-depth="3"] { --band: var(--moss); }
.depth[data-depth="4"] { --band: var(--clay); }
.depth[data-depth="5"] { --band: var(--plum); }
.depth[data-depth="6"] { --band: var(--fire); }
.depth > h2 { margin: 0 0 .9rem; color: var(--band); font-size: 1.35rem; }
.depth > h2::before { content: "depth " attr(data-depth) " · "; color: var(--bone-2); font: 700 .7rem var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.cave-empty { margin: 0; color: var(--bone-2); font-size: .9rem; }

.chambers { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.chamber { position: relative; min-width: 0; padding: .9rem; background: var(--rock); border: 1.5px dashed var(--line); border-radius: var(--stone); }
.chamber::before { content: ""; position: absolute; left: -.7rem; top: 1.5rem; width: .7rem; border-top: 2px solid var(--band); }
.chamber > h3 { margin: 0 0 .6rem; font: 700 1.05rem/1.2 var(--serif); color: var(--bone); }
.discoveries { list-style: none; margin: 0; padding: 0; }
.discovery { position: relative; min-width: 0; margin: .5rem 0 0; padding: .55rem .6rem .55rem 1.3rem; background: var(--cave-2); border: 1px solid var(--line); border-radius: var(--stone); }
.discovery::before { content: ""; position: absolute; left: -.8rem; top: 1rem; width: .8rem; border-top: 2px solid var(--band); }
.discovery > a { font-weight: 650; }
.state-chip { display: inline-block; margin-left: .4rem; padding: .05rem .45rem; border: 1px solid var(--line); border-radius: 999px; color: var(--bone-2); font: 700 .68rem/1.5 var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.state-chip[data-state="unexplored"] { color: var(--bone-2); }
.passages { list-style: none; margin: .5rem 0 0; padding: 0 0 0 .7rem; border-left: 2px dashed var(--line); }
.passage { min-width: 0; font-size: .85rem; color: var(--bone-2); }
.passage::before { content: "↳ "; color: var(--ember-2); }
.passage a { overflow-wrap: anywhere; }

.cave-inspector { margin: 1.2rem 0 0; padding: .7rem 1rem; background: var(--rock); border: 1.5px solid var(--line); border-radius: var(--stone-2); }
.cave-inspector summary { cursor: pointer; font: 700 .85rem var(--sans); color: var(--ember-2); }
.cave-inspector p { max-width: 68ch; margin: .6rem 0 0; color: var(--bone-2); }
:root[data-theme="day"] .depth { background: var(--cave-2); border-color: var(--line); }
:root[data-theme="day"] .chamber, :root[data-theme="day"] .cave-inspector { background: var(--rock); }
:root[data-theme="day"] .state-chip { color: var(--bone-2); }

@media (max-width: 800px) {
  .depth-nav { position: static; }
  .chambers { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 20rem) {
  .frame { display: block; }
  main { padding: .75rem .6rem 3rem; }
  .depth-nav { padding: .35rem; }
  .depth-nav a { font-size: .72rem; padding: .2rem .35rem; }
  .depth { padding: .8rem .7rem 1rem; }
  .chambers, .discoveries, .passages { min-width: 0; }
  .discovery { padding-left: 1rem; }
  .state-chip { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .depth-nav a { scroll-behavior: auto; }
}

/* ───────── the engineering world as a document ─────────
   The nested lists already carry containment, product views and relation evidence. These rules place them in grids
   and draw passages from where an element sits. Kinds, standings and evidence are printed as words by the view, so
   colour never has to explain the structure on its own. */
.world-side .brand svg { width: 3rem; height: 3rem; }
.world-side-nav ol { list-style: none; margin: .6rem 0 0; padding: 0; }
.world-side-nav li { margin: .3rem 0; }
.world-side-nav a { color: var(--bone-2); text-decoration: none; font: 600 .85rem/1.4 var(--sans); }
.world-side-nav a[aria-current="page"] { color: var(--ember-2); border-bottom: 2px solid var(--ember); }
.world-header { max-width: 68ch; margin: 1rem 0 1.2rem; }
.world-header p { color: var(--bone-2); }
.world-breadcrumb ol { display: flex; gap: .4rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.world-breadcrumb a { color: var(--ember-2); font: 700 .78rem var(--sans); }
.world-breadcrumb a::before { content: "world / "; color: var(--bone-2); }

.world-filter { margin: 0 0 1rem; padding: .8rem 1rem; background: var(--cave-2); border: 2px dashed var(--line); border-radius: var(--stone-2); }
.world-filter fieldset { display: flex; flex-wrap: wrap; gap: .5rem; border: 0; margin: 0; padding: 0; }
.world-filter legend { font: 700 .85rem var(--sans); color: var(--ember-2); padding: 0 0 .4rem; }
.world-filter label { padding: .2rem .5rem; border: 1px solid var(--line); border-radius: var(--stone); font: .8rem var(--sans); }
.world-filter input { accent-color: var(--ember); }
.world-filter output { display: block; margin-top: .5rem; color: var(--bone-2); font: .8rem var(--sans); }

.world-sections ol { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0 0 1.2rem; padding: 0; }
.world-sections a { display: inline-block; padding: .25rem .55rem; border: 1px solid var(--line); border-radius: var(--stone); color: var(--bone-2); font: 600 .78rem var(--sans); text-decoration: none; }
.world-sections a::before { content: "→ "; color: var(--ember-2); }

.world-containment, .world-products, .world-relations { margin: 0 0 1.6rem; }
.world-containment > h2, .world-products > h2, .world-relations > h2 { font-size: 1.3rem; color: var(--ember-2); margin: 0 0 .5rem; }
.world-tree { display: grid; gap: 1rem; list-style: none; margin: 0; padding: 0; }
.world-node { position: relative; min-width: 0; padding: .9rem 1rem; background: var(--cave-2); border: 2px solid var(--line); border-left: 5px solid var(--ember); border-radius: var(--stone-2); scroll-margin-top: 5rem; }
.world-node.world-group { border-left-color: var(--sky); }
.world-node.world-product { border-left-color: var(--plum); }
.world-node.world-repository, .world-node.world-component { border-left-color: var(--bone-2); }
.world-node > h3, .world-node > h4, .world-node > h5 { margin: 0 0 .6rem; font: 700 1.05rem/1.2 var(--serif); }
.world-node::before { content: ""; position: absolute; left: -.75rem; top: 1.4rem; width: .75rem; border-top: 2px solid var(--line); }
.world-children, .world-systems { display: grid; gap: .8rem; list-style: none; margin: 0; padding: 0; }
.world-system::before { border-top-color: var(--sky); }
.world-node > h4::before { content: "system · "; color: var(--bone-2); font: 700 .68rem var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.tier-nav ol { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; margin: .5rem 0; padding: 0; }
.tier-nav a { display: inline-block; padding: .15rem .4rem; border: 1px solid var(--line); border-radius: var(--stone); color: var(--bone-2); font: .72rem var(--sans); text-decoration: none; }
.tier { margin: .5rem 0; padding: .5rem .7rem; background: var(--rock); border-left: 3px solid var(--line); border-radius: var(--stone); scroll-margin-top: 5rem; }
.tier > h5 { margin: 0 0 .35rem; color: var(--ember-2); font: 700 .8rem var(--sans); }
.tier[data-tier="6"] { border-left-color: var(--fire); }
.world-lessons { display: grid; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.lesson { position: relative; min-width: 0; padding: .3rem .5rem .3rem 1.2rem; background: var(--cave-2); border: 1px solid var(--line); border-radius: var(--stone); font: .85rem/1.4 var(--sans); }
.lesson::before { content: ""; position: absolute; left: -.5rem; top: .9rem; width: .5rem; border-top: 2px solid var(--bone-2); }
.lesson .n { margin-right: .4rem; color: var(--ember-2); font-weight: 800; }
.lesson .concepts { display: block; color: var(--bone-2); font-size: .75rem; overflow-wrap: anywhere; }
.tier-empty { margin: 0; color: var(--bone-2); font-size: .8rem; }

/* The level filter reads the checked radio through :has, so it works with no application script. */
.world-filter:has(input[value="1"]:checked) ~ .world-containment .lesson:not([data-tier="1"]),
.world-filter:has(input[value="2"]:checked) ~ .world-containment .lesson:not([data-tier="2"]),
.world-filter:has(input[value="3"]:checked) ~ .world-containment .lesson:not([data-tier="3"]),
.world-filter:has(input[value="4"]:checked) ~ .world-containment .lesson:not([data-tier="4"]),
.world-filter:has(input[value="5"]:checked) ~ .world-containment .lesson:not([data-tier="5"]),
.world-filter:has(input[value="6"]:checked) ~ .world-containment .lesson:not([data-tier="6"]) { display: none; }

.world-products h3 { font: 700 .95rem var(--serif); margin: 1rem 0 .4rem; }
.product-list, .system-list { display: grid; gap: .7rem; list-style: none; margin: 0; padding: 0; }
.product > details { padding: .5rem .8rem; background: var(--cave-2); border: 1px solid var(--line); border-radius: var(--stone); }
.product summary { cursor: pointer; font-weight: 650; }
.product-systems, .system-products { list-style: none; margin: .4rem 0 0; padding: 0 0 0 .8rem; border-left: 2px dashed var(--line); }
.product-systems li, .system-products li { margin: .25rem 0; font-size: .85rem; }
.product-view-system { padding: .5rem .8rem; background: var(--rock); border: 1px dashed var(--line); border-radius: var(--stone); }
.relation-list { display: grid; gap: .7rem; list-style: none; margin: 0; padding: 0; }
.relation { padding: .6rem .8rem; background: var(--cave-2); border: 1px solid var(--line); border-left: 4px solid var(--moss); border-radius: var(--stone); }
.relation[data-standing="inferred"] { border-left-color: var(--ember); }
.relation[data-standing="unknown"] { border-left-color: var(--bone-2); }
.relation-kind { display: inline-block; margin-right: .3rem; color: var(--ember-2); font: 800 .72rem var(--sans); letter-spacing: .05em; text-transform: uppercase; }
.relation-arrow { color: var(--fire); }
.relation-evidence { list-style: none; margin: .4rem 0 0; padding: 0 0 0 .8rem; border-left: 2px dashed var(--line); }
.relation-evidence li { margin: .2rem 0; font-size: .8rem; color: var(--bone-2); overflow-wrap: anywhere; }
.relation-evidence .no-evidence { color: var(--fire); }
.standing { display: inline-block; margin-top: .3rem; font: .72rem var(--sans); color: var(--bone-2); }
.world-inspector { margin: 1.2rem 0 0; padding: .7rem 1rem; background: var(--rock); border: 1.5px solid var(--line); border-radius: var(--stone-2); }
.world-inspector summary { cursor: pointer; font: 700 .85rem var(--sans); color: var(--ember-2); }
.world-inspector p { max-width: 68ch; margin: .6rem 0 0; color: var(--bone-2); }
:root[data-theme="day"] .world-node, :root[data-theme="day"] .world-inspector { background: var(--cave-2); }
:root[data-theme="day"] .tier, :root[data-theme="day"] .product-view-system { background: var(--rock); }

@media (max-width: 800px) {
  .world-tree, .world-systems, .world-children, .product-list, .system-list, .relation-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 20rem) {
  .frame.world-frame { display: block; }
  .world-filter fieldset { display: block; }
  .world-node { padding: .7rem .6rem; }
  .world-tree, .world-systems, .world-children, .world-lessons, .product-list, .system-list, .relation-list { min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .lesson, .tier-nav a { padding-left: .7rem; }
  .relation { padding: .5rem .6rem; }
}
