/* The Learning Still (ADR-025). Light theme only, by decision.
   Fonts are self-hosted: the CSP's font-src 'self' blocks Google Fonts. */
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/lato-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/fonts/lato-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/lato-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/montserrat-latin-700-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  /* Brand, exactly as the design guide gives them. Use these for fills,
     backgrounds, bars and badges -- not for text on white (see the inks). */
  --color-primary: #134141;
  --color-primary-hover: #0e3030;
  --color-secondary: #CC9D54;
  --color-secondary-hover: #b88b45;
  --color-accent-blue: #5CA7A8;
  --color-accent-sage: #B8D8C0;
  --color-accent-coral: #EF8D68;
  --color-bg-main: #FBFBFB;
  --color-card-bg: #FFFFFF;
  --color-border: #E2E8F0;
  /* Inks: the same hues darkened until text passes WCAG AA (4.5:1) on
     white. Gold, Ocean Blue and Coral themselves are 2.4-2.8:1. */
  --ink-muted: #4F6F6F;
  --ink-blue: #2E7D7E;
  --ink-gold: #96692A;
  --ink-coral: #B4502C;
  --ink-success: #2F7A55;
  /* Tints for quiet surfaces. */
  --tint-sage: #EEF6F0;
  --tint-blue: #E6F2F2;
  --tint-gold: #F8F0E3;
  --tint-coral: #FCEDE6;
  /* Shape. */
  --radius-card: 12px;
  --radius-btn: 8px;
  --shadow: 0 2px 8px rgba(19, 65, 65, 0.05);
  --shadow-hover: 0 6px 18px rgba(19, 65, 65, 0.09);
  --font-head: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-body: "Lato", "Helvetica Neue", system-ui, sans-serif;

  /* Semantic aliases the rest of this file (and the scene tones) use.
     Tone names never change -- they are in the prompt and the schema;
     only what they map to does. */
  --fg: var(--color-primary);
  --bg: var(--color-bg-main);
  --card: var(--color-card-bg);
  --line: var(--color-border);
  --muted: var(--ink-muted);
  --accent: var(--color-primary);
  --cool: var(--ink-blue);
  --warm: var(--ink-gold);
  --alert: var(--ink-coral);
  --success: var(--ink-success);
}

* { box-sizing: border-box; }
/* Wins over any display: set by a class, so `hidden` always hides (the nav's Admin link). */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.65 var(--font-body); }
main { max-width: 44rem; margin: 0 auto; padding: 2.25rem 1.25rem 3.5rem; }
main.slides { max-width: 56rem; }
main.wide { max-width: 72rem; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; color: var(--fg); line-height: 1.25;
  text-wrap: balance; }
