/*
 * iFairy Curriculum — shared design system (2026-10-04).
 *
 * One stylesheet for every public page (was ~200 lines of near-identical
 * inline CSS in each of 8 templates). Light by default — schools print pages
 * and project them on classroom boards — with a dark theme that follows the
 * OS setting or the header toggle (<html data-theme>). The iFairy identity
 * stays: blue→violet brand mark and hero gradient, rounded cards, friendly
 * type; it is deliberately not a GOV.UK look-alike (we are independent).
 *
 * Accessibility (WCAG 2.2 AA): text colours are ≥ 4.5:1 on their surfaces in
 * both themes, a visible :focus-visible ring everywhere, skip link, reduced
 * motion honoured, print styles strip the chrome.
 */

:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --line: #dde3ed;
  --line-strong: #b9c3d3;
  --text: #0f172a;
  --text-dim: #334155;
  --muted: #4f5d73;
  --brand: #2554d6;
  --brand-strong: #1c3fa8;
  --brand-soft: #e9efff;
  --accent: #7a36d9;
  --accent-soft: #f3ecff;
  --on-brand: #ffffff;
  --ok: #046c4e;
  --ok-soft: #e3f6ee;
  --warn: #8a4b00;
  --warn-soft: #fff4e0;
  --focus: #1c3fa8;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 14px -6px rgba(15, 23, 42, 0.12);
  --shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.08), 0 10px 24px -8px rgba(37, 84, 214, 0.28);
  --hero: radial-gradient(1200px 380px at 12% -10%, rgba(122, 54, 217, 0.12), transparent 60%),
    radial-gradient(900px 340px at 92% 0%, rgba(37, 84, 214, 0.14), transparent 60%);
  --header-bg: rgba(255, 255, 255, 0.88);
  --radius: 0.85rem;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dark theme: the OS preference unless the visitor picked light, or an explicit pick. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1020;
    --surface: #121a2e;
    --surface-2: #17213a;
    --line: #26324f;
    --line-strong: #3a4a6e;
    --text: #f1f5f9;
    --text-dim: #d3dbe7;
    --muted: #a9b5c9;
    --brand: #7fb0ff;
    --brand-strong: #a9c9ff;
    --brand-soft: rgba(127, 176, 255, 0.13);
    --accent: #c9b2ff;
    --accent-soft: rgba(201, 178, 255, 0.12);
    --on-brand: #0b1020;
    --ok: #6ee7b7;
    --ok-soft: rgba(110, 231, 183, 0.12);
    --warn: #fcd34d;
    --warn-soft: rgba(252, 211, 77, 0.12);
    --focus: #fcd34d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px -8px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 12px 28px -10px rgba(127, 176, 255, 0.3);
    --hero: radial-gradient(1200px 380px at 12% -10%, rgba(201, 178, 255, 0.12), transparent 60%),
      radial-gradient(900px 340px at 92% 0%, rgba(127, 176, 255, 0.14), transparent 60%);
    --header-bg: rgba(11, 16, 32, 0.86);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #121a2e;
  --surface-2: #17213a;
  --line: #26324f;
  --line-strong: #3a4a6e;
  --text: #f1f5f9;
  --text-dim: #d3dbe7;
  --muted: #a9b5c9;
  --brand: #7fb0ff;
  --brand-strong: #a9c9ff;
  --brand-soft: rgba(127, 176, 255, 0.13);
  --accent: #c9b2ff;
  --accent-soft: rgba(201, 178, 255, 0.12);
  --on-brand: #0b1020;
  --ok: #6ee7b7;
  --ok-soft: rgba(110, 231, 183, 0.12);
  --warn: #fcd34d;
  --warn-soft: rgba(252, 211, 77, 0.12);
  --focus: #fcd34d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px -8px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 12px 28px -10px rgba(127, 176, 255, 0.3);
  --hero: radial-gradient(1200px 380px at 12% -10%, rgba(201, 178, 255, 0.12), transparent 60%),
    radial-gradient(900px 340px at 92% 0%, rgba(127, 176, 255, 0.14), transparent 60%);
  --header-bg: rgba(11, 16, 32, 0.86);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}
body > main { flex: 1 0 auto; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--text); }
a { color: var(--brand); text-underline-offset: 0.18em; }
a:hover { color: var(--brand-strong); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.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: 1rem;
  top: -100px;
  z-index: 100;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 0 0 0.5rem 0.5rem;
  text-decoration: none;
}
.skip-link:focus { top: 0; color: var(--on-brand); }

