/* School of Specs
   ------------------------------------------------------------------
   Two voices on one page. The course speaks on a dark, quiet surface in
   a plain sans; the specification speaks on paper, in a serif, exactly
   as it does in the original document. Everything else stays out of the
   way. The one warm colour, "signal", marks the things you can act on.
*/

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/spacegrotesk-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("fonts/atkinson-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("fonts/atkinson-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plexmono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Atkinson", system-ui, -apple-system, sans-serif;
  --mono: "Plex Mono", ui-monospace, "DejaVu Sans Mono", monospace;
  --serif: "Liberation Serif", "Times New Roman", Times, serif;

  --paper: #f6f3ec;
  --paper-ink: #1b1a17;
  --paper-rule: #d9d3c5;
  --paper-muted: #6a6459;

  --signal: #ff9145;
  --rose: #f2678a;
  --mint: #59d3ad;

  --radius: 10px;
  --measure: 68ch;
  --bar: 56px;
}

:root[data-theme="night"] {
  --bg: #12101e;
  --surface: #191630;
  --surface-2: #221d3d;
  --edge: #2e2750;
  --text: #ece8f5;
  --muted: #a29cbe;
  --signal-soft: rgba(255, 145, 69, 0.14);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

:root[data-theme="paper"] {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2efe9;
  --edge: #e2ddd2;
  --text: #1b1a26;
  --muted: #5f5a70;
  /* Darker than the dark theme's signal so small text — clause chips, part
     names — clears 4.5:1 against both the page and the raised surface. */
  --signal: #a8490f;
  --signal-soft: rgba(168, 73, 15, 0.1);
  --shadow: 0 20px 50px rgba(40, 34, 24, 0.16);
}

* { box-sizing: border-box; }

/* A class that sets display would otherwise beat the browser's own rule for
   the hidden attribute, and every quiz answer would show before it is earned. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--signal);
  color: #1b1206;
  padding: 0.6rem 1rem;
  z-index: 60;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ----------------------------------------------------------------- bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--edge);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.05rem;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background:
    linear-gradient(var(--signal), var(--signal)) left 3px top 4px / 4px 4px no-repeat,
    linear-gradient(var(--text), var(--text)) left 3px top 10px / 14px 2px no-repeat,
    linear-gradient(var(--text), var(--text)) left 3px top 14px / 9px 2px no-repeat,
    var(--surface-2);
  border: 1px solid var(--edge);
}

.spec-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}
.spec-version { color: var(--signal); margin-left: 0.4rem; }

.topnav {
  display: flex;
  gap: 0.15rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.topnav a {
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }

.topsearch input {
  font: inherit;
  font-size: 0.9rem;
  width: min(20rem, 42vw);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--text);
}
.topsearch input::placeholder { color: var(--muted); }

@media (max-width: 40rem) {
  /* Two rows instead of three: the version badge is on the home page and in
     the footer anyway, and the search box needs the width more. */
  .topbar { padding: 0.5rem 0.8rem; gap: 0.5rem; }
  .spec-badge { display: none; }
  .topsearch { flex: 1 1 8rem; margin-left: auto; }
  .topsearch input { width: 100%; }
  .topnav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .topnav a { padding: 0.25rem 0.5rem; font-size: 0.9rem; }
}

.theme-picker select {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}


/* --------------------------------------------------------------- pages */

main { padding: 0 1rem 5rem; }

.page-head,
.hero,
.mosaic-block,
.course-list,
.numbers,
.map,
.glossary,
.history,
.references,
.results,
.clause-page {
  max-width: 1080px;
  margin-inline: auto;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.8rem;
}

.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 2rem; }
.hero h1 { font-size: clamp(2.1rem, 1.2rem + 3.6vw, 3.6rem); }

.lead {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 60ch;
  margin: 1rem 0 0;
}

.page-head { padding: 2.5rem 0 1.5rem; }
.page-head h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 2rem; }