h1 { font-size: 1.75rem; margin: 0 0 0.35rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.6rem; }
.muted { color: var(--muted); }
ul { padding-left: 1.1rem; }
li { margin: 0.35rem 0; }
a { color: var(--cool); text-underline-offset: 0.15em; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--cool); outline-offset: 2px; }
section { margin: 1.75rem 0; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.small { font-size: 0.875rem; margin: 0.4rem 0 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

/* Buttons. Default is the guide's outline button; .submit is primary;
   .btn-gold is the call to action (Deep Teal text: white on gold is 2.5:1). */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: 600 0.9rem/1.2 var(--font-head); padding: 0.7rem 1.4rem; border-radius: var(--radius-btn);
  border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer;
  text-decoration: none; }
button:hover, .btn:hover { background: var(--tint-sage); }
button:disabled { opacity: 0.45; cursor: default; }
button:disabled:hover { background: transparent; }
.submit, .btn-primary { background: var(--accent); color: #fff; }
.submit:hover, .btn-primary:hover { background: var(--color-primary-hover); }
.btn-gold { background: var(--color-secondary); border-color: var(--color-secondary); color: var(--color-primary); }
.btn-gold:hover { background: var(--color-secondary-hover); border-color: var(--color-secondary-hover); }
.btn-gold:disabled:hover { background: var(--color-secondary); }

.result { margin-top: 0.75rem; padding: 0.7rem 0.85rem; border-radius: var(--radius-btn); overflow-x: auto;
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--muted);
  font-size: 0.85rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.result.pass { border-left-color: var(--success); background: var(--tint-sage); }
.result.fail { border-left-color: var(--color-accent-coral); background: var(--tint-coral); color: #5A2A18; }
form { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0 0.5rem; }

/* Site header (src/lib/render/page.ts, copied into public/*.html). */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-nav { max-width: 72rem; margin: 0 auto; padding: 0.7rem 1.25rem; display: flex; flex-wrap: wrap;
  align-items: center; gap: 0.6rem 1.25rem; }
.site-nav .brand { display: flex; align-items: center; gap: 0.6rem; margin-right: auto; text-decoration: none;
  font: 700 0.92rem/1.05 var(--font-head); letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg); }
.site-nav .brand img { flex: none; }
.brand-still { display: block; color: var(--warm); }
.site-nav > a:not(.brand) { font: 600 0.85rem/1.2 var(--font-head); text-decoration: none; color: var(--fg);
  padding: 0.45rem 0.9rem; border-radius: 999px; }
.site-nav > a:not(.brand):hover { background: var(--tint-sage); }
.site-nav > a[aria-current="page"] { background: var(--accent); color: #fff; }
.site-nav > a[aria-current="page"]:hover { background: var(--color-primary-hover); }
.nav-count { display: inline-block; min-width: 1.3rem; padding: 0 0.35rem; border-radius: 999px; text-align: center;
  background: var(--color-secondary); color: var(--color-primary); font-size: 0.72rem; line-height: 1.3rem; }

/* Admin page (src/lib/render/admin.ts). */
.admin-section { border-top: 0; padding-top: 0; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--card); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { padding: 0.65rem 0.8rem; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line); }
.admin-table tbody tr:last-child > * { border-bottom: 0; }
.admin-table th { font: 600 0.72rem/1.4 var(--font-head); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.admin-actions { white-space: nowrap; text-align: right; }
.admin-actions button { margin: 0.15rem 0 0.15rem 0.35rem; }
.admin-actions .submit { padding: 0.32rem 0.9rem; font-size: 0.78rem; }

/* Documents page. */
input[type="file"] { font: inherit; font-size: 0.9rem; flex: 1 1 16rem; min-width: 0; padding: 0.9rem 1rem;
  border: 1.5px dashed var(--color-accent-sage); border-radius: var(--radius-card); background: var(--card); color: var(--muted); }
input[type="file"]::file-selector-button { font: 600 0.82rem/1.2 var(--font-head); margin-right: 0.8rem;
  padding: 0.5rem 1rem; border-radius: var(--radius-btn); border: 1px solid var(--accent);
  background: var(--tint-sage); color: var(--accent); cursor: pointer; }
.docs { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.75rem; }
.docs li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.75rem; margin: 0;
  padding: 0.9rem 1.1rem; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-card); box-shadow: var(--shadow); }
.doc-name { font: 700 0.98rem/1.35 var(--font-head); color: var(--fg); overflow-wrap: anywhere; min-width: 0; }
a.doc-name { text-decoration: none; }
a.doc-name:hover { text-decoration: underline; }
.docs .result { flex-basis: 100%; }
/* The meta line takes the slack, so the actions sit right and wrap together. */
.docs li > .doc-name + .muted { flex: 1 1 auto; }
.link-button { border: none; background: none; padding: 0.15rem 0.3rem; border-radius: 6px;
  color: var(--muted); cursor: pointer; font: 400 0.85rem/1.4 var(--font-body); text-decoration: underline; }
.link-button:hover { color: var(--alert); background: none; }
.link-button.open-lesson { font: 600 0.82rem/1.2 var(--font-head); text-decoration: none; color: #fff;
  background: var(--accent); padding: 0.45rem 0.9rem; border-radius: 999px; }
.link-button.open-lesson:hover { color: #fff; background: var(--color-primary-hover); }
.link-button.btn-gold { font: 600 0.82rem/1.2 var(--font-head); text-decoration: none; padding: 0.45rem 0.9rem;
  border-radius: 999px; background: var(--color-secondary); color: var(--color-primary); }
.link-button.btn-gold:hover { background: var(--color-secondary-hover); color: var(--color-primary); }
.link-button:disabled { opacity: 0.5; cursor: default; }
details { margin: 1.25rem 0; }
summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }

/* Preferences form. */
#diagnostic-form { display: block; padding: 1.25rem 1.5rem; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-card); box-shadow: var(--shadow); }
form label { display: block; margin: 1rem 0; font-weight: 700; font-size: 0.92rem; }
form fieldset { border: none; padding: 0; margin: 1.25rem 0; }
form legend { font-weight: 700; font-size: 0.92rem; padding: 0; margin-bottom: 0.4rem; }
label.radio { display: flex; align-items: center; gap: 0.55rem; font-weight: 400; margin: 0.2rem 0;
  padding: 0.3rem 0.5rem; border-radius: var(--radius-btn); cursor: pointer; }
label.radio:hover { background: var(--tint-sage); }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
input[type="number"], textarea { font: inherit; width: 100%; max-width: 28rem; padding: 0.55rem 0.75rem;
  border-radius: var(--radius-card); border: 1px solid var(--line); background: var(--card); color: var(--fg);
  margin-top: 0.35rem; }
input[type="number"] { max-width: 7rem; }
form label input, form label textarea { font-weight: 400; }
#diagnostic-form > :first-child { margin-top: 0; }
input[type="number"]:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--tint-sage); }
textarea { resize: vertical; }
.familiarity-slot { margin-top: 0.35rem; width: 100%; }
.familiarity-options { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.8rem; text-decoration: none;
  color: var(--fg); background: var(--card); }
