/* ==========================================================================
   Stories in Our Genes: main stylesheet
   One file, no build step. Sections:
   1. Design tokens   2. Base   3. Layout   4. Header, nav, search
   5. Buttons & cards 6. Home  7. Story    8. Glossary pop-up
   9. Quiz & summary 10. Inheritance Lab  11. Simulation  12. Glossary page
   13. Forms         14. Footer 15. Utilities & accessibility
   ========================================================================== */

/* 1. Design tokens ------------------------------------------------------- */
:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f4ede4;
  --ink: #1f1a17;
  --muted: #5e554f;
  --border: #e6dbcf;
  --primary: #b3261e;        /* blood red */
  --primary-dark: #8c1c16;
  --primary-soft: #fbe9e7;
  --accent: #0f6e6e;         /* teal for science notes */
  --accent-soft: #e3f1f0;
  --gold: #c98a12;
  --gold-soft: #fdf3dc;
  --success: #1e7a3c;
  --success-soft: #e4f4e9;
  --danger: #a3261b;
  --danger-soft: #fdebe9;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 26, 23, .06), 0 6px 20px rgba(31, 26, 23, .06);
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --container: 1120px;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 .5em;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-dark); }
img, svg, canvas { max-width: 100%; display: block; }
ul, ol { padding-left: 1.25rem; }
mark { background: var(--gold-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

/* 3. Layout -------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
main { display: block; min-height: 60vh; }
.section { padding: 56px 0; }
.section-tight { padding: 32px 0; }
.section-alt { background: var(--surface-2); }
.page-header { padding: 48px 0 24px; }
.page-header p.lead { font-size: 1.15rem; color: var(--muted); max-width: 680px; }
.eyebrow {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: .5rem;
}
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* 4. Header, nav, search ------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(6px);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin-right: auto;
}
.brand svg { width: 32px; height: 32px; }
.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: .95rem;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }

.search { position: relative; width: 240px; }
.search input {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
}
.search input:focus { background: var(--surface); }
.search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-results {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(420px, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 60;
}
.search-results li a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
}
.search-results li a:hover, .search-results li[aria-selected="true"] a { background: var(--surface-2); }
.search-results .result-type { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.search-results .result-title { display: block; font-weight: 700; }
.search-results .result-text { display: block; font-size: .88rem; color: var(--muted); }
.search-results .no-results { padding: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; width: 100%; order: 3; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: 8px 0; }
  .search { width: 100%; order: 4; }
  .search-results { left: 0; right: auto; width: 100%; }
}

/* 5. Buttons & cards ----------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 999px;
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
  transition: background-color .15s, color .15s, border-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; padding: 8px 12px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-small { padding: 8px 14px; font-size: .9rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.justify-center { justify-content: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }

.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.badge-live { background: var(--success-soft); color: var(--success); }
.badge-soon { background: var(--gold-soft); color: #7a5208; }

/* Chapter cards */
.chapter-card { display: flex; flex-direction: column; gap: 10px; position: relative; }
.chapter-card .chapter-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.chapter-card .chapter-number { font-family: var(--font-display); font-size: .95rem; color: var(--muted); }
.chapter-card.is-soon { background: var(--surface-2); box-shadow: none; }
.chapter-card .card-actions { margin-top: auto; padding-top: 8px; }

/* 6. Home ---------------------------------------------------------------- */
.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { margin-bottom: .35em; }
.hero h1 em { font-style: italic; color: var(--primary); }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 560px; }
.hero-art { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 12px; box-shadow: var(--shadow); }
.hero-art svg { width: 100%; height: auto; border-radius: 16px; }
@media (max-width: 820px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { order: -1; } }

.steps { counter-reset: step; }
.step-card { position: relative; padding-top: 52px; }
.step-card::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 18px;
  left: 22px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: .95rem;
}
.callout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 28px;
}
.callout h2 { color: #fff; margin-bottom: .25em; }
.callout p { margin: 0; opacity: .92; }
.callout .btn-secondary { border-color: transparent; }
@media (max-width: 700px) { .callout { grid-template-columns: 1fr; } }

/* 7. Story --------------------------------------------------------------- */
.story-shell { padding: 28px 16px 56px; scroll-margin-top: 80px; }
.story-topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.story-topbar h1 { font-size: 1.3rem; margin: 0; }
.progress-wrap { margin-bottom: 20px; }
.progress-label { display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); margin-bottom: 6px; }
.progress-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #e0563f); border-radius: 999px; transition: width .4s ease; }
.story-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.story-art { background: var(--surface-2); display: flex; align-items: center; justify-content: center; padding: 16px; }
.story-art svg { width: 100%; height: auto; border-radius: 14px; }
.story-body { padding: 28px; }
.story-body h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); }
.story-body h2:focus { outline: none; }
.story-text p { font-size: 1.08rem; }
.story-ending-badge { display: inline-block; background: var(--gold-soft); color: #7a5208; font-weight: 700; padding: 4px 12px; border-radius: 999px; margin-bottom: 10px; font-size: .85rem; }
@media (max-width: 820px) { .story-card { grid-template-columns: 1fr; } .story-body { padding: 22px 18px; } }

.science-note {
  background: var(--accent-soft);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 4px 18px;
  margin: 20px 0;
}
.science-note summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
  padding: 12px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.science-note summary::-webkit-details-marker { display: none; }
.science-note summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .95rem; line-height: 1; }
.science-note[open] summary::before { content: "\2212"; }
.science-note .note-content { padding-bottom: 14px; }
.science-note .note-content p { margin-bottom: .6em; }