.button {
  display: inline-block;
  text-decoration: none;
  font-family: var(--display);
  font-size: 0.95rem;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  background: var(--signal);
  color: #1b1206;
  border: 1px solid transparent;
}
.button.quiet { background: transparent; color: var(--text); border-color: var(--edge); }
.button:hover { filter: brightness(1.06); }

.section-title {
  font-size: 1.35rem;
  margin: 3rem 0 0.4rem;
}
.section-note { color: var(--muted); font-size: 0.95rem; margin: 0 0 1.2rem; max-width: 60ch; }

/* -------------------------------------------------------------- mosaic */

/* A link from a chapter to the same subject at another depth. */
.depth-link {
  border-bottom: 1px dotted currentColor;
  text-decoration: none;
}

/* What a course or a chapter was written against, and when. */
.verified {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 1.2rem 0 0;
  max-width: var(--measure);
}
.chapter-verified {
  border-top: 1px solid var(--edge);
  padding-top: 1rem;
  margin-top: 2.5rem;
}

.mosaic-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.mosaic-fallback { color: var(--muted); font-size: 0.92rem; }

.mosaic { margin-top: 1rem; }
.mosaic-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}

.tile {
  height: 11px;
  width: calc(var(--w) * var(--tile-scale, 1px));
  border-radius: 2px;
  background: var(--surface-2);
  display: block;
}
@media (max-width: 48rem) {
  /* A narrow screen would otherwise turn the picture into a long ribbon. */
  .mosaic-tiles { --tile-scale: 0.42px; gap: 2px; padding: 0.7rem; }
  .tile { height: 8px; }
}
.tile.taught { background: var(--signal); opacity: 0.85; }
.tile:hover { outline: 2px solid var(--text); outline-offset: 1px; }

.legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.8rem;
}
.key-item { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 1.2rem; }
.key { width: 22px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.key.taught { background: var(--signal); }
.key.untaught { background: var(--surface-2); border: 1px solid var(--edge); }

/* -------------------------------------------------------- course index */

.part { margin-top: 2rem; }
.part-name {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0 0 0.6rem;
}

.chapters { list-style: none; margin: 0; padding: 0; }
.chapters li { border-top: 1px solid var(--edge); }
.chapters a {
  display: grid;
  grid-template-columns: 2.6rem 1fr auto;
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.85rem 0.4rem;
  text-decoration: none;
}
.chapters a:hover { background: var(--surface); }
.chapter-index { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; }
.chapter-text strong { font-family: var(--display); font-size: 1.05rem; display: block; }
.chapter-summary { color: var(--muted); font-size: 0.92rem; }
.chapter-minutes { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

/* The tick beside a chapter whose questions this browser has answered. Put
   there by the script and by nothing else, so a reader without JavaScript
   sees the list exactly as it was. */
.read-tick { color: var(--signal); margin-left: 0.3rem; font-weight: 700; }
.chapters li.read .chapter-text strong { color: var(--muted); }
.chapter-nav li.read a { color: var(--text); }

.stats { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--edge); border: 1px solid var(--edge); border-radius: var(--radius); overflow: hidden; margin: 1rem 0 0; }
.stats div { background: var(--bg); padding: 1rem; }
.stats dt { color: var(--muted); font-size: 0.8rem; }
.stats dd { margin: 0.3rem 0 0; font-family: var(--display); font-size: 1.5rem; }

/* ------------------------------------------------------------- reading */

.reading {
  display: grid;
  /* minmax(0, …) so a wide table inside a chapter cannot stretch the column
     past the screen and take the whole page with it. */
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  max-width: 1280px;
  margin-inline: auto;
  padding-top: 1.5rem;
}

/* On a phone the chapter comes first and the list of chapters follows it —
   nobody wants to scroll past 27 links to reach the text. */
.chapter { order: 1; }
.chapter-nav { order: 2; border-top: 1px solid var(--edge); padding-top: 1.5rem; }

@media (min-width: 62rem) {
  .chapter { order: 0; }
  .chapter-nav { order: 0; border-top: 0; padding-top: 0; }
  .reading { grid-template-columns: 15rem minmax(0, 1fr); gap: 3rem; }
  .chapter-nav {
    position: sticky;
    top: calc(var(--bar) + 1rem);
    align-self: start;
    max-height: calc(100vh - var(--bar) - 2rem);
    overflow-y: auto;
  }
}

.chapter-nav { font-size: 0.9rem; }
.nav-title { font-family: var(--display); margin: 0 0 1rem; }
.nav-part {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.2rem 0 0.35rem;
}
.chapter-nav ul { list-style: none; margin: 0; padding: 0; }
.chapter-nav a {
  display: block;
  text-decoration: none;
  color: var(--muted);
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  border-left: 2px solid transparent;
}
.chapter-nav a:hover { color: var(--text); background: var(--surface); }
.chapter-nav a[aria-current="page"] { color: var(--text); border-left-color: var(--signal); background: var(--surface); }
.nav-index { font-family: var(--mono); font-size: 0.75rem; opacity: 0.6; margin-right: 0.3rem; }

.chapter { max-width: var(--measure); }
.chapter-head { padding-bottom: 1.5rem; border-bottom: 1px solid var(--edge); }
.chapter-head h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 2.9rem); }
.chapter-clauses { margin: 1.2rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; color: var(--muted); font-size: 0.9rem; }