/* ── Header ───────────────────────────────────────────────────────────── */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
}
.brand-link { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; margin-right: auto; }
.brand-link:hover { color: var(--text); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.65rem;
  color: #ffffff;
  background: linear-gradient(135deg, #2f6bff 0%, #7a36d9 100%);
  box-shadow: 0 4px 12px -4px rgba(122, 54, 217, 0.55);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.02rem; letter-spacing: -0.01em; }
.brand-text strong span { color: var(--accent); }
.brand-text small { font-size: 0.72rem; color: var(--muted); font-weight: 500; }

nav.site-nav { display: flex; gap: 0.2rem; align-items: center; flex-wrap: wrap; }
nav.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 0.55rem;
}
nav.site-nav a:hover { color: var(--brand-strong); background: var(--brand-soft); }
nav.site-nav a[aria-current="page"], nav.site-nav a.active { color: var(--brand-strong); background: var(--brand-soft); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--line-strong); color: var(--text); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 720px) {
  .header-inner { padding: 0.6rem 1rem; }
  nav.site-nav { order: 3; width: 100%; margin: 0 -0.5rem; }
  nav.site-nav a { white-space: nowrap; padding: 0.4rem 0.6rem; }
  header.site-header { position: static; }
}

/* ── Layout ───────────────────────────────────────────────────────────── */
main { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 1.25rem; }
main.narrow { max-width: 920px; }
section.page-section { padding: 2.75rem 0; border-bottom: 1px solid var(--line); }
section.page-section:last-of-type { border-bottom: none; }
section.page-section > h2 { font-size: clamp(1.45rem, 1.1rem + 1.2vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.85rem; }
section.page-section > h1, #content > h1, .template-head h1 { font-size: clamp(1.75rem, 1.25rem + 1.8vw, 2.4rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 0.6rem; }
.lede + .filters { margin-top: 1.25rem; }
.lede, p.lede { max-width: 72ch; color: var(--text-dim); font-size: 1.06rem; line-height: 1.7; margin-top: 0.6rem; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

/* Home hero — the part that carries the iFairy personality. */
#home, .hero {
  position: relative;
  padding-top: 3.5rem;
  padding-bottom: 3rem;
}
.hero-band { background: var(--hero); border-bottom: 1px solid var(--line); margin-inline: calc(50% - 50vw); padding-inline: calc(50vw - 50%); }
.hero-band > .page-section { border-bottom: none; }
#home h1, .hero h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); font-weight: 800; letter-spacing: -0.03em; max-width: 22ch; }
#home h1 .grad, .hero h1 .grad {
  background: linear-gradient(120deg, var(--brand) 10%, var(--accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Buttons & forms ──────────────────────────────────────────────────── */
.cta-row { display: flex; gap: 0.75rem; margin-top: 1.6rem; flex-wrap: wrap; }
.btn, .cta-row a, .source-cta a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  border-radius: 0.65rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid transparent;
  line-height: 1.2;
}
.btn-primary, .cta-row a.primary, .source-cta a {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 6px 16px -8px rgba(37, 84, 214, 0.7);
}
.btn-primary:hover, .cta-row a.primary:hover, .source-cta a:hover { background: var(--brand-strong); color: var(--on-brand); }
.btn-secondary, .cta-row a.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-secondary:hover, .cta-row a.secondary:hover { border-color: var(--brand); color: var(--brand-strong); }

input, select, textarea, button { font: inherit; }
input, select, textarea {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
  min-height: 2.75rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
input[type="checkbox"] { min-height: 0; width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }
button {
  color: var(--on-brand);
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 0.6rem;
  padding: 0.6rem 1.1rem;
  min-height: 2.75rem;
  font-weight: 700;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: var(--surface); color: var(--text-dim); border-color: var(--line-strong); }
button.ghost:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand); }
label { color: var(--text-dim); }

.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.filters input, .filters select { flex: 1 1 160px; min-width: 0; }
.filters .year-input { flex: 0 1 130px; }
.filter-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--text-dim); margin-bottom: 1rem; }

/* ── Cards, tags, tiles ───────────────────────────────────────────────── */
.panel, .detail-summary, .profile-card, .item-card, .stat-tile, .doc-card, .year-card, .template-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 1.5rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.85rem; margin-top: 1.75rem; }
.stat-tile { padding: 1rem 1.15rem; }
.stat-tile .n { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; color: var(--brand-strong); }
.stat-tile .l { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; margin-top: 0.15rem; }