.choices { display: grid; gap: 10px; margin-top: 18px; }
.choice-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-weight: 700;
  padding: 14px 18px;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.choice-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.choice-btn .arrow { color: var(--primary); flex-shrink: 0; font-size: 1.2rem; }
.story-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 18px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .95rem;
  z-index: 80;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}

/* 8. Glossary term pop-up ------------------------------------------------ */
.term {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: help;
  text-decoration: underline dotted var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  font-weight: 700;
}
.term:hover, .term[aria-expanded="true"] { color: var(--accent); }
.term-popover {
  position: absolute;
  z-index: 70;
  width: min(320px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(31, 26, 23, .18);
  padding: 14px 16px;
  font-size: .95rem;
}
.term-popover:focus { outline: none; }
.term-popover strong { font-family: var(--font-display); font-size: 1.1rem; display: block; margin-bottom: 4px; }
.term-popover p { margin: 0 0 8px; }
.term-popover .pop-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .9rem; }
.term-popover .pop-close { background: none; border: none; font: inherit; color: var(--muted); cursor: pointer; padding: 4px; }

/* 9. Quiz & summary ------------------------------------------------------ */
.quiz-card { padding: 28px; }
.quiz-progress { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.quiz-question { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 18px; }
.quiz-options { display: grid; gap: 10px; border: none; padding: 0; margin: 0; }
.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.quiz-option:hover:not([disabled]) { border-color: var(--ink); }
.quiz-option[disabled] { cursor: default; }
.quiz-option.correct { border-color: var(--success); background: var(--success-soft); }
.quiz-option.incorrect { border-color: var(--danger); background: var(--danger-soft); }
.quiz-feedback { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); }
.quiz-feedback.is-correct { background: var(--success-soft); }
.quiz-feedback.is-incorrect { background: var(--danger-soft); }
.quiz-feedback strong { display: block; margin-bottom: 4px; }
.score-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: var(--primary-soft);
  border: 8px solid var(--primary);
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
}
.review-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.review-list li { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.review-list li.ok { border-left: 4px solid var(--success); }
.review-list li.miss { border-left: 4px solid var(--danger); }
.learned-list { list-style: none; padding: 0; display: grid; gap: 12px; counter-reset: learned; }
.learned-list li { position: relative; padding: 16px 16px 16px 60px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.learned-list li::before {
  counter-increment: learned;
  content: counter(learned);
  position: absolute;
  left: 16px;
  top: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* 10. Inheritance Lab ---------------------------------------------------- */
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .lab-grid { grid-template-columns: 1fr; } }
.parent-picker { border: none; padding: 0; margin: 0 0 18px; }
.parent-picker legend { font-weight: 700; margin-bottom: 8px; font-size: 1.05rem; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: block;
  text-align: center;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
}
.segmented label .geno { display: block; font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }
.segmented label .geno-desc { display: block; font-size: .78rem; color: var(--muted); }
.segmented input:checked + label { border-color: var(--primary); background: var(--primary-soft); }
.segmented input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.punnett { display: grid; grid-template-columns: 56px 1fr 1fr; grid-template-rows: 56px 1fr 1fr; gap: 6px; max-width: 420px; margin: 0 auto 18px; }
.punnett .p-head {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.punnett .p-corner { background: transparent; font-size: .7rem; color: var(--muted); text-align: center; line-height: 1.2; font-family: var(--font-body); font-weight: 400; }
.punnett .p-cell {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  text-align: center;
  padding: 6px;
}
.punnett .p-cell .geno { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; }
.punnett .p-cell .geno-desc { font-size: .78rem; }
.g-AA { background: var(--success-soft); border-color: #9fd3b0; }
.g-AS { background: var(--gold-soft); border-color: #ecc77a; }
.g-SS { background: var(--danger-soft); border-color: #eba59d; }
.result-bars { display: grid; gap: 10px; margin-bottom: 16px; }
.result-bar .bar-label { display: flex; justify-content: space-between; font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.result-bar .bar-track { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.result-bar .bar-fill { height: 100%; width: 0; border-radius: 999px; transition: width .4s ease; }
.fill-AA { background: var(--success); }
.fill-AS { background: var(--gold); }
.fill-SS { background: var(--primary); }
.explain-box { background: var(--surface-2); border-radius: var(--radius); padding: 16px 18px; }
.explain-box p:last-child { margin-bottom: 0; }

/* 11. Simulation --------------------------------------------------------- */
.sim-card { padding: 0; overflow: hidden; }
.sim-canvas-wrap { background: #fff6f3; border-bottom: 1px solid var(--border); }
.sim-canvas-wrap canvas { width: 100%; height: 260px; }
.sim-controls { padding: 20px 22px; display: grid; gap: 16px; }
.sim-slider label { font-weight: 700; display: flex; justify-content: space-between; margin-bottom: 6px; }
.sim-slider input[type="range"] { width: 100%; accent-color: var(--primary); height: 28px; }
.sim-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat .stat-label { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat .stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.sim-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .9rem; color: var(--muted); }
.sim-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.dot-normal { background: #d63a2f; }
.dot-sickle { background: #6e1a14; border-radius: 14px 14px 2px 2px; }
.dot-stuck { background: #6e1a14; outline: 2px solid var(--gold); }

.learn-section { scroll-margin-top: 90px; }
.myth-fact { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.myth-fact > div { padding: 16px 18px; }
.myth-fact .myth { background: var(--danger-soft); }
.myth-fact .fact { background: var(--success-soft); }
.myth-fact h4 { font-family: var(--font-body); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
@media (max-width: 640px) { .myth-fact { grid-template-columns: 1fr; } }
.warning-box { background: var(--danger-soft); border-left: 5px solid var(--danger); border-radius: var(--radius-sm); padding: 16px 18px; }

/* 12. Glossary page ------------------------------------------------------ */
.alpha-nav { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 24px; padding: 0; list-style: none; }
.alpha-nav a, .alpha-nav span {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
}
.alpha-nav a { background: var(--surface); border: 1px solid var(--border); color: var(--ink); }
.alpha-nav a:hover { border-color: var(--primary); color: var(--primary); }
.alpha-nav span { color: #c3b8ad; }
.glossary-filter { width: 100%; max-width: 420px; margin-bottom: 16px; }
.glossary-group { margin-bottom: 28px; scroll-margin-top: 90px; }
.glossary-group > h2 { font-size: 1.6rem; color: var(--primary); border-bottom: 2px solid var(--border); padding-bottom: 4px; }
.glossary-entry { padding: 14px 0; border-bottom: 1px dashed var(--border); scroll-margin-top: 90px; }
.glossary-entry:target { background: var(--gold-soft); border-radius: var(--radius-sm); padding-left: 12px; padding-right: 12px; }
.glossary-entry h3 { margin-bottom: .2em; }
.glossary-entry .appears { font-size: .9rem; color: var(--muted); margin: 6px 0 0; }
.glossary-entry .appears a { margin-right: 6px; }

/* 13. Forms -------------------------------------------------------------- */
.form-field { margin-bottom: 16px; }
.form-field > label, .form-field legend { display: block; font-weight: 700; margin-bottom: 6px; }
fieldset.form-field { border: none; padding: 0; margin: 0 0 16px; }
.input, textarea.input, select.input {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
textarea.input { min-height: 110px; resize: vertical; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill label {
  display: inline-block;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  background: var(--surface);
  font-weight: 700;
  margin: 0;
}
.radio-pill input:checked + label { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.radio-pill input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.hint { font-size: .88rem; color: var(--muted); margin-top: 4px; }
.form-status { margin-top: 12px; font-weight: 700; }
.form-status.ok { color: var(--success); }
.form-status.err { color: var(--danger); }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* 14. Footer ------------------------------------------------------------- */
.site-footer { background: #241d19; color: #e9e1d8; padding: 40px 0 28px; margin-top: 40px; }
.site-footer a { color: #ffd3cc; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer-grid h2 { font-size: 1.05rem; color: #fff; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 6px; }
.disclaimer { background: rgba(255, 255, 255, .07); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .92rem; }
.footer-bottom { margin-top: 28px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .88rem; color: #b8ada2; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* 15. Utilities & accessibility ------------------------------------------ */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.skip-link:focus { top: 12px; color: #fff; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 24px; }
.stack > * + * { margin-top: 16px; }
.noscript-msg { background: var(--gold-soft); padding: 12px 16px; border-radius: var(--radius-sm); }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