/* --------------------------------------------------------------- prose */

.prose { padding-top: 0.5rem; }
.prose h2 { font-size: 1.55rem; margin: 2.6rem 0 0.8rem; }
.prose h3 { font-size: 1.2rem; margin: 2rem 0 0.6rem; }
.prose p { margin: 0 0 1.1rem; }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li > ul, .prose li > ol { margin-top: 0.5rem; }
.prose strong { color: var(--text); }
.prose a { color: var(--text); text-decoration-color: var(--signal); text-underline-offset: 3px; }
.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0 0 1.4rem;
}
.prose th,
.prose td {
  border: 1px solid var(--edge);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.prose th { background: var(--surface); font-family: var(--display); font-size: 0.85rem; }
.prose pre { overflow-x: auto; }
.prose img { max-width: 100%; height: auto; }

.prose abbr {
  text-decoration: underline dotted var(--muted);
  text-underline-offset: 3px;
  cursor: help;
}

.clause-link {
  font-family: var(--mono);
  font-size: 0.8em;
  text-decoration: none;
  color: var(--signal);
  background: var(--signal-soft);
  border: 1px solid transparent;
  padding: 0.05em 0.4em;
  border-radius: 5px;
  white-space: nowrap;
}
.clause-link:hover { border-color: var(--signal); }

.ts-link, .ref-link { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.chapter-link { text-decoration-color: var(--signal); }

/* ------------------------------------------------------------ callouts */

.callout {
  margin: 1.6rem 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  background: var(--surface);
}
.callout p:last-child { margin-bottom: 0; }
.callout-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
  color: var(--muted);
}
.callout-key { border-left: 3px solid var(--signal); }
.callout-key .callout-label { color: var(--signal); }
.callout-watch { border-left: 3px solid var(--rose); }
.callout-watch .callout-label { color: var(--rose); }
.callout-example { border-left: 3px solid var(--mint); }
.callout-example .callout-label { color: var(--mint); }

.callout-spec {
  background: var(--paper);
  color: var(--paper-ink);
  border-color: var(--paper-rule);
  border-left: 3px solid var(--paper-rule);
  font-family: var(--serif);
  font-size: 1.05rem;
}
.callout-spec .callout-label { color: var(--paper-muted); font-family: var(--mono); }
.callout-source { margin-top: 0.8rem; }
.callout-spec .clause-link { background: rgba(0, 0, 0, 0.06); color: #8a4415; }

/* ------------------------------------------------------------- figures */

.spec-figure { margin: 1.8rem 0; }
.spec-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  padding: 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--edge);
}
.spec-figure figcaption {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* --------------------------------------------------------------- quiz */

.quiz { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--edge); }
.quiz h2 { font-size: 1.4rem; }
.question { margin: 1.6rem 0; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius); }
.question-text { margin: 0 0 0.9rem; font-weight: 700; }
.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.option {
  font: inherit;
  font-size: 0.98rem;
  text-align: left;
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--edge);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.option:hover { border-color: var(--muted); }
.option.right { border-color: var(--mint); background: color-mix(in srgb, var(--mint) 14%, var(--bg)); }
.option.wrong { border-color: var(--rose); background: color-mix(in srgb, var(--rose) 12%, var(--bg)); }
.answer { margin: 0.9rem 0 0; color: var(--muted); font-size: 0.95rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.chapter-steps { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; flex-wrap: wrap; }
.clause-steps { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.step {
  text-decoration: none;
  padding: 0.8rem 1rem;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  min-width: min(100%, 15rem);
  flex: 1 1 15rem;
  background: var(--surface);
}
.step span { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.step strong { font-family: var(--display); font-weight: 700; font-size: 0.98rem; }
.step.next { text-align: right; }

/* --------------------------------------------------------------- paper */

.paper {
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 4vw, 2.8rem);
  box-shadow: var(--shadow);
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.6;
  max-width: 78ch;
  margin-inline: auto;
}
.paper h1 { font-family: var(--display); font-size: clamp(1.5rem, 1rem + 2vw, 2.2rem); margin-bottom: 1rem; }
.paper-number { font-family: var(--mono); color: #8a4415; margin-right: 0.5rem; }
.paper-eyebrow { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper-muted); margin: 0 0 0.8rem; }
.paper-body p { margin: 0 0 0.9rem; }
.paper-body .spec-note {
  border-left: 3px solid var(--paper-rule);
  padding-left: 0.8rem;
  color: #40382c;
  font-size: 0.97rem;
}
.paper-body .spec-list { margin: 0 0 0.9rem; padding-left: 1.4rem; }
.paper-body .spec-caption { font-family: var(--mono); font-size: 0.78rem; color: var(--paper-muted); }
.paper-body a { color: #8a4415; }
/* Inside dense specification text a padded chip leaves a gap before the
   bracket that follows it, so the link is only the number, coloured. */
.paper-body .clause-link,
.panel-body .clause-link {
  background: transparent;
  padding: 0;
  border: 0;
  font-size: 0.88em;
  text-decoration: underline dotted rgba(138, 68, 21, 0.5);
  text-underline-offset: 2px;
}
.paper-body .clause-link:hover,
.panel-body .clause-link:hover { text-decoration: underline solid #8a4415; }
.paper .spec-figure img { border-color: var(--paper-rule); padding: 0.5rem; }
.paper .spec-figure figcaption { color: var(--paper-muted); }
.paper-empty { color: var(--paper-muted); font-style: italic; }

.table-scroll { overflow-x: auto; margin: 0 0 1.2rem; }
.spec-table { border-collapse: collapse; font-family: var(--body); font-size: 0.86rem; min-width: 100%; }
.spec-table th, .spec-table td { border: 1px solid var(--paper-rule); padding: 0.4rem 0.55rem; text-align: left; vertical-align: top; }
.spec-table th { background: rgba(0, 0, 0, 0.04); font-weight: 700; }

.crumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); padding: 1.5rem 0 1rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--signal); }
.crumbs > * + *::before { content: "› "; color: var(--muted); }

.taught-here { font-family: var(--body); font-size: 0.9rem; background: rgba(0, 0, 0, 0.05); padding: 0.5rem 0.7rem; border-radius: 6px; }
.children { margin-top: 2rem; font-family: var(--body); font-size: 0.95rem; }
.children h2 { font-size: 1.05rem; margin-bottom: 0.6rem; }
.children ul { list-style: none; margin: 0; padding: 0; }
.children li { padding: 0.25rem 0; border-top: 1px solid var(--paper-rule); display: flex; gap: 0.6rem; justify-content: space-between; }
.children a { text-decoration: none; }
.child-number { font-family: var(--mono); font-size: 0.8rem; color: var(--paper-muted); margin-right: 0.4rem; }
.child-words { font-family: var(--mono); font-size: 0.72rem; color: var(--paper-muted); white-space: nowrap; }

/* --------------------------------------------------------------- panel */

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(38rem, 94vw);
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: var(--shadow);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  font-family: var(--serif);
}
.panel.open { transform: none; }
.panel[hidden] { display: none; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--paper-rule);
  font-family: var(--body);
  flex-wrap: wrap;
}
.panel-tab { font-family: var(--mono); font-size: 0.8rem; background: #8a4415; color: var(--paper); padding: 0.15rem 0.5rem; border-radius: 5px; }
.panel-head h2 { font-family: var(--display); font-size: 1rem; flex: 1 1 8rem; }
.panel-full { font-size: 0.8rem; color: #8a4415; }
.panel-close {
  font: inherit;
  font-size: 0.8rem;
  border: 1px solid var(--paper-rule);
  background: transparent;
  color: var(--paper-ink);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  cursor: pointer;
}
.panel-body { overflow-y: auto; padding: 1.2rem; }
.panel-body p { margin: 0 0 0.9rem; }
.panel-body .spec-note { border-left: 3px solid var(--paper-rule); padding-left: 0.8rem; font-size: 0.95rem; color: #40382c; }
.panel-body .spec-list { margin: 0 0 0.9rem; padding-left: 1.4rem; }
.panel-body a { color: #8a4415; }
.panel-body .clause-link { color: #8a4415; }
.panel-body .spec-figure img { background: #fff; border: 1px solid var(--paper-rule); }
.panel-kids { font-family: var(--body); font-size: 0.88rem; border-top: 1px solid var(--paper-rule); padding-top: 0.8rem; }
.panel-kids a { display: block; padding: 0.15rem 0; }

.panel-shade {
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 14, 0.5);
  z-index: 45;
  border: 0;
}
.panel-shade[hidden] { display: none; }

@media (max-width: 48rem) {
  .panel {
    top: auto;
    width: 100%;
    height: 82vh;
    border-radius: 14px 14px 0 0;
    transform: translateY(100%);
  }
  .panel.open { transform: none; }
}

/* ----------------------------------------------------------------- map */

.map-row { border-top: 1px solid var(--edge); }
.map-leaf {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.3rem 0.8rem;
  align-items: center;
  padding: 0.8rem 0.3rem;
  text-decoration: none;
}
.map-leaf:hover .map-title { color: var(--signal); }
.map-row summary {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.3rem 0.8rem;
  align-items: center;
  padding: 0.8rem 0.3rem;
  cursor: pointer;
  list-style: none;
}
.map-row summary::-webkit-details-marker { display: none; }
.map-number { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.map-title { font-family: var(--display); font-size: 1rem; }
.map-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--signal); opacity: 0.55; width: calc(var(--w) * 1%); }
.map-words { grid-column: 1 / -1; font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.map-children { list-style: none; margin: 0 0 1.2rem; padding: 0 0 0 0.3rem; }
.map-children li { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: baseline; padding: 0.3rem 0; border-top: 1px dashed var(--edge); }
.map-child { text-decoration: none; display: flex; gap: 0.6rem; flex: 1 1 18rem; }
.map-child:hover .map-title { color: var(--signal); }
.map-children .map-title { font-family: var(--body); font-size: 0.95rem; }
.map-taught { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.pill {
  font-size: 0.72rem;
  text-decoration: none;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--signal-soft);
  color: var(--signal);
  border: 1px solid transparent;
}
.pill:hover { border-color: var(--signal); }

@media (min-width: 48rem) {
  .map-row summary,
  .map-leaf { grid-template-columns: 5.5rem minmax(0, 22rem) 1fr auto; }
  .map-bar { grid-column: auto; width: calc(var(--w) * 1%); max-width: 100%; }
  .map-words { grid-column: auto; }
}

/* ------------------------------------------------------------ glossary */

.filter input {
  font: inherit;
  width: min(28rem, 100%);
  margin-top: 1rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--text);
}
.terms { margin: 0; }
.term {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem 1rem;
  padding: 0.6rem 0.3rem;
  border-top: 1px solid var(--edge);
}
.term dt { font-family: var(--mono); font-size: 0.9rem; color: var(--signal); }
.term dd { margin: 0; color: var(--text); }
.definitions .term dt { font-family: var(--display); color: var(--text); }
@media (min-width: 42rem) {
  .term { grid-template-columns: 12rem 1fr; }
}
.nothing { color: var(--muted); padding: 1.5rem 0; }

/* ------------------------------------------------------------- history */

.version { border-top: 1px solid var(--edge); }
.version summary {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.2rem 0.8rem;
  padding: 0.7rem 0.3rem;
  cursor: pointer;
  list-style: none;
  align-items: baseline;
}
.version summary::-webkit-details-marker { display: none; }
.version-number { font-family: var(--mono); color: var(--signal); font-size: 0.9rem; }
.version-date { font-family: var(--body); }
.version-meeting, .version-count { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.version-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--signal);
  opacity: 0.5;
  width: calc(var(--w) * 1%);
  max-width: 100%;
  align-self: center;
}
@media (min-width: 42rem) {
  .version summary { grid-template-columns: 5rem 7rem 7rem 7rem 1fr; }
}
.changes { list-style: none; margin: 0 0 1.2rem; padding: 0 0 0 0.3rem; font-size: 0.92rem; }
.changes li { display: grid; grid-template-columns: 1fr; gap: 0.15rem 0.8rem; padding: 0.35rem 0; border-top: 1px dashed var(--edge); }
@media (min-width: 42rem) {
  .changes li { grid-template-columns: 8rem 1fr 8rem; }
}

/* The school's own releases, at /versions. The document's change history above
   has three short columns per line; a release line is one plain-English
   sentence and wants the whole width. */
.feature-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  margin: 1.6rem 0 0.2rem;
}
.release-lines li { grid-template-columns: 1fr; }
@media (min-width: 42rem) {
  .release-lines li { grid-template-columns: 1fr; }
  .version.release summary { grid-template-columns: 4.5rem 6rem 1fr 5rem 4rem; }
}
.cr { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.cr-tdoc { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }

/* ---------------------------------------------------------- references */

.reflist { list-style: none; margin: 0; padding: 0; }
.reflist li { display: grid; grid-template-columns: 3rem 1fr; gap: 0.8rem; padding: 0.45rem 0.3rem; border-top: 1px solid var(--edge); }
.refnum { font-family: var(--mono); font-size: 0.8rem; color: var(--signal); }
.reftext { font-size: 0.95rem; }

/* -------------------------------------------------------------- search */

.results { display: grid; gap: 0.6rem; }
.result {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  text-decoration: none;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
}
.result:hover { border-color: var(--signal); }
.result-kind { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--signal); }
.result strong { font-family: var(--display); font-size: 1.02rem; }
.result-context { color: var(--muted); font-size: 0.92rem; }

/* --------------------------------------------------------------- about */

.about { max-width: 1080px; margin-inline: auto; }
.about p { max-width: 68ch; }
.repairs { max-width: 68ch; color: var(--muted); font-size: 0.95rem; padding-left: 1.2rem; }
.repairs li { margin-bottom: 0.5rem; }

/* -------------------------------------------------------------- footer */

.sitefoot {
  max-width: 1080px;
  margin: 4rem auto 0;
  padding: 1.5rem 1rem 0;
  border-top: 1px solid var(--edge);
  color: var(--muted);
  font-size: 0.85rem;
}
.sitefoot p { margin: 0 0 0.4rem; }
.sitefoot .version { font-family: var(--mono); font-size: 0.75rem; opacity: 0.7; }

.empty { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ------------------------------------------------------- the four themes
   A theme sets variables and nothing else, so a fifth one is fifteen lines
   and never a second stylesheet. `night` and `paper` are declared with the
   rest of the root variables further up; these two are the cold and the
   high-contrast one. */

:root[data-theme="blueprint"] {
  --bg: #071a2b;
  --surface: #0c2740;
  --surface-2: #103252;
  --edge: #1c4a72;
  --text: #e4f1fb;
  --muted: #93b5cf;
  --signal: #58c7f3;
  --signal-soft: rgba(88, 199, 243, 0.14);
  --rose: #7fb2ff;
  --mint: #6fe3c8;
  --paper: #eef4fa;
  --paper-ink: #10222f;
  --paper-rule: #c6d7e4;
  --paper-muted: #5b7186;
  --shadow: 0 24px 60px rgba(0, 12, 24, 0.6);
}

:root[data-theme="terminal"] {
  --display: "Plex Mono", ui-monospace, monospace;
  --bg: #0a0a08;
  --surface: #131310;
  --surface-2: #1c1b16;
  --edge: #34322a;
  --text: #f3e8d0;
  --muted: #b09f7d;
  --signal: #ffb000;
  --signal-soft: rgba(255, 176, 0, 0.14);
  --rose: #ff8f6b;
  --mint: #8fe388;
  --paper: #16150f;
  --paper-ink: #efe6cf;
  --paper-rule: #3b382c;
  --paper-muted: #a89a78;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}


/* --------------------------------------------------------- the school */

.school-hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }

.pitch, .promise, .tracks, .test-index, .sources, .all-questions,
.course-tests-teaser, .exam, .exam-result {
  max-width: 74rem;
  margin: 0 auto 3.5rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.card h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.card p { margin: 0 0 0.6rem; color: var(--muted); }
.card p:last-child { margin-bottom: 0; }

.promise .lead { max-width: var(--measure); }

.track {
  display: grid;
  grid-template-columns: minmax(14rem, 22rem) 1fr;
  gap: 1.2rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--edge);
}
.track:last-child { border-bottom: 1px solid var(--edge); }
.track-head h2, .track-head h3 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.track-head a { text-decoration: none; }
.track-head a:hover { color: var(--signal); }
.track-blurb { color: var(--muted); margin: 0 0 0.5rem; }
.track-facts { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; }

.depths {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.6rem;
}
.depths a {
  display: block;
  height: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}
.depths a:hover { border-color: var(--signal); background: var(--surface-2); }
.depths strong { display: block; font-family: var(--display); }
.depth-blurb { display: block; color: var(--muted); font-size: 0.9rem; margin: 0.2rem 0; }
.depth-size { display: block; color: var(--muted); font-size: 0.8rem; font-family: var(--mono); }
.depth-switch { color: var(--muted); font-size: 0.9rem; }

.part-number {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--signal);
  margin-right: 0.4rem;
}
.chapter-number {
  font-family: var(--mono);
  color: var(--signal);
  margin-right: 0.4rem;
}
.nav-depth {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--signal);
  margin: 0 0 0.8rem;
}
.in-course { color: var(--muted); font-size: 0.85rem; }

/* ------------------------------------------------ numbered sections */

.prose h2.numbered, .prose h3.numbered { scroll-margin-top: 4.5rem; }
.prose .sec-no {
  font-family: var(--mono);
  color: var(--signal);
  text-decoration: none;
  margin-right: 0.45rem;
  font-size: 0.85em;
}
.prose .sec-no:hover { text-decoration: underline; }

.chapter-toc {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.9rem 1.1rem;
  margin: 0 0 2rem;
}
.toc-title {
  font-family: var(--display);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.chapter-toc ol { list-style: none; margin: 0; padding: 0; }
.chapter-toc li { margin: 0.15rem 0; }
.chapter-toc a { text-decoration: none; color: var(--text); }
.chapter-toc a:hover { color: var(--signal); }
.toc-number { font-family: var(--mono); color: var(--muted); margin-right: 0.4rem; }

/* ------------------------------------------------------------- tests */

.question-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--signal);
  margin-right: 0.4rem;
}
.question-group { margin-bottom: 2.5rem; }
.group-number { font-family: var(--mono); color: var(--signal); }