.subject-list { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.25rem; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  color: var(--text-dim);
  background: var(--surface-2);
}
.tag.tag-brand { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.tag.tag-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

#catalogueResults, .card-list { display: flex; flex-direction: column; gap: 0.75rem; }
.doc-card { display: block; padding: 1rem 1.15rem; color: var(--text); text-decoration: none; }
a.doc-card:hover, .doc-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); }
.doc-card h2, .doc-card h3 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.doc-card h2 a, .doc-card h3 a { color: var(--text); text-decoration: none; }
.doc-card h2 a:hover, .doc-card h3 a:hover, a.doc-card:hover h3, a.doc-card:hover h4 { color: var(--brand-strong); text-decoration: underline; }
a.doc-card h3, .doc-card h4 { font-size: 0.98rem; font-weight: 700; margin-bottom: 0.35rem; }
.sub-heading { font-size: 1.02rem; font-weight: 800; margin: 1.5rem 0 0.5rem; }
.doc-card p { margin: 0.35rem 0 0; font-size: 0.92rem; color: var(--text-dim); line-height: 1.55; }
.doc-card[role="button"] { cursor: pointer; }
.doc-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.7rem; }

.pager, .ssr-pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.25rem; padding: 0.75rem 0; font-size: 0.9rem; color: var(--muted); }
.ssr-pager { justify-content: center; }
.ssr-pager a { font-weight: 700; padding: 0.4rem 0.8rem; border: 1px solid var(--line-strong); border-radius: 0.5rem; text-decoration: none; }

/* Document / detail pages */
.breadcrumb { font-size: 0.9rem; margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { color: var(--brand-strong); text-decoration: underline; }
.detail-summary { color: var(--text-dim); font-size: 1.02rem; line-height: 1.7; margin-top: 1rem; max-width: 76ch; padding: 1.2rem 1.35rem; }
.source-cta { margin-top: 1.4rem; }
.summary-label { display: block; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.35rem; }
.source-cta em { color: var(--muted); font-style: normal; }
.detail-section { margin-top: 2.5rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.detail-section > h2, .detail-section > h3 { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 0.9rem; }
.scroll-list { display: flex; flex-direction: column; gap: 0.75rem; max-height: 60vh; overflow-y: auto; padding-right: 0.3rem; }
.item-card { padding: 0.9rem 1rem; }
.item-card .item-head { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.item-card p { font-size: 0.92rem; line-height: 1.6; white-space: pre-wrap; color: var(--text-dim); }
.item-card .mark-scheme-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--brand-strong); margin-top: 0.5rem; font-weight: 700; }
.related-docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.65rem; }

/* Provenance — editorial vs official, never mixed up (Council round 4). */
.provenance-note, .notice {
  font-size: 0.92rem;
  color: var(--text-dim);
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 0.6rem 0.6rem 0;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 1.25rem;
  max-width: 80ch;
  line-height: 1.6;
}
.provenance-editorial .provenance-note, .notice.notice-editorial { border-left-color: var(--accent); background: var(--accent-soft); }
.notice.notice-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.precision-note { font-size: 0.88rem; color: var(--muted); margin-bottom: 1rem; }

/* Years */
.stage-group { margin-top: 2.25rem; }
.stage-group > h2, .stage-group > h3 {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); font-weight: 800;
  margin-bottom: 0.9rem; display: flex; align-items: center; gap: 0.6rem;
}
.stage-group > h2::after, .stage-group > h3::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.8rem; }
.year-card { display: block; padding: 1rem 1.1rem; text-decoration: none; color: var(--text); }
.year-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); color: var(--text); }
.year-card .yl { font-size: 1.15rem; font-weight: 800; color: var(--brand-strong); }
.year-card .yt { font-size: 0.88rem; color: var(--text-dim); margin-top: 0.3rem; line-height: 1.45; }
.stage-tag { display: inline-block; font-size: 0.8rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 0.2rem 0.7rem; margin-top: 0.5rem; }
.profile-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1.25rem; }
@media (min-width: 800px) { .profile-grid.split { grid-template-columns: 1fr 1fr; } }
.profile-card { padding: 1.2rem 1.3rem; }
.profile-card h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 0.8rem; }
.profile-card dl { margin: 0; }
.profile-card dt { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 800; color: var(--brand-strong); margin-top: 0.75rem; }
.profile-card dt:first-child { margin-top: 0; }
.profile-card dd { margin: 0.2rem 0 0; font-size: 0.94rem; line-height: 1.6; color: var(--text-dim); }
.curriculum-list { margin: 0; padding-left: 1.2rem; font-size: 0.98rem; line-height: 1.7; color: var(--text-dim); }
.curriculum-list li { margin-bottom: 0.35rem; }