.link-button.chip { margin-left: 0; font: 600 0.78rem/1.2 var(--font-head); text-decoration: none; color: var(--fg); }
.chip:hover, .link-button.chip:hover { background: var(--tint-sage); border-color: var(--color-accent-sage); color: var(--fg); }

/* Home dashboard and lesson cards (public/index.html, public/lessons.js). */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2rem;
  padding: 2.75rem 3rem; border-radius: var(--radius-card); border: 1px solid var(--line);
  background: linear-gradient(120deg, var(--tint-sage) 0%, #F4F9F6 55%, var(--tint-blue) 100%); }
.hero .eyebrow { font: 600 0.72rem/1.4 var(--font-head); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--warm); margin: 0 0 0.75rem; }
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); letter-spacing: 0.01em; text-transform: uppercase; margin: 0; }
.hero .sub { font-size: 1.12rem; color: var(--muted); margin: 0.8rem 0 1.6rem; max-width: 32rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-art { width: clamp(220px, 30vw, 360px); height: auto; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 1rem; margin: 2.75rem 0 1.1rem; }
.section-head h2 { margin: 0; font-size: 1.3rem; }
.section-head p { margin: 0.2rem 0 0; }
.see-all { font: 600 0.85rem/1.2 var(--font-head); text-decoration: none; }
.see-all:hover { text-decoration: underline; }
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
p + .card-grid { margin-top: 1.25rem; }
.lesson-card { display: flex; flex-direction: column; margin: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow); overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.18s ease; }
.lesson-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-art { height: 116px; display: grid; place-items: center; background: var(--color-accent-sage); }
.card-art.blue { background: #CFE6E6; }
.card-art.gold { background: #EFE0C6; }
.card-art img { height: 84px; width: auto; }
.card-body { display: flex; flex-direction: column; gap: 0.55rem; padding: 1rem 1.15rem 1.15rem; flex: 1; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.card-title { font: 700 1rem/1.3 var(--font-head); color: var(--fg); text-decoration: none; min-width: 0;
  overflow-wrap: anywhere; }
a.card-title:hover { text-decoration: underline; }
.card-meta { margin: 0; font-size: 0.85rem; color: var(--muted); }
.badge { flex: none; font: 600 0.68rem/1.4 var(--font-head); letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.22rem 0.6rem; border-radius: 999px; white-space: nowrap; background: #EEF1F4; color: var(--muted); }
.badge.complete { background: var(--color-accent-sage); color: var(--fg); }
.badge.running { background: var(--tint-blue); color: var(--cool); }
.badge.failed { background: var(--tint-coral); color: var(--alert); }
.badge.pending { background: var(--tint-gold); color: var(--warm); }
.badge.rejected { background: var(--tint-coral); color: var(--alert); }
.badge.admin { background: var(--tint-blue); color: var(--cool); }
.parts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; padding-top: 0.35rem; }
.parts a { font: 600 0.76rem/1.2 var(--font-head); text-decoration: none; color: var(--fg);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.8rem; }
.parts a:hover { border-color: var(--accent); background: var(--tint-sage); }
.parts a:first-child { background: var(--accent); color: #fff; border-color: var(--accent); }
.parts a:first-child:hover { background: var(--color-primary-hover); }
.progress { margin-top: auto; padding-top: 0.35rem; }
.progress-label { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.78rem; color: var(--muted);
  margin-bottom: 0.35rem; font-variant-numeric: tabular-nums; }
.track { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.track > div { height: 100%; border-radius: 999px; background: var(--color-secondary); }
.lesson-card .result { margin: 0; }
.empty-card { grid-column: 1 / -1; margin: 0; border: 1.5px dashed var(--color-accent-sage); background: var(--card);
  border-radius: var(--radius-card); padding: 1.5rem 1.25rem; color: var(--muted); }
.empty-card strong { font-family: var(--font-head); color: var(--fg); }
.foot { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); display: flex;
  flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; font-size: 0.85rem; color: var(--muted); }
.foot .tagline { font: 600 0.85rem/1.4 var(--font-head); letter-spacing: 0.04em; color: var(--cool); }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem 1.25rem; flex-wrap: wrap; }
.foot li { margin: 0; }

/* Server-rendered reading page. Every class here styles escaped text —
   the structure comes from the stored JSON, never from model markup. */
.crumb { margin: 0 0 0.75rem; font-size: 0.85rem; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.lesson-nav { display: inline-flex; flex-wrap: wrap; gap: 0.2rem; margin: 0 0 1.5rem; padding: 0.25rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.lesson-nav > a, .lesson-nav > span { font: 600 0.82rem/1.2 var(--font-head); padding: 0.45rem 1rem;
  border-radius: 999px; text-decoration: none; color: var(--fg); }
.lesson-nav > a:hover { background: var(--tint-sage); }
.lesson-nav > span.muted { color: var(--muted); font-weight: 600; }
.lesson-nav [aria-current="page"] { background: var(--accent); color: #fff; }
.meta { color: var(--muted); font-size: 0.88rem; margin: 0.25rem 0 1.5rem; }
.warn { border-left: 3px solid var(--color-accent-coral); padding: 0.65rem 0.85rem; margin: 1rem 0;
  background: var(--tint-coral); border-radius: var(--radius-btn); font-size: 0.9rem; color: #5A2A18; }
.reading { font-size: 1.04rem; }
.reading h2 { font-size: 1.2rem; margin: 2.25rem 0 0.6rem; }
.reading p { margin: 0 0 1rem; }
.checkpoint { margin: 1.75rem 0; padding: 0.95rem 1.15rem; border-radius: var(--radius-card);
  border: 1px solid var(--color-accent-sage); border-left: 4px solid var(--accent); background: var(--tint-sage); }
.checkpoint p { margin: 0.3rem 0 0; }
.checkpoint-label { font: 700 0.7rem/1.4 var(--font-head); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); }
sup.cite { font-size: 0.7em; line-height: 0; margin-left: 0.1em; }
sup.cite a { text-decoration: none; padding: 0 0.15em; font-weight: 700; }
.citations { font-size: 0.9rem; }
.citations ol { padding-left: 1.4rem; }
.citations li { margin: 0.6rem 0; scroll-margin-top: 1rem; }
.citations .loc { color: var(--muted); font-size: 0.85em; display: block; }
.citations q { font-style: italic; }

/* Quiz. The <details> element is the pedagogy: answers stay hidden until
   the learner has produced one, and it needs no script under the CSP. */
.how { font-size: 0.92rem; padding: 0.75rem 0.95rem; border-radius: var(--radius-btn);
  background: var(--tint-sage); border-left: 3px solid var(--accent); margin: 0 0 1.5rem; }
.quiz-form { display: block; }
/* Numbers are drawn, not ::marker: a marker beside a <fieldset> floats to its middle. */
.quiz { list-style: none; padding-left: 1.75rem; counter-reset: quiz; display: grid; gap: 1rem; }
.quiz > li { position: relative; counter-increment: quiz; margin: 0; padding: 1rem 1.25rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow); scroll-margin-top: 1rem; }
.quiz > li::before { content: counter(quiz) "."; position: absolute; left: -1.75rem; top: 1rem;
  font: 700 0.95rem/1.6 var(--font-head); color: var(--warm); }
.concept { display: inline-block; font: 600 0.68rem/1.4 var(--font-head); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--cool); margin-bottom: 0.25rem; }
.quiz .q { margin: 0.15rem 0 0.6rem; font-size: 1.03rem; }
.quiz details { border-left: 2px solid var(--color-accent-sage); padding-left: 0.85rem; margin: 0.9rem 0 0.25rem; }
.quiz summary { font-size: 0.85rem; }
.quiz .a { margin: 0.5rem 0 0.4rem; }
.quiz .src { font-size: 0.85rem; color: var(--muted); margin: 0.4rem 0 0; }
.quiz .src q { font-style: italic; }
.quiz fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
.quiz legend { padding: 0; }
.quiz .hint { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.3rem; }
.option { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.45rem 0.7rem; margin: 0.2rem 0;
  border-radius: var(--radius-btn); border: 1px solid transparent; cursor: pointer; font-weight: 400; }
.option:hover { background: var(--tint-sage); border-color: var(--color-accent-sage); }
.option input { flex: none; accent-color: var(--accent); }
.submit { margin-top: 0.5rem; }
.score { display: flex; align-items: center; gap: 1.25rem; margin: 0 0 1.25rem; padding: 1.1rem 1.3rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow); }
.score p { margin: 0; }
.grade-badge { flex: none; display: grid; place-items: center; width: 4.5rem; height: 4.5rem;
  font: 700 2.4rem/1 var(--font-head); border-radius: var(--radius-card); color: var(--color-primary); }
.grade-A, .grade-B { background: var(--color-accent-sage); }
.grade-C, .grade-D { background: var(--color-secondary); }
.grade-E { background: var(--color-accent-coral); }
.score .grade-badge + p { font: 700 1.1rem/1.35 var(--font-head); }
.results > li { border-left: 4px solid var(--success); }
.results > li.wrong { border-left-color: var(--color-accent-coral); }
.verdict { margin: 0; font: 700 0.7rem/1.4 var(--font-head); letter-spacing: 0.1em; text-transform: uppercase; }
.right .verdict { color: var(--success); }
.wrong .verdict { color: var(--alert); }
.results .options { list-style: none; padding: 0; margin: 0.3rem 0 0.6rem; display: grid; gap: 0.3rem; }
.results .options li { margin: 0; padding: 0.45rem 0.7rem; border-radius: var(--radius-btn); border: 1px solid transparent; }
.option-result.is-answer { background: var(--tint-sage); border-color: var(--color-accent-sage); }
.option-result.is-chosen:not(.is-answer) { background: var(--tint-coral); border-color: #F6C4B0; }
.option-result .tag { font-size: 0.75rem; color: var(--muted); margin-left: 0.25rem; }
.attempts ul { padding-left: 1.1rem; }
.grade { display: flex; gap: 0.5rem; margin: 0.9rem 0 0; padding-top: 0.8rem; flex-wrap: wrap;
  border-top: 1px dashed var(--line); }
.grade button { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.grade button[value="1"] { border-color: var(--alert); color: var(--alert); }
.grade button[value="1"]:hover { background: var(--tint-coral); }
.grade button[value="4"] { border-color: var(--success); color: var(--success); }
.deck { list-style: none; padding: 0; }
.deck .slide { margin: 1.25rem 0; padding: 1.1rem 1.3rem; border-radius: var(--radius-card); background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); scroll-margin-top: 1rem; }
.deck .slide h2 { margin: 0 0 0.6rem; }
.deck .slide .src { font-size: 0.85rem; color: var(--muted); margin: 0.6rem 0 0; }
.deck .slide .src q { font-style: italic; }
.next { margin-top: 2rem; padding-top: 1.25rem; font: 600 0.92rem/1.5 var(--font-head);
  border-top: 1px solid var(--line); }

/* Visual slides (ADR-023): one claim and one diagram per slide. */
.vdeck { margin: 1.5rem 0; }
.vslide { margin: 0 0 1.5rem; padding: 1.6rem 1.9rem 1.4rem; border-radius: var(--radius-card); background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); scroll-margin-top: 1rem; }
.vdeck.paged .vslide { min-height: 22rem; }
.vslide-count { margin: 0; font: 600 0.72rem/1.4 var(--font-head); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--warm); }
.vslide .assertion { font-size: 1.4rem; line-height: 1.3; margin: 0.4rem 0 1.5rem; }
.vslide .src { font-size: 0.82rem; color: var(--muted); margin: 1.4rem 0 0; padding-top: 0.85rem;
  border-top: 1px solid var(--line); }
.vslide .src q { font-style: italic; }
.vdeck-controls { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0 0; }
.vdeck-controls button { padding: 0.5rem 1.1rem; font-size: 0.82rem; }
.vdeck-controls button:last-child:not(:disabled) { background: var(--accent); color: #fff; }
.vdeck-controls button:last-child:not(:disabled):hover { background: var(--color-primary-hover); }
.vdeck.paged { margin-top: 1rem; }
.vdeck.paged .vslide-count { display: none; }
.vdeck-position { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.regenerate { margin-top: 1.5rem; }

/* Diagrams. The connectors carry the relation, so they are drawn, not described. */
.dg { margin: 0; padding: 0; list-style: none; }
.dg-node { display: block; padding: 0.7rem 0.9rem; border-radius: var(--radius-card);
  border: 1.5px solid var(--accent); background: var(--tint-sage); }
.dg-label { display: block; font: 600 0.95rem/1.3 var(--font-head); }
.dg-detail { display: block; font-size: 0.86rem; color: var(--muted); line-height: 1.4; margin-top: 0.2rem; }

.dg-sequence, .dg-cycle { display: flex; flex-direction: column; gap: 1.7rem; }
.dg-sequence > li, .dg-cycle > li { position: relative; display: grid; grid-template-columns: auto 1fr;
  column-gap: 0.7rem; align-items: center; margin: 0; }
.dg-sequence > li > .dg-label, .dg-cycle > li > .dg-label,
.dg-sequence > li > .dg-detail, .dg-cycle > li > .dg-detail { grid-column: 2; }
.dg-step { grid-row: span 2; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--accent);
  color: #fff; font: 700 0.8rem/1 var(--font-head); display: grid; place-items: center; }
.dg-sequence > li + li::before, .dg-cycle > li + li::before { content: "\2193"; position: absolute;
  top: -1.65rem; left: 50%; transform: translateX(-50%); color: var(--warm); font-weight: 700; line-height: 1.5rem; }
.dg-loop { margin: 0.8rem 0 0; color: var(--warm); font: 600 0.88rem/1.4 var(--font-head); }
@media (min-width: 36rem) {
  /* Three steps or fewer fit side by side; more read better stacked. */
  .dg-sequence:not(:has(> li:nth-child(4))) { flex-direction: row; gap: 2.1rem; }
  .dg-sequence:not(:has(> li:nth-child(4))) > li { flex: 1; }
  .dg-sequence:not(:has(> li:nth-child(4))) > li + li::before { content: "\2192"; top: 50%; left: -1.65rem;
    transform: translateY(-50%); }
}

.dg-timeline { border-left: 2px solid var(--color-accent-sage); margin-left: 0.5rem; padding-left: 1.2rem;
  display: flex; flex-direction: column; gap: 0.9rem; }
.dg-timeline > li { position: relative; margin: 0; }
.dg-timeline > li::before { content: ""; position: absolute; left: calc(-1.2rem - 7px); top: 0.45rem;
  width: 12px; height: 12px; border-radius: 50%; background: var(--color-secondary); border: 2px solid var(--card); }
.dg-when { display: block; font: 700 0.9rem/1.4 var(--font-head); color: var(--warm); }

.dg-hierarchy ul { list-style: none; margin: 0; padding-left: 1.4rem; }
.dg-hierarchy li { position: relative; margin-top: 0.6rem; }
.dg-hierarchy > li { margin-top: 0; }
.dg-hierarchy ul > li::before { content: ""; position: absolute; left: -0.9rem; top: -0.6rem; bottom: 0;
  border-left: 1.5px solid var(--color-accent-sage); }
.dg-hierarchy ul > li:last-child::before { bottom: auto; height: 1.8rem; }
.dg-hierarchy ul > li::after { content: ""; position: absolute; left: -0.9rem; top: 1.2rem; width: 0.9rem;
  border-top: 1.5px solid var(--color-accent-sage); }
.dg-hierarchy > li > .dg-node, .dg-result { background: var(--accent); color: #fff; }
.dg-hierarchy > li > .dg-node .dg-detail, .dg-result .dg-detail { color: inherit; opacity: 0.85; }

.dg-causes { display: grid; grid-template-columns: 1fr auto minmax(8rem, 0.8fr); align-items: center; gap: 0.75rem; }
.dg-factors { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.dg-factors > li { margin: 0; }
.dg-arrow { font-size: 1.8rem; line-height: 1; color: var(--warm); font-weight: 700; justify-self: center; }
.dg-sub { list-style: none; margin: 0.45rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.dg-sub li { margin: 0; font-size: 0.8rem; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--card);
  border: 1px solid var(--color-accent-sage); }
.dg-sub .dg-label { display: inline; font: 400 0.8rem/1.4 var(--font-body); }
.dg-sub .dg-detail { display: inline; margin-left: 0.3rem; font-size: inherit; }
@media (max-width: 36rem) {
  .dg-causes { grid-template-columns: 1fr; }
  .dg-arrow { transform: rotate(90deg); }
}

.dg-comparison { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-card); }
.dg-comparison table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.dg-comparison th, .dg-comparison td { padding: 0.6rem 0.75rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line); }
.dg-comparison tbody tr:nth-child(even) { background: var(--tint-sage); }
.dg-comparison tbody tr:last-child > * { border-bottom: 0; }
.dg-comparison thead th { background: var(--accent); color: #fff; font: 700 0.88rem/1.35 var(--font-head); }
.dg-comparison thead td { border-bottom: 0; background: var(--accent); }
.dg-comparison tbody th { color: var(--muted); font: 600 0.72rem/1.4 var(--font-head); text-transform: uppercase;
  letter-spacing: 0.05em; min-width: 6rem; }

/* Scenes (ADR-024): composed by the model from named parts, coloured here by name.
   Labels stay in the body face: scene.ts wraps text assuming glyphs about 0.56em wide. */
.scene { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
/* A scene is one picture, so it scales as one. Below this width its labels would shrink
   past legible; the picture scrolls sideways inside the slide instead (never the page). */
.evidence:has(> .scene) { overflow-x: auto; }
.evidence > .scene { min-width: 30rem; }
.sc-accent { color: var(--accent); }
.sc-warm { color: var(--warm); }
.sc-cool { color: var(--cool); }
.sc-alert { color: var(--alert); }
.sc-neutral { color: var(--muted); }
.sc-body { stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; }
.sc-tint .sc-body { fill: currentColor; fill-opacity: 0.14; }
.sc-solid .sc-body { fill: currentColor; }
.sc-outline .sc-body { fill: var(--card); }
.sc-label { fill: var(--fg); font-weight: 700; }
.sc-solid .sc-label { fill: #fff; }
.sc-solid .sc-icon { color: #fff; }
.sc-free .sc-label { fill: currentColor; }
.sc-text { fill: currentColor; font-weight: 700; }
.sc-neutral .sc-text, .sc-neutral.sc-free .sc-label { fill: var(--fg); }
.sc-text-xl .sc-text { letter-spacing: -0.01em; }
.sc-line { stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.sc-dashed { stroke-dasharray: 7 6; }
.sc-head { fill: currentColor; }
.sc-arrow-label { fill: var(--fg); font-weight: 400; paint-order: stroke; stroke: var(--card); stroke-width: 6px;
  stroke-linejoin: round; }

@media (max-width: 44rem) {
  .site-nav { gap: 0.5rem 0.1rem; }
  .site-nav .brand { flex-basis: 100%; }
  .site-nav > a:not(.brand) { padding: 0.4rem 0.55rem; font-size: 0.76rem; }
  .hero { grid-template-columns: 1fr; padding: 1.75rem 1.4rem; }
  .hero-art { display: none; }
  .vslide { padding: 1.2rem 1.1rem; }
  #diagnostic-form { padding: 1rem 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lesson-card { transition: none; }
  .lesson-card:hover { transform: none; }
}