.test-track { margin-bottom: 2.5rem; }
.test-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.test-table th, .test-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--edge);
  vertical-align: top;
}
.test-table th { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.test-links a { display: inline-block; margin-right: 0.8rem; }

.exam-question { border-left: 3px solid transparent; padding-left: 0.8rem; }
.exam-question.marked-right { border-left-color: var(--mint); }
.exam-question.marked-wrong { border-left-color: var(--rose); }
.exam-question.marked-blank { border-left-color: var(--muted); }

.option-pick {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.option-pick:hover { border-color: var(--signal); }
.option-pick.right { border-color: var(--mint); background: var(--surface-2); }
.option-pick.wrong { border-color: var(--rose); background: var(--surface-2); }
.option-pick input { margin-top: 0.35rem; }

.exam-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--edge);
}
.exam-progress { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; margin: 0; }

.exam-result {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.2rem 1.4rem;
}
.score { font-family: var(--display); font-size: 1.6rem; margin: 0 0 0.3rem; }
.verdict { margin: 0 0 0.8rem; }
.verdict.passed { color: var(--mint); }
.verdict.failed { color: var(--rose); }

/* ----------------------------------------------------------- sources */

.source-link {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--signal);
  text-decoration: none;
  border-bottom: 1px dotted var(--signal);
}
.source-link:hover { border-bottom-style: solid; }
.source-flat { color: var(--muted); border-bottom-color: var(--muted); cursor: help; }