/* Q&A */
#qaMode { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 0.7rem; padding: 0.25rem; gap: 0.25rem; margin-bottom: 1.25rem; }
#qaMode button { background: transparent; border: none; color: var(--text-dim); font-size: 0.88rem; padding: 0.4rem 1rem; min-height: 2.4rem; border-radius: 0.5rem; }
#qaMode button:hover:not(:disabled) { background: var(--surface); color: var(--text); }
#qaMode button.active { background: var(--brand); color: var(--on-brand); }
#qaLog { display: flex; flex-direction: column; gap: 0.85rem; max-height: 55vh; overflow-y: auto; margin-bottom: 1.25rem; padding-right: 0.4rem; }
.msg { border-radius: 0.85rem; padding: 0.85rem 1rem; font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; border: 1px solid var(--line); }
.msg.user { background: var(--brand-soft); border-color: transparent; align-self: flex-end; max-width: 85%; color: var(--text); }
.msg.assistant { background: var(--surface-2); align-self: flex-start; max-width: 95%; color: var(--text-dim); }
.citations { margin-top: 0.75rem; padding-top: 0.65rem; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.citations strong { color: var(--text); }
.citations a { display: inline-flex; margin-top: 0.3rem; margin-right: 0.6rem; }
#qaForm { display: flex; gap: 0.6rem; flex-wrap: wrap; }
#qaInput { flex: 1 1 260px; }
.muted-note { font-size: 0.88rem; color: var(--muted); margin-top: 1rem; line-height: 1.55; border-left: 3px solid var(--line-strong); padding-left: 0.75rem; }

/* Timeline */
.timeline { position: relative; margin-top: 2rem; padding-left: 2rem; border-left: 2px solid var(--line-strong); }
.timeline-entry { position: relative; padding: 0 0 2.25rem 1.1rem; }
.timeline-entry:last-child { padding-bottom: 0; }
.timeline-entry::before {
  content: ''; position: absolute; left: -2.4rem; top: 0.35rem; width: 0.8rem; height: 0.8rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent)); box-shadow: 0 0 0 4px var(--bg);
}
.timeline-date { display: inline-block; font-size: 0.8rem; color: var(--brand-strong); background: var(--brand-soft); border-radius: 999px; padding: 0.15rem 0.65rem; font-weight: 800; margin-bottom: 0.5rem; }
.timeline-entry h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.5rem; }
.timeline-entry ul { margin: 0.7rem 0 0; padding-left: 1.2rem; color: var(--text-dim); font-size: 0.96rem; line-height: 1.65; }
.timeline-entry ul li { margin-bottom: 0.35rem; }
.timeline-entry p.summary { font-size: 0.98rem; line-height: 1.65; color: var(--text-dim); }
.callout { background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 0 0.75rem 0.75rem 0; padding: 1.05rem 1.3rem; margin-top: 2rem; font-size: 0.96rem; line-height: 1.65; color: var(--text-dim); }
.callout strong { color: var(--text); }

/* Modal (catalogue quick view) */
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; max-width: 600px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 1.6rem; box-shadow: 0 24px 48px rgba(15, 23, 42, 0.35); }
.modal-card h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.6rem; }
.modal-card .close-btn { float: right; background: transparent; border: none; color: var(--muted); font-size: 1.4rem; padding: 0.1rem 0.4rem; min-height: 0; line-height: 1; }
.modal-card .close-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.modal-card .modal-summary { color: var(--text-dim); font-size: 0.95rem; line-height: 1.6; margin-top: 0.5rem; }
.modal-card .modal-small { margin-top: 0.75rem; font-size: 0.88rem; }

/* ── Feature tiles (home) ─────────────────────────────────────────────── */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem; margin-top: 1.5rem; }
.feature { display: block; padding: 1.2rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
.feature:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); color: var(--text); }
.feature .feature-icon { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 0.7rem; background: var(--brand-soft); color: var(--brand-strong); margin-bottom: 0.7rem; }
.feature.feature-accent .feature-icon { background: var(--accent-soft); color: var(--accent); }
.feature h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 0.3rem; }
.feature p { font-size: 0.93rem; color: var(--text-dim); line-height: 1.55; }

/* ── Templates ────────────────────────────────────────────────────────── */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.9rem; margin-top: 1.25rem; }
.template-card { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.15rem 1.2rem; color: var(--text); text-decoration: none; }
.template-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); color: var(--text); }
.template-card h2, .template-card h3 { font-size: 1.05rem; font-weight: 800; margin: 0; }
.template-card:hover h2, .template-card:hover h3 { color: var(--brand-strong); text-decoration: underline; }
.template-card p { font-size: 0.93rem; color: var(--text-dim); line-height: 1.55; flex: 1; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.template-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.template-filters button { background: var(--surface); color: var(--text-dim); border: 1px solid var(--line-strong); min-height: 2.4rem; padding: 0.35rem 0.9rem; font-size: 0.88rem; }
.template-filters button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.template-head .doc-meta { margin-top: 0.4rem; }
.template-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0 0.5rem; }
.template-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; margin-top: 1.5rem; }
@media (min-width: 980px) { .template-layout { grid-template-columns: 240px minmax(0, 1fr); } }
.template-toc { position: sticky; top: 5.5rem; align-self: start; font-size: 0.9rem; }
.template-toc ol { margin: 0; padding-left: 1.1rem; line-height: 1.5; }
.template-toc li { margin-bottom: 0.4rem; }
.template-toc a { color: var(--text-dim); text-decoration: none; }
.template-toc a:hover { color: var(--brand-strong); text-decoration: underline; }
@media (max-width: 979px) { .template-toc { position: static; } }
.tpl-section { padding: 1.25rem 0 1.5rem; border-top: 1px solid var(--line); scroll-margin-top: 5.5rem; }
.tpl-section h2 { font-size: 1.3rem !important; font-weight: 800; margin-bottom: 0.35rem !important; }
.tpl-purpose { color: var(--muted); font-size: 0.96rem; margin-bottom: 0.9rem; max-width: 80ch; }
.tpl-block { margin-top: 0.9rem; }
.tpl-block h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; color: var(--muted); margin-bottom: 0.45rem; }
.tpl-must { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.tpl-must li { padding: 0.65rem 0.85rem; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 0 0.6rem 0.6rem 0; background: var(--surface); }
.tpl-must .cite { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 0.25rem; }
.tpl-must blockquote { margin: 0.4rem 0 0; padding-left: 0.7rem; border-left: 2px solid var(--line-strong); color: var(--text-dim); font-size: 0.9rem; font-style: italic; }
.tpl-prompts { margin: 0; padding-left: 1.2rem; color: var(--text-dim); line-height: 1.6; }
.tpl-prompts li { margin-bottom: 0.3rem; }
.tpl-starter {
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: 0.6rem;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
}
.tpl-starter .ph { background: var(--warn-soft); color: var(--warn); border-radius: 0.3rem; padding: 0 0.2rem; font-weight: 600; }
.tpl-checklist { list-style: none; margin: 0; padding: 0; }
.tpl-checklist li { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.tpl-checklist li::before { content: ''; flex: 0 0 1rem; height: 1rem; margin-top: 0.25rem; border: 2px solid var(--line-strong); border-radius: 0.25rem; }
.sources-list { display: flex; flex-direction: column; gap: 0.6rem; }
.source-item { padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--surface); }
.source-item .role { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.source-item p { font-size: 0.9rem; color: var(--text-dim); margin-top: 0.2rem; }
.templates-here { margin-top: 2rem; padding: 1.1rem 1.25rem; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid transparent; }
.templates-here h2.h3-like { font-size: 1.05rem !important; margin: 0 0 0.35rem !important; }
.templates-here h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 0.35rem; }
.templates-here p { font-size: 0.92rem; color: var(--text-dim); margin-bottom: 0.6rem; }
.templates-here ul { margin: 0; padding-left: 1.1rem; }
.templates-here li { margin: 0.25rem 0; }

/* ── Prose pages (about, accessibility, privacy, AI) ──────────────────── */
.prose { max-width: 76ch; }
.prose h1 { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.3rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.prose h2 { font-size: 1.35rem !important; font-weight: 800; margin: 2rem 0 0.6rem !important; }
.prose h3 { font-size: 1.08rem; font-weight: 800; margin: 1.4rem 0 0.4rem; }
.prose p, .prose li { color: var(--text-dim); font-size: 1.02rem; line-height: 1.7; }
.prose p { margin: 0 0 0.9rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.35rem; }
.prose table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1.25rem; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-dim); }
.prose th { color: var(--text); font-weight: 700; background: var(--surface-2); }
.meta-line { font-size: 0.88rem; color: var(--muted); margin-bottom: 1.5rem; }