.source-row.cited dt::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--signal);
  margin-right: 0.4rem;
  vertical-align: middle;
}
.source-title { display: block; }
.source-value { display: block; font-family: var(--mono); color: var(--signal); }
.source-method { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.source-id { display: inline-block; margin-top: 0.3rem; font-size: 0.75rem; color: var(--muted); }
.count { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.pill.tiny { font-size: 0.7rem; padding: 0.05rem 0.4rem; }

.result-where {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--signal);
}

.plan { max-width: var(--measure); }
.plan li { margin-bottom: 0.6rem; }

@media (max-width: 52rem) {
  .track { grid-template-columns: 1fr; }
}
.track-kind {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--signal);
  margin: 0 0 0.3rem;
}
/* Two paragraphs that explain the same promise, not one block of text. */
.promise .section-note { margin-top: 1rem; max-width: var(--measure); }

/* --------------------------------------------- numbered source citations */

sup.cite {
  font-family: var(--mono);
  font-size: 0.68em;
  line-height: 0;
  margin-left: 0.1em;
  cursor: help;
}
sup.cite a { color: var(--signal); text-decoration: none; }
sup.cite a:hover { text-decoration: underline; }

.chapter-cites {
  margin: 2.5rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
}
.chapter-cites h2 { font-size: 1rem; margin-bottom: 0.6rem; }
.cite-list { margin: 0 0 0.6rem; padding-left: 1.4rem; font-size: 0.92rem; }
.cite-list li { margin-bottom: 0.45rem; }
.cite-method { display: block; color: var(--muted); font-size: 0.82rem; }