/* ── Footer ───────────────────────────────────────────────────────────── */
footer.site-footer { margin-top: 3rem; padding: 2.5rem 0 2.75rem; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.88rem; line-height: 1.6; }
.footer-inner { max-width: 1160px; margin: 0 auto; padding: 0 1.25rem; }
.footer-top { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 2rem; margin-bottom: 1.5rem; }
@media (max-width: 760px) { .footer-top { grid-template-columns: 1fr; gap: 1.25rem; } }
.footer-brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; color: var(--text); margin-bottom: 0.6rem; font-size: 0.98rem; }
.footer-brand .brand-mark { width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; }
.footer-ogl, .footer-independent { font-size: 0.86rem; color: var(--muted); margin: 0 0 0.6rem; line-height: 1.55; }
.footer-col h2 { font-size: 0.78rem !important; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); margin: 0 0 0.6rem !important; font-weight: 800; }
.footer-nav { display: flex; flex-direction: column; gap: 0.35rem; }
.footer-nav a { color: var(--text-dim); text-decoration: none; }
.footer-nav a:hover { color: var(--brand-strong); text-decoration: underline; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding-top: 1.1rem; border-top: 1px solid var(--line); font-size: 0.82rem; color: var(--muted); }
.footer-status { display: inline-flex; align-items: center; gap: 0.45rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

/* ── 404 ──────────────────────────────────────────────────────────────── */
.not-found { text-align: center; padding: 4rem 0; }
.not-found .status-code { display: inline-block; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 0.25rem 0.85rem; margin-bottom: 1rem; }
.not-found h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.6rem; }
.not-found p { color: var(--text-dim); margin-bottom: 1.5rem; }
.not-found .cta-row { justify-content: center; }

/* ── Motion & print ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .doc-card, .year-card, .template-card, .feature, .stat-tile, .btn, .cta-row a, .source-cta a, nav.site-nav a {
    transition: box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  }
  a.doc-card:hover, .year-card:hover, .template-card:hover, .feature:hover { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  :root, :root[data-theme="dark"] { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --text-dim: #111; --muted: #333; --line: #bbb; --line-strong: #888; --brand: #000; --brand-strong: #000; --brand-soft: #fff; --accent: #000; --accent-soft: #fff; --warn: #000; --warn-soft: #fff; --ok: #000; --ok-soft: #fff; }
  header.site-header, .skip-link, .theme-toggle, nav.site-nav, .cta-row, .template-actions, .template-toc, .template-filters, .pager, .ssr-pager, #qaForm, #qaMode, footer.site-footer .footer-nav, .no-print { display: none !important; }
  body { font-size: 11pt; background: #fff; }
  main, main.narrow { max-width: none; padding: 0; }
  .panel, .detail-summary, .profile-card, .item-card, .stat-tile, .doc-card, .year-card, .template-card, .source-item, .tpl-must li { box-shadow: none; break-inside: avoid; }
  .template-layout { display: block; }
  .tpl-section { break-inside: avoid-page; }
  a { color: #000; text-decoration: underline; }
  .prose a[href^="http"]::after, .source-item a[href^="/"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  footer.site-footer { margin-top: 1.5rem; border-top: 1px solid #888; background: #fff; }
}

/* Template fact table */
.tpl-facts { width: 100%; max-width: 860px; border-collapse: collapse; margin: 1rem 0 0.5rem; font-size: 0.95rem; }
.tpl-facts th, .tpl-facts td { text-align: left; vertical-align: top; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); }
.tpl-facts th { width: 13rem; color: var(--text); font-weight: 700; }
.tpl-facts td { color: var(--text-dim); }
@media (max-width: 600px) { .tpl-facts th, .tpl-facts td { display: block; width: auto; padding: 0.35rem 0; } .tpl-facts th { border-bottom: none; padding-top: 0.75rem; } }
.cite { font-size: 0.82rem; color: var(--muted); }
.template-card[hidden] { display: none; }
