:root {
  --brand-900: #0f172a;
  --brand-800: #172033;
  --brand-700: #26344a;
  --brand-600: #334155;
  --brand-500: #526072;
  --blue-700: #2563eb;
  --blue-600: #2563eb;
  --blue-100: #e3efff;
  --blue-50: #f4f8ff;
  --school-yellow: #f4c500;
  --school-yellow-soft: #ffe36d;
  --school-yellow-border: #d6ad00;
  --school-charcoal: #384240;
  --canvas: #fbfdff;
  --surface: #ffffff;
  --border: #dce3ec;
  --border-strong: #cbd5e1;
  --year7-bg: #ffedd5;
  --year7-border: #fb923c;
  --year7-text: #9a3412;
  --year8-bg: #d1fae5;
  --year8-border: #34d399;
  --year8-text: #065f46;
  --year9-bg: #f3e8ff;
  --year9-border: #c084fc;
  --year9-text: #6b21a8;
  --gcse-bg: #eff6ff;
  --gcse-border: #bfdbfe;
  --gcse-text: #1e40af;
  --alevel-bg: #eef2ff;
  --alevel-border: #c7d2fe;
  --alevel-text: #3730a3;
  --radius-sm: 0.625rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --max-width: 74rem;
  --stage-bg: var(--year8-bg);
  --stage-border: var(--year8-border);
  --stage-text: var(--year8-text);
  --stage-chip-text: #14532d;
}

body[data-year="7"] { --stage-bg: var(--year7-bg); --stage-border: var(--year7-border); --stage-text: var(--year7-text); --stage-chip-text: #7c2d12; }
body[data-year="8"] { --stage-bg: var(--year8-bg); --stage-border: var(--year8-border); --stage-text: var(--year8-text); --stage-chip-text: #14532d; }
body[data-year="9"] { --stage-bg: var(--year9-bg); --stage-border: var(--year9-border); --stage-text: var(--year9-text); --stage-chip-text: #581c87; }
body[data-stage="gcse"] { --stage-bg: var(--gcse-bg); --stage-border: var(--gcse-border); --stage-text: var(--gcse-text); --stage-chip-text: #1e3a8a; }
body[data-stage="alevel"] { --stage-bg: var(--alevel-bg); --stage-border: var(--alevel-border); --stage-text: var(--alevel-text); --stage-chip-text: #312e81; }

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 2%, rgba(37, 99, 235, 0.08), transparent 22rem),
    radial-gradient(circle at 92% 18%, rgba(168, 85, 247, 0.06), transparent 20rem),
    var(--canvas);
  color: var(--brand-800);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #131923;
  --surface: #1c2532;
  --border: #344357;
  --border-strong: #51627a;
  --brand-800: #f1f5f9;
  --brand-700: #e2e8f0;
  --brand-600: #cbd5e1;
  --brand-500: #aeb9c8;
  --blue-700: #8ab8ff;
  --blue-600: #3b82f6;
  --blue-100: #2b4366;
  --blue-50: #202f45;
  --year7-bg: #3a291f;
  --year7-border: #f97316;
  --year7-text: #fdba74;
  --year8-bg: #16382e;
  --year8-border: #10b981;
  --year8-text: #6ee7b7;
  --year9-bg: #332442;
  --year9-border: #a855f7;
  --year9-text: #d8b4fe;
  --gcse-bg: #1f3150;
  --gcse-border: #3b82f6;
  --gcse-text: #93c5fd;
  --alevel-bg: #292c50;
  --alevel-border: #6366f1;
  --alevel-text: #a5b4fc;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3 { color: #f8fafc; }

html[data-theme="dark"] body { background: var(--canvas); }

body.menu-open { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  transform: translateY(-180%);
  border-radius: var(--radius-sm);
  background: var(--brand-900);
  color: #fff;
  padding: 0.7rem 1rem;
  font-weight: 700;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: fixed;
  right: 0;
  left: 0;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(220, 227, 236, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

#site-header { min-height: 4.25rem; }

.site-header__inner {
  width: min(calc(100% - 2rem), var(--max-width));
  min-height: 4.25rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-brand { display: inline-flex; align-items: center; gap: 0.75rem; font-weight: 800; letter-spacing: -0.02em; }
.site-brand img { width: auto; height: 2rem; }
.site-brand small { display: block; color: var(--brand-500); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; }

.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav a {
  border-radius: 0.55rem;
  color: var(--brand-600);
  padding: 0.58rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 650;
}
.site-nav a:hover { background: var(--blue-50); color: var(--blue-700); }
.site-nav a[aria-current="page"] { background: var(--blue-100); color: var(--blue-700); }
.site-nav .site-nav__tool { margin-left: 0.35rem; background: var(--brand-900); color: #fff; }
.site-nav .site-nav__tool:hover { background: var(--brand-700); color: #fff; }

.site-nav__dropdown { position: relative; }
.site-nav__dropdown-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--brand-600);
  padding: 0.58rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
}
.site-nav__dropdown-button:hover,
.site-nav__dropdown-button[aria-expanded="true"] { background: var(--blue-50); color: var(--blue-700); }
.site-nav__chevron { transition: transform 180ms ease; }
.site-nav__dropdown-button[aria-expanded="true"] .site-nav__chevron { transform: rotate(180deg); }
.tools-panel {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  width: 18rem;
  visibility: hidden;
  transform: translateY(-0.4rem) scale(0.98);
  transform-origin: top right;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 0.55rem;
  opacity: 0;
  box-shadow: var(--shadow);
  transition: opacity 170ms ease, transform 170ms ease, visibility 170ms ease;
}
.tools-panel.is-open { visibility: visible; transform: translateY(0) scale(1); opacity: 1; }
.tools-panel a { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: 0.7rem; align-items: center; padding: 0.65rem 0.7rem; }
.tools-panel__icon { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border-radius: 0.65rem; background: var(--blue-50); color: var(--blue-700); }
.tools-panel__icon::before { width: 1.05rem; height: 1.05rem; background: currentColor; content: ""; -webkit-mask: var(--tool-menu-icon) center / contain no-repeat; mask: var(--tool-menu-icon) center / contain no-repeat; }
.tools-panel__icon--glyph { font-size: 0.88rem; font-weight: 850; letter-spacing: -0.04em; }
.tools-panel__icon--glyph::before { display: none; }
.tools-panel__copy { min-width: 0; }
.tools-panel__copy strong { display: block; color: var(--brand-800); font-size: 0.86rem; }
.tools-panel__copy > span { display: block; margin-top: 0.1rem; color: var(--brand-500); font-size: 0.72rem; font-weight: 500; }

.site-header__actions { display: flex; align-items: center; gap: 0.35rem; }
.header-icon-button {
  position: relative;
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
  color: var(--brand-700);
  cursor: pointer;
}
.header-icon-button:hover,
.header-icon-button[aria-expanded="true"] { border-color: var(--blue-600); color: var(--blue-700); }
.header-icon-button svg { width: 1.15rem; height: 1.15rem; }
.notification-badge {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  display: none;
  min-width: 1.15rem;
  height: 1.15rem;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  padding-inline: 0.18rem;
  font-size: 0.58rem;
  font-weight: 800;
}
.notification-badge.is-visible { display: grid; }
.updates-popover {
  position: fixed;
  top: 4.8rem;
  right: max(1rem, calc((100vw - var(--max-width)) / 2));
  z-index: 60;
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100vh - 6rem));
  visibility: hidden;
  overflow-y: auto;
  transform: translateY(-0.5rem) scale(0.98);
  transform-origin: top right;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 0.75rem;
  opacity: 0;
  box-shadow: var(--shadow);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}
.updates-popover.is-open { visibility: visible; transform: translateY(0) scale(1); opacity: 1; }
.updates-popover__heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.35rem 0.35rem 0.7rem; }
.updates-popover__heading strong { color: var(--brand-800); }
.updates-list { display: grid; gap: 0.6rem; }
.update-item { border: 1px solid var(--border); border-radius: 0.75rem; background: var(--canvas); padding: 0.9rem; }
.update-item time { color: var(--brand-500); font-size: 0.68rem; font-weight: 650; }
.update-item h3 { margin: 0.2rem 0 0.3rem; font-size: 0.92rem; letter-spacing: -0.015em; }
.update-item p { margin-bottom: 0.55rem; color: var(--brand-500); font-size: 0.78rem; }
.update-item a { color: var(--blue-700); font-size: 0.76rem; font-weight: 750; }
.updates-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.updates-grid .update-item { --update-accent: #2563eb; border-top: 0.25rem solid var(--update-accent); padding: 1.2rem; }
.updates-grid .update-item:nth-child(2) { --update-accent: #10b981; }
.updates-grid .update-item:nth-child(3) { --update-accent: #a855f7; }
.updates-grid .update-item h3 { font-size: 1.08rem; }
.updates-grid .update-item p { font-size: 0.88rem; }

.menu-button {
  display: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--brand-800);
  padding: 0.6rem 0.75rem;
  font-weight: 750;
}

.page { min-height: 65vh; }
.page [id] { scroll-margin-top: 5.5rem; }
.container { width: min(calc(100% - 2rem), var(--max-width)); margin-inline: auto; }
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section--tight { padding-block: clamp(2rem, 5vw, 3.75rem); }
.section--flush-top { padding-top: 0; }
.section + .section { border-top: 1px solid var(--border); }
.deferred-section { content-visibility: auto; contain-intrinsic-size: auto 700px; }
.section--routes { background: linear-gradient(110deg, rgba(255, 237, 213, 0.55), rgba(209, 250, 229, 0.5) 50%, rgba(243, 232, 255, 0.55)); }
.section--updates { background: rgba(255, 255, 255, 0.72); }
.section--tools { position: relative; overflow: hidden; background: linear-gradient(180deg, #fff, #f8fbff); }
.section--tools::before { position: absolute; top: 2.5rem; left: max(1rem, calc((100vw - var(--max-width)) / 2 - 4rem)); width: 6.5rem; height: 6.5rem; transform: rotate(-8deg); border: 1px solid #fde68a; border-radius: 0.65rem; background: #fef3c7; opacity: 0.6; box-shadow: 0 10px 25px rgba(146, 64, 14, 0.08); content: ""; }
.section--tools::after { position: absolute; right: max(1.5rem, calc((100vw - var(--max-width)) / 2 - 2.5rem)); bottom: 1.5rem; color: rgba(37, 99, 235, 0.1); font-size: 7rem; font-weight: 800; content: "√x"; }
.section--tools > .container { position: relative; z-index: 1; }
body[data-section="home"] .section--routes,
body[data-section="home"] .section--tools { background: transparent; }
body[data-section="home"] .section--tools::before,
body[data-section="home"] .section--tools::after { display: none; }
body[data-section="home"] .section + .section { border-top: 0; }
body[data-section="home"] .section--routes { padding-bottom: 0.75rem; }
body[data-section="home"] .section--routes ~ .section { padding-block: 0.75rem; }
body[data-section="home"] .section--routes ~ .section:last-child { padding-bottom: clamp(3rem, 7vw, 5.5rem); }
.home-section-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.35rem, 4vw, 2.3rem);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.home-section-panel--routes {
  background:
    radial-gradient(circle at 91% 12%, rgba(245, 158, 11, 0.17), transparent 18rem),
    linear-gradient(180deg, #fffaf0 0%, #fff 100%);
}
.home-section-panel--tools {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 12%, rgba(59, 130, 246, 0.12), transparent 17rem),
    linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}
.home-section-panel--tools::before {
  position: absolute;
  top: 1.25rem;
  right: 2rem;
  width: 6.5rem;
  height: 6.5rem;
  transform: rotate(7deg);
  border: 1px solid #fde68a;
  border-radius: 0.55rem;
  background: #fef3c7;
  opacity: 0.58;
  box-shadow: 0 10px 25px rgba(146, 64, 14, 0.08);
  content: "";
}
.home-section-panel--tools > * { position: relative; z-index: 1; }
.section--years { background: linear-gradient(110deg, rgba(255, 237, 213, 0.42), rgba(209, 250, 229, 0.42) 50%, rgba(243, 232, 255, 0.44)); }
.section--year8-units { background: linear-gradient(180deg, rgba(209, 250, 229, 0.62), rgba(248, 250, 252, 0.92) 22rem); }
.section--stage-units { background: linear-gradient(180deg, var(--stage-bg), var(--canvas) 22rem); }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; color: var(--brand-500); font-size: 0.83rem; font-weight: 600; }
.breadcrumbs a:hover { color: var(--blue-700); text-decoration: underline; }
.breadcrumbs span[aria-hidden="true"] { color: #94a3b8; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0 0 0.9rem;
  color: var(--blue-700);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--brand-900); letter-spacing: -0.02em; }
h1, h2 { text-wrap: balance; }
h1 { max-width: 15ch; margin-bottom: 1rem; font-size: clamp(2.5rem, 7vw, 5.3rem); line-height: 1.08; }
h2 { margin-bottom: 0.75rem; font-size: clamp(1.75rem, 4vw, 2.6rem); line-height: 1.14; }
h3 { margin-bottom: 0.45rem; font-size: 1.1rem; line-height: 1.3; }
.lead { max-width: 43rem; color: var(--brand-500); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.72; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.6rem; }
.section-heading p { max-width: 34rem; margin-bottom: 0; color: var(--brand-500); }

.button-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.6rem; }
.button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.68rem 1rem;
  font-size: 0.9rem;
  font-weight: 750;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button--primary { background: var(--blue-600); color: #fff; }
.button--primary:hover { background: var(--blue-700); }
.button--dark { border-color: var(--brand-900); background: var(--brand-900); color: #fff; }
.button--dark:hover { background: var(--brand-700); }
.button--secondary { border-color: var(--border-strong); background: #fff; color: var(--brand-800); }
.button--secondary:hover { border-color: var(--blue-600); background: var(--blue-50); color: var(--blue-700); }

.home-welcome {
  display: grid;
  min-height: calc(100vh - 4.25rem);
  min-height: calc(100svh - 4.25rem);
  align-items: center;
  padding-block: clamp(2.5rem, 7vw, 5rem);
  border-bottom: 1px solid #e3efff;
  background: linear-gradient(180deg, #fff, #f7fbff);
}
.home-welcome__layout {
  position: relative;
  display: grid;
  align-items: center;
  gap: clamp(2rem, 8vw, 7rem);
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.6fr);
}
.home-welcome__copy { position: relative; z-index: 1; }
.home-welcome h1 { max-width: 13ch; font-size: clamp(2.6rem, 5.4vw, 4.6rem); }
.home-welcome .lead { max-width: 30rem; }
.school-mark {
  position: relative;
  display: grid;
  min-height: 19rem;
  place-items: center;
}
.school-mark img { position: relative; z-index: 1; width: 9.5rem; height: auto; filter: drop-shadow(0 14px 22px rgba(37, 99, 235, 0.14)); }
.math-symbol { position: absolute; z-index: 2; display: grid; place-items: center; color: var(--blue-700); font-size: 1.35rem; font-weight: 800; animation: symbol-float 4.8s ease-in-out infinite; }
.math-symbol--one { top: 1rem; left: 12%; color: #7c3aed; }
.math-symbol--two { top: 12%; right: 8%; color: #2563eb; animation-delay: -1.2s; }
.math-symbol--three { right: 10%; bottom: 11%; color: #059669; animation-delay: -2.4s; }
.math-symbol--four { bottom: 0.8rem; left: 15%; color: #ea580c; animation-delay: -3.6s; }
@keyframes symbol-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.35rem); } }

.summer-notice {
  width: min(31rem, calc(100% - 2rem));
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 10% 5%, rgba(250, 204, 21, 0.22), transparent 13rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(239, 246, 255, 0.7));
  color: var(--brand-800);
  padding: clamp(1.5rem, 5vw, 2.25rem);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  backdrop-filter: blur(24px) saturate(145%);
  cursor: pointer;
}
.summer-notice[open] { animation: summer-notice-in 220ms ease-out both; }
.summer-notice::backdrop {
  background: radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.2), transparent 30rem), rgba(15, 23, 42, 0.46);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.summer-notice__icon { display: grid; width: 3.2rem; height: 3.2rem; margin-bottom: 1.25rem; place-items: center; border: 1px solid #fde68a; border-radius: 1rem; background: #fef3c7; color: #b45309; font-size: 1.55rem; }
.summer-notice h2 { max-width: 13ch; margin-bottom: 0.75rem; font-size: clamp(1.75rem, 5vw, 2.35rem); }
.summer-notice > p:not(.eyebrow) { max-width: 38ch; margin-bottom: 1.4rem; color: var(--brand-500); }
@keyframes summer-notice-in { from { transform: translateY(0.75rem) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.intro-panel {
  padding-block: clamp(0.85rem, 2vw, 1.3rem);
  border-bottom: 1px solid var(--school-yellow-border);
  background: linear-gradient(105deg, var(--school-yellow), var(--school-yellow-soft));
}
.intro-panel--year8,
.intro-panel--year { border-bottom-color: var(--school-yellow-border); background: linear-gradient(105deg, var(--school-yellow), var(--school-yellow-soft)); }
.intro-panel__grid { display: grid; align-items: center; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) auto; }
.intro-panel .breadcrumbs { margin-bottom: 0.4rem; color: rgba(56, 66, 64, 0.78); }
.intro-panel .breadcrumbs a:hover { color: var(--school-charcoal); }
.intro-panel .eyebrow { margin-bottom: 0.2rem; color: var(--school-charcoal); }
.intro-panel .text-stage,
.textbook-hero .text-stage { color: var(--school-charcoal) !important; }
.intro-panel h1 { max-width: 24ch; margin-bottom: 0.25rem; color: var(--school-charcoal); font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
.intro-panel .lead { max-width: 50rem; margin-bottom: 0; color: rgba(56, 66, 64, 0.88); font-size: clamp(0.88rem, 1.4vw, 0.98rem); line-height: 1.45; }
.intro-panel .button--secondary { border-color: rgba(56, 66, 64, 0.42); background: rgba(255,255,255,0.78); color: var(--school-charcoal); }
.intro-panel .button--secondary:hover { border-color: var(--school-charcoal); background: #fff; color: var(--school-charcoal); }
.hero-quick-links { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
.hero-quick-links a { border: 1px solid rgba(56,66,64,0.3); border-radius: 0.55rem; background: rgba(255,255,255,0.66); color: var(--school-charcoal); padding: 0.3rem 0.58rem; font-size: 0.72rem; font-weight: 750; transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease; }
.hero-quick-links a:hover,
.hero-quick-links a.is-active { transform: translateY(-1px); border-color: var(--school-charcoal); background: #fff; }

.card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  position: relative;
  display: flex;
  min-height: 12rem;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 1.35rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card p { color: var(--brand-500); }
.card__meta { margin-bottom: 0.65rem; color: var(--brand-500); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.card__action { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: auto; color: var(--blue-700); font-size: 0.88rem; font-weight: 800; }
.card__action::after { content: "→"; }

.stage-card { min-height: 17rem; border-width: 1px; }
.stage-card__number { margin-bottom: 1.4rem; font-size: 2.8rem; font-weight: 850; letter-spacing: -0.06em; line-height: 1; }
.stage-card--ks3 { overflow: hidden; }
.stage-card--ks3::before { position: absolute; inset: 0 0 auto; height: 0.35rem; background: linear-gradient(90deg, var(--year7-border) 0 33.333%, var(--year8-border) 33.333% 66.666%, var(--year9-border) 66.666%); content: ""; }
.stage-card--ks3 .stage-card__number, .stage-card--ks3 .card__action { color: var(--blue-700); }
.stage-card--year7 { border-color: var(--year7-border); background: var(--year7-bg); }
.stage-card--year7 .stage-card__number, .stage-card--year7 .card__action { color: var(--year7-text); }
.stage-card--year8 { border-color: var(--year8-border); background: var(--year8-bg); }
.stage-card--year8 .stage-card__number, .stage-card--year8 .card__action { color: var(--year8-text); }
.stage-card--year9 { border-color: var(--year9-border); background: var(--year9-bg); }
.stage-card--year9 .stage-card__number, .stage-card--year9 .card__action { color: var(--year9-text); }
.stage-card--gcse { border-color: var(--gcse-border); background: var(--gcse-bg); }
.stage-card--gcse .stage-card__number, .stage-card--gcse .card__action { color: var(--gcse-text); }
.stage-card--alevel { border-color: var(--alevel-border); background: var(--alevel-bg); }
.stage-card--alevel .stage-card__number, .stage-card--alevel .card__action { color: var(--alevel-text); }

.tool-grid { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tool-card { --tool-accent: #2563eb; --tool-soft: #eff6ff; min-height: 10rem; overflow: hidden; }
.tool-card::before { position: absolute; inset: 0 0 auto; height: 0.25rem; background: var(--tool-accent); content: ""; }
.tool-card:nth-child(1) { --tool-accent: #7c3aed; --tool-soft: #f3e8ff; }
.tool-card:nth-child(2) { --tool-accent: #2563eb; --tool-soft: #dbeafe; }
.tool-card:nth-child(3) { --tool-accent: #ea580c; --tool-soft: #ffedd5; }
.tool-card:nth-child(4) { --tool-accent: #059669; --tool-soft: #d1fae5; }
.tool-card__icon { display: grid; width: 2.6rem; height: 2.6rem; place-items: center; margin-bottom: 1rem; border-radius: 0.75rem; background: var(--tool-soft); color: var(--tool-accent); font-weight: 850; }
.tool-card .card__action { color: var(--tool-accent); }

.tool-list { display: grid; gap: 0.8rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-list--single { grid-template-columns: 1fr; }
.tool-link {
  --tool-accent: #2563eb;
  --tool-soft: #eff6ff;
  display: grid;
  min-height: 5.4rem;
  align-items: center;
  gap: 0.9rem;
  grid-template-columns: 2.8rem minmax(0, 1fr) auto;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.85rem 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.tool-link:hover { transform: translateX(2px); border-color: var(--tool-accent); box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07); }
.tool-link--purple { --tool-accent: #7c3aed; --tool-soft: #f3e8ff; }
.tool-link--blue { --tool-accent: #2563eb; --tool-soft: #e3efff; }
.tool-link--orange { --tool-accent: #ea580c; --tool-soft: #ffedd5; }
.tool-link--green { --tool-accent: #059669; --tool-soft: #d1fae5; }
.tool-link__icon { display: grid; width: 2.8rem; height: 2.8rem; place-items: center; border-radius: 0.75rem; background: var(--tool-soft); color: var(--tool-accent); }
.tool-link__icon::before { width: 1.35rem; height: 1.35rem; background: currentColor; content: ""; -webkit-mask: var(--tool-icon) center / contain no-repeat; mask: var(--tool-icon) center / contain no-repeat; }
.tool-link strong { display: block; color: var(--brand-800); font-size: 0.93rem; }
.tool-link small { display: block; margin-top: 0.15rem; color: var(--brand-500); font-size: 0.75rem; }
.tool-link b { color: var(--tool-accent); font-size: 1.1rem; }

.unit-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.unit-card {
  display: grid;
  min-height: 0;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.unit-card:hover { transform: translateY(-2px); border-color: var(--stage-text); box-shadow: var(--shadow); }
.unit-card__number { display: grid; width: 2.75rem; height: 2.75rem; place-items: center; border-radius: 0.75rem; background: var(--stage-bg); color: var(--stage-text); font-weight: 850; }
.unit-card__content { display: flex; min-width: 0; flex-direction: column; }
.unit-card__category { margin-bottom: 0.35rem; color: var(--stage-text); font-size: 0.73rem; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; }
.unit-card h3 { font-size: 1.18rem; }
.unit-card ul { display: flex; flex-wrap: wrap; gap: 0.2rem 0.7rem; margin: 0.4rem 0 0.65rem; padding: 0; color: var(--brand-500); font-size: 0.78rem; list-style: none; }
.unit-card li:not(:last-child)::after { margin-left: 0.7rem; color: var(--stage-border); content: "•"; }
.unit-card__action { margin-top: 0; color: var(--stage-text); font-size: 0.82rem; font-weight: 800; }
.unit-card__summary { margin: 0.35rem 0 0.65rem; color: var(--brand-500); font-size: 0.78rem; }

.gcse-groups { display: grid; gap: 0.8rem; }
.gcse-group { overflow: hidden; border: 1px solid var(--stage-border); border-radius: var(--radius-md); background: #fff; }
.gcse-group > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.9rem; align-items: center; padding: 1rem 1.1rem; color: var(--brand-800); cursor: pointer; list-style: none; }
.gcse-group > summary::-webkit-details-marker { display: none; }
.gcse-group > summary:hover { background: var(--stage-bg); }
.gcse-group > summary strong { display: block; font-size: 1rem; }
.gcse-group > summary small { display: block; margin-top: 0.18rem; color: var(--brand-500); font-size: 0.76rem; font-weight: 500; }
.gcse-group__count { border: 1px solid var(--stage-border); border-radius: 999px; background: var(--stage-bg); color: var(--stage-text); padding: 0.3rem 0.55rem; font-size: 0.72rem; white-space: nowrap; }
.gcse-group > summary::after { width: 1.25rem; color: var(--stage-text); font-size: 1.3rem; font-weight: 500; text-align: center; content: "+"; }
.gcse-group[open] > summary::after { content: "−"; }
.gcse-unit-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; border-top: 1px solid var(--stage-border); padding: 0.8rem; }
.gcse-unit-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 0.72rem; transition: border-color 160ms ease, transform 160ms ease; }
.gcse-unit-link:hover { transform: translateX(2px); border-color: var(--stage-text); }
.gcse-unit-link__number { display: grid; width: 2.35rem; height: 2.35rem; place-items: center; border-radius: 0.65rem; background: var(--stage-bg); color: var(--stage-text); font-size: 0.78rem; font-weight: 850; }
.gcse-unit-link strong { display: block; color: var(--brand-800); font-size: 0.88rem; }
.gcse-unit-link__topics { display: block; overflow: hidden; margin-top: 0.12rem; color: var(--brand-500); font-size: 0.7rem; text-overflow: ellipsis; white-space: nowrap; }
.gcse-unit-link > b { color: var(--stage-text); }

.stage-band { border: 1px solid var(--school-yellow-border); border-radius: var(--radius-md); background: linear-gradient(105deg, var(--school-yellow), var(--school-yellow-soft)); padding: clamp(0.95rem, 2.4vw, 1.4rem); }
.stage-band h1 { max-width: 28ch; margin-bottom: 0.35rem; color: var(--school-charcoal); font-size: clamp(1.7rem, 3.4vw, 2.55rem); }
.stage-band .lead { max-width: 54rem; margin-bottom: 0; color: rgba(56,66,64,0.88); font-size: 0.98rem; line-height: 1.55; }
.stage-band .eyebrow { margin-bottom: 0.4rem; color: var(--school-charcoal); }
.topic-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.85rem; }
.topic-chip { border: 1px solid rgba(56,66,64,0.28); border-radius: 0.55rem; background: rgba(255,255,255,0.65); color: var(--school-charcoal); padding: 0.34rem 0.6rem; font-size: 0.74rem; font-weight: 650; }

.anchor-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.anchor-nav a { border: 1px solid rgba(56,66,64,0.35); border-radius: var(--radius-sm); background: rgba(255,255,255,0.78); color: var(--school-charcoal); padding: 0.45rem 0.65rem; font-size: 0.78rem; font-weight: 750; }
.anchor-nav a:hover { border-color: var(--school-charcoal); background: #fff; }

.resource-layout { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 0.65fr); }
.resource-stack { display: grid; gap: 2.5rem; }
.resource-group { scroll-margin-top: 6rem; }
.resource-group__heading { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.resource-group__heading::after { height: 1px; flex: 1; background: var(--border); content: ""; }
.resource-group__heading h2 { margin: 0; font-size: 1.45rem; }
.resource-grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.resource-grid--single { grid-template-columns: 1fr; }
.resource-card {
  display: flex;
  min-height: 7.5rem;
  align-items: flex-start;
  gap: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.resource-card:hover { transform: translateY(-2px); border-color: var(--stage-border); box-shadow: var(--shadow); }
.resource-card__icon { display: grid; width: 2.65rem; height: 2.65rem; flex: 0 0 auto; place-items: center; border-radius: 0.75rem; background: var(--stage-bg); color: var(--stage-text); font-size: 0.7rem; font-weight: 850; letter-spacing: 0.04em; }
.resource-card__copy { display: flex; min-width: 0; flex: 1; flex-direction: column; align-self: stretch; }
.resource-card__copy h3 { margin-bottom: 0.45rem; font-size: 0.98rem; letter-spacing: -0.015em; }
.resource-card__copy span { margin-top: auto; color: var(--stage-text); font-size: 0.8rem; font-weight: 750; }
.resource-card__thumbnail { width: 5.4rem; height: 3.2rem; flex: 0 0 auto; border-radius: 0.55rem; object-fit: cover; }

.sparx-panel { display: none; scroll-margin-top: 6rem; border: 1px solid #ddd6fe; border-radius: var(--radius-lg); background: #faf5ff; padding: 1.35rem; }
.sparx-panel.is-visible { display: block; }
.sparx-panel__top { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.sparx-panel h2 { font-size: 1.4rem; }
.sparx-codes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.sparx-code { border: 1px solid #ddd6fe; border-radius: 0.55rem; background: #fff; padding: 0.48rem 0.65rem; color: #4c1d95; font-size: 0.78rem; }
.sparx-code strong { margin-right: 0.35rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.notice { border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; padding: 1rem 1.1rem; color: var(--brand-500); }
.notice strong { color: var(--brand-800); }

.docs-layout { display: grid; align-items: start; gap: clamp(2rem, 6vw, 4.5rem); grid-template-columns: 14rem minmax(0, 1fr); }
.section-nav { position: sticky; top: 6rem; display: grid; gap: 0.35rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: 0.65rem; }
.section-nav strong { padding: 0.55rem 0.7rem 0.35rem; color: var(--brand-800); font-size: 0.82rem; }
.section-nav a { border-radius: 0.6rem; color: var(--brand-500); padding: 0.62rem 0.7rem; font-size: 0.82rem; font-weight: 700; }
.section-nav a:hover, .section-nav a.is-active { background: var(--blue-50); color: var(--blue-700); }
.article-stack { display: grid; gap: 1rem; }
.content-section { scroll-margin-top: 6rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: clamp(1.35rem, 4vw, 2.5rem); }
.content-section > :last-child { margin-bottom: 0; }
.content-section p, .content-card p { color: var(--brand-500); }
.content-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 1.5rem; }
.content-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.content-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--canvas); padding: 1.15rem; }
.content-card h3 { margin-bottom: 0.55rem; }
.content-card > :last-child { margin-bottom: 0; }
.guidance-list { display: grid; gap: 0.65rem; margin: 1rem 0 0; padding: 0; color: var(--brand-600); list-style: none; }
.guidance-list li { position: relative; padding-left: 1.3rem; }
.guidance-list li::before { position: absolute; left: 0; color: #059669; font-weight: 900; content: "✓"; }
.guidance-list--avoid li::before { color: #dc2626; content: "×"; }
.callout { margin-top: 1.5rem; border-left: 0.3rem solid var(--blue-600); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--blue-50); padding: 1rem 1.1rem; }
.callout--warning { border-left-color: #f59e0b; background: #fffbeb; }
.video-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.4rem; }
.video-frame { overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--brand-900); }
.video-frame iframe { width: 100%; height: 100%; border: 0; }

.workspace-layout { display: grid; align-items: start; gap: 2rem; grid-template-columns: minmax(13rem, 0.35fr) minmax(0, 1fr); }
.workspace-sidebar { position: sticky; top: 6rem; display: grid; gap: 1rem; }
.selector-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 1rem; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035); }
.selector-card h2, .selector-card h3 { margin-bottom: 0.8rem; }
.year-choices { display: grid; gap: 0.55rem; }
.year-choice {
  --choice-bg: var(--blue-50);
  --choice-border: var(--blue-100);
  --choice-text: var(--blue-700);
  display: flex;
  min-height: 4.2rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--choice-border);
  border-radius: 0.8rem;
  background: var(--choice-bg);
  color: var(--brand-800);
  padding: 0.8rem 0.9rem;
  text-align: left;
  cursor: pointer;
}
.year-choice strong { display: block; }
.year-choice small { display: block; margin-top: 0.1rem; color: var(--brand-500); }
.year-choice b { color: var(--choice-text); }
.year-choice:hover, .year-choice[aria-pressed="true"] { border-color: var(--choice-text); box-shadow: 0 0 0 2px var(--choice-bg); }
.year-choice--7 { --choice-bg: var(--year7-bg); --choice-border: var(--year7-border); --choice-text: var(--year7-text); }
.year-choice--8 { --choice-bg: var(--year8-bg); --choice-border: var(--year8-border); --choice-text: var(--year8-text); }
.year-choice--9 { --choice-bg: var(--year9-bg); --choice-border: var(--year9-border); --choice-text: var(--year9-text); }
.unit-option-grid { display: grid; gap: 0.7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.25rem; }
.unit-option { display: grid; min-height: 5rem; align-items: center; gap: 0.75rem; grid-template-columns: 2.4rem minmax(0, 1fr); border: 1px solid var(--border); border-radius: 0.8rem; background: var(--canvas); padding: 0.75rem; color: var(--brand-500); text-align: left; }
.unit-option[href] { cursor: pointer; transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
.unit-option[href]:hover { border-color: var(--stage-border); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08); transform: translateY(-2px); }
.unit-option[href]:focus-visible { outline: 3px solid var(--stage-border); outline-offset: 3px; }
.unit-option:disabled { cursor: not-allowed; opacity: 0.76; }
.unit-option__number { display: grid; width: 2.4rem; height: 2.4rem; place-items: center; border-radius: 0.65rem; background: var(--stage-bg); color: var(--stage-text); font-size: 0.75rem; font-weight: 850; }
.unit-option strong { display: block; color: var(--brand-800); font-size: 0.82rem; }
.unit-option small { display: block; margin-top: 0.18rem; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.status-line { display: flex; align-items: flex-start; gap: 0.65rem; margin-top: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--blue-50); padding: 0.8rem 0.9rem; color: var(--brand-600); font-size: 0.82rem; }
.status-line strong { color: var(--brand-800); }
.status-line p { margin: 0; }
.resource-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.textbook-hero { border-bottom: 1px solid var(--school-yellow-border); background: linear-gradient(105deg, var(--school-yellow), var(--school-yellow-soft)); padding-block: clamp(1.15rem, 2.5vw, 1.8rem); }
.textbook-hero__layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: center; }
.textbook-hero .breadcrumbs { margin-bottom: 0.65rem; color: rgba(56, 66, 64, 0.78); }
.textbook-hero .eyebrow { margin-bottom: 0.35rem; color: var(--school-charcoal); }
.textbook-hero h1 { max-width: 18ch; margin-bottom: 0.35rem; color: var(--school-charcoal); font-size: clamp(1.9rem, 4vw, 2.8rem); }
.textbook-hero .lead { max-width: 37rem; margin-bottom: 0; color: rgba(56, 66, 64, 0.88); font-size: 1rem; }
.textbook-guide { display: flex; align-items: center; gap: 0.4rem; }
.textbook-guide__note { position: relative; max-width: 10.5rem; border: 1px solid #a7f3d0; border-radius: 1rem 1rem 0.25rem 1rem; background: rgba(255,255,255,0.9); color: #065f46; padding: 0.7rem 0.8rem; font-size: 0.76rem; font-weight: 700; box-shadow: var(--shadow); }
.textbook-guide img { width: clamp(6rem, 11vw, 8.5rem); height: auto; filter: drop-shadow(0 10px 15px rgba(15, 23, 42, 0.12)); }
.section--textbooks { background: linear-gradient(180deg, rgba(236,253,245,0.72), var(--canvas) 18rem); padding-block: clamp(2rem, 5vw, 3.5rem); }
.textbook-workspace { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: clamp(1rem, 3vw, 1.5rem); box-shadow: var(--shadow); }
.textbook-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: end; }
.textbook-toolbar h2 { margin-bottom: 0.3rem; font-size: clamp(1.5rem, 3vw, 2rem); }
.textbook-toolbar p { margin-bottom: 0; color: var(--brand-500); }
.textbook-year-tabs { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.textbook-year-tab { --choice-bg: var(--blue-50); --choice-border: var(--blue-100); --choice-text: var(--blue-700); min-width: 5.5rem; border: 1px solid var(--choice-border); border-radius: 999px; background: var(--surface); color: var(--choice-text); padding: 0.58rem 0.8rem; font-weight: 800; cursor: pointer; transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease; }
.textbook-year-tab:hover { transform: translateY(-1px); border-color: var(--choice-text); }
.textbook-year-tab[aria-pressed="true"] { border-color: var(--choice-text); background: var(--choice-bg); box-shadow: 0 0 0 2px var(--choice-bg); }
.textbook-year-tab--7 { --choice-bg: var(--year7-bg); --choice-border: var(--year7-border); --choice-text: var(--year7-text); }
.textbook-year-tab--8 { --choice-bg: var(--year8-bg); --choice-border: var(--year8-border); --choice-text: var(--year8-text); }
.textbook-year-tab--9 { --choice-bg: var(--year9-bg); --choice-border: var(--year9-border); --choice-text: var(--year9-text); }
.textbook-access { display: flex; align-items: center; gap: 0.55rem; margin: 1rem 0; border: 1px solid var(--blue-100); border-radius: 0.75rem; background: var(--blue-50); color: var(--brand-600); padding: 0.65rem 0.8rem; font-size: 0.78rem; }
.textbook-access span { color: var(--blue-700); }
.textbook-access p { margin: 0; }
.textbook-unit-panel { border-top: 1px solid var(--border); padding-top: 1rem; }
.textbook-unit-panel__heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.textbook-unit-panel__heading h2 { margin: 0; font-size: 1.25rem; }
.textbook-unit-panel__heading span { border-radius: 999px; background: var(--stage-bg); color: var(--stage-text); padding: 0.32rem 0.58rem; font-size: 0.7rem; font-weight: 800; }
.textbook-workspace .unit-option-grid { gap: 0.5rem; margin-top: 0.8rem; }
.textbook-workspace .unit-option { min-height: 3.65rem; border-radius: 0.7rem; background: var(--canvas); padding: 0.55rem 0.65rem; animation: textbook-unit-in 220ms ease-out both; animation-delay: var(--unit-delay, 0ms); }
.textbook-workspace .unit-option__number { width: 2.1rem; height: 2.1rem; }
.textbook-workspace .unit-option small { margin-top: 0.08rem; font-size: 0.62rem; }
@keyframes textbook-unit-in { from { transform: translateY(0.35rem); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .textbook-workspace .unit-option { animation: none; }
}

.feature-panel {
  display: grid;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.72fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--brand-900);
  color: #fff;
}
.feature-panel__copy { padding: clamp(1.5rem, 5vw, 3rem); }
.feature-panel h2 { color: #fff; }
.feature-panel p { color: #cbd5e1; }
.feature-panel:not(.feature-panel--year8) .button--secondary { border-color: #fff; background: #fff; color: #0f172a; }
.feature-panel:not(.feature-panel--year8) .button--secondary:hover { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.feature-panel__image { min-height: 17rem; background: #fff7ed; }
.feature-panel__image img { width: 100%; height: 100%; object-fit: contain; padding: 2rem; }
.feature-panel--year8 { border-color: var(--year8-border); background: var(--year8-bg); color: var(--brand-800); }
.feature-panel--year8 h2, .feature-panel--year8 h3 { color: var(--brand-900); }
.feature-panel--year8 p { color: var(--brand-500); }
.feature-panel__split { border-left: 1px solid var(--year8-border); }
.text-year8 { color: var(--year8-text) !important; }
.feature-panel--year { border-color: var(--stage-border); background: var(--stage-bg); color: var(--brand-800); }
.feature-panel--year h2, .feature-panel--year h3 { color: var(--brand-900); }
.feature-panel--year p { color: var(--brand-500); }
.feature-panel--year .feature-panel__split { border-color: var(--stage-border); }
.text-stage { color: var(--stage-text) !important; }

.site-footer { border-top: 1px solid var(--border); background: #fff; }
.site-footer__inner { width: min(calc(100% - 2rem), var(--max-width)); margin-inline: auto; padding-block: 2rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.site-footer__brand { display: flex; align-items: center; gap: 0.75rem; }
.site-footer__brand img { width: auto; height: 2.3rem; }
.site-footer p { margin: 0; color: var(--brand-500); font-size: 0.78rem; }
.site-footer__meta { display: grid; gap: 0.2rem; text-align: right; }
.site-footer__privacy { color: var(--brand-700) !important; font-weight: 750; }

html[data-theme="dark"] .site-header { border-bottom-color: var(--border); background: rgba(28, 37, 50, 0.96); }
html[data-theme="dark"] .site-nav { background: var(--surface); }
html[data-theme="dark"] .site-nav .site-nav__tool { background: #2563eb; }
html[data-theme="dark"] .site-nav .site-nav__tool:hover { background: #3b82f6; }
html[data-theme="dark"] .section--routes,
html[data-theme="dark"] .section--years { background: var(--canvas); }
html[data-theme="dark"] .section--updates { background: var(--canvas); }
html[data-theme="dark"] .section--tools { background: var(--canvas); }
html[data-theme="dark"] .section--tools::before { border-color: #8d7512; background: #5a4a0d; opacity: 0.5; }
html[data-theme="dark"] body[data-section="home"] .section--routes,
html[data-theme="dark"] body[data-section="home"] .section--tools { background: transparent; }
html[data-theme="dark"] .section--year8-units,
html[data-theme="dark"] .section--stage-units { background: var(--canvas); }
html[data-theme="dark"] .home-welcome { border-bottom-color: var(--border); background: var(--canvas); }
html[data-theme="dark"] .summer-notice__icon { border-color: #854d0e; background: #422006; color: #fcd34d; }
html[data-theme="dark"] .summer-notice {
  border-color: rgba(148, 163, 184, 0.28);
  background:
    radial-gradient(circle at 10% 5%, rgba(245, 158, 11, 0.14), transparent 13rem),
    linear-gradient(135deg, rgba(17, 24, 39, 0.86), rgba(30, 41, 59, 0.72));
  color: #e5eefb;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .home-section-panel--routes,
html[data-theme="dark"] .home-section-panel--tools { background: var(--surface); }
html[data-theme="dark"] .home-section-panel--tools::before {
  border-color: #8d7512;
  background: #5a4a0d;
  opacity: 0.58;
}
html[data-theme="dark"] .tool-link { border-color: var(--border); background: var(--canvas); }
html[data-theme="dark"] .tool-link:hover { border-color: var(--tool-accent); }
html[data-theme="dark"] .tool-link strong { color: #f8fafc; }
html[data-theme="dark"] .tool-link small { color: var(--brand-500); }
html[data-theme="dark"] .tool-link__icon { background: var(--surface); }
html[data-theme="dark"] .tools-panel__icon { background: rgba(96, 165, 250, 0.12); color: #93c5fd; }
html[data-theme="dark"] .intro-panel,
html[data-theme="dark"] .intro-panel--year8,
html[data-theme="dark"] .intro-panel--year,
html[data-theme="dark"] .textbook-hero { border-bottom-color: #675500; background: #806a00; }
html[data-theme="dark"] .intro-panel h1,
html[data-theme="dark"] .textbook-hero h1 { color: #fff; }
html[data-theme="dark"] .intro-panel .lead,
html[data-theme="dark"] .textbook-hero .lead { color: #f8fafc; }
html[data-theme="dark"] .intro-panel .eyebrow,
html[data-theme="dark"] .textbook-hero .eyebrow { color: #fff; }
html[data-theme="dark"] .intro-panel .text-stage,
html[data-theme="dark"] .textbook-hero .text-stage { color: #fff !important; }
html[data-theme="dark"] .intro-panel .breadcrumbs,
html[data-theme="dark"] .textbook-hero .breadcrumbs { color: #fff; }
html[data-theme="dark"] .intro-panel .breadcrumbs a:hover,
html[data-theme="dark"] .textbook-hero .breadcrumbs a:hover { color: #fff; }
html[data-theme="dark"] .hero-quick-links a { border-color: rgba(255,255,255,0.44); background: rgba(15,23,42,0.18); color: #fff; }
html[data-theme="dark"] .hero-quick-links a:hover,
html[data-theme="dark"] .hero-quick-links a.is-active { border-color: #fff; background: rgba(15,23,42,0.32); color: #fff; }
html[data-theme="dark"] .textbook-guide__note { border-color: rgba(56,66,64,0.4); background: rgba(255,255,255,0.68); color: var(--school-charcoal); }
html[data-theme="dark"] .section--textbooks { background: var(--canvas); }
html[data-theme="dark"] .textbook-year-tab { background: var(--canvas); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .unit-card,
html[data-theme="dark"] .gcse-group,
html[data-theme="dark"] .resource-card,
html[data-theme="dark"] .notice,
html[data-theme="dark"] .site-footer,
html[data-theme="dark"] .button--secondary,
html[data-theme="dark"] .anchor-nav a { background: var(--surface); }
html[data-theme="dark"] .gcse-unit-link,
html[data-theme="dark"] .content-card,
html[data-theme="dark"] .unit-option { background: var(--canvas); }
html[data-theme="dark"] .stage-card--year7 { background: var(--year7-bg); }
html[data-theme="dark"] .stage-card--year8 { background: var(--year8-bg); }
html[data-theme="dark"] .stage-card--year9 { background: var(--year9-bg); }
html[data-theme="dark"] .stage-card--gcse { background: var(--gcse-bg); }
html[data-theme="dark"] .stage-card--alevel { background: var(--alevel-bg); }
html[data-theme="dark"] .stage-band { border-color: #675500; background: #806a00; }
html[data-theme="dark"] .stage-band h1,
html[data-theme="dark"] .stage-band .eyebrow { color: #fff; }
html[data-theme="dark"] .stage-band .lead { color: #f8fafc; }
html[data-theme="dark"] .topic-chip { border-color: rgba(255,255,255,0.4); background: rgba(15,23,42,0.18); color: #fff; }
html[data-theme="dark"] .stage-band .anchor-nav a { border-color: rgba(255,255,255,0.42); background: rgba(15,23,42,0.18); color: #fff; }
html[data-theme="dark"] .stage-band .anchor-nav a:hover { border-color: #fff; background: rgba(15,23,42,0.32); color: #fff; }
html[data-theme="dark"] .feature-panel--year8 { background: var(--year8-bg); }
html[data-theme="dark"] .feature-panel--year8 h2,
html[data-theme="dark"] .feature-panel--year8 h3 { color: #f8fafc; }
html[data-theme="dark"] .feature-panel--year8 p { color: #cbd5e1; }
html[data-theme="dark"] .feature-panel--year { background: var(--stage-bg); }
html[data-theme="dark"] .feature-panel--year h2,
html[data-theme="dark"] .feature-panel--year h3 { color: #f8fafc; }
html[data-theme="dark"] .feature-panel--year p { color: #cbd5e1; }
html[data-theme="dark"] .button--dark { border-color: #f8fafc; background: #f8fafc; color: #0f172a; }
html[data-theme="dark"] .button--dark:hover { border-color: #dbeafe; background: #dbeafe; color: #1e3a8a; }
html[data-theme="dark"] .button--secondary { border-color: var(--border-strong); background: var(--canvas); color: #f8fafc; }
html[data-theme="dark"] .button--secondary:hover { border-color: var(--blue-700); background: var(--blue-50); color: #dbeafe; }
html[data-theme="dark"] .intro-panel .button--secondary { border-color: rgba(255,255,255,0.48); background: rgba(15,23,42,0.18); color: #fff; }
html[data-theme="dark"] .intro-panel .button--secondary:hover { border-color: #fff; background: rgba(15,23,42,0.32); color: #fff; }
html[data-theme="dark"] .feature-panel:not(.feature-panel--year8) .button--secondary { border-color: #fff; background: #fff; color: #0f172a; }
html[data-theme="dark"] .feature-panel:not(.feature-panel--year8) .button--secondary:hover { border-color: #bfdbfe; background: #dbeafe; color: #1e40af; }
html[data-theme="dark"] .sparx-panel { border-color: #7c3aed; background: #25143d; }
html[data-theme="dark"] .sparx-panel p { color: #c4b5fd; }
html[data-theme="dark"] .sparx-code { border-color: #6d28d9; background: #160d26; color: #ddd6fe; }
html[data-theme="dark"] .content-section,
html[data-theme="dark"] .selector-card,
html[data-theme="dark"] .textbook-workspace,
html[data-theme="dark"] .section-nav { background: var(--surface); }
html[data-theme="dark"] .feature-panel:not(.feature-panel--year8):not(.feature-panel--year) { background: #182235; }
html[data-theme="dark"] .feature-panel__image { background: #282a30; }
html[data-theme="dark"] .callout--warning { background: #31240a; }
html[data-theme="dark"] .year-choice small { color: var(--brand-500); }
@media (max-width: 900px) {
  .menu-button { display: inline-flex; }
  .site-nav {
    position: fixed;
    inset: 4.25rem 1rem auto;
    display: none;
    align-items: stretch;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 0.75rem;
    box-shadow: var(--shadow);
  }
  .site-nav.is-open { display: flex; }
  .site-nav .site-nav__tool { margin: 0.35rem 0 0; text-align: center; }
  .site-nav__dropdown-button { width: 100%; justify-content: space-between; }
  .tools-panel { position: static; width: 100%; display: none; visibility: visible; transform: none; margin-top: 0.35rem; opacity: 1; box-shadow: none; }
  .tools-panel.is-open { display: block; transform: none; }
  .home-welcome__layout, .intro-panel__grid, .resource-layout, .feature-panel, .docs-layout, .workspace-layout { grid-template-columns: 1fr; }
  .section-nav, .workspace-sidebar { position: static; }
  .section-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .school-mark { min-height: 14rem; }
  .school-mark img { width: 7rem; }
  .feature-panel__split { border-top: 1px solid var(--year8-border); border-left: 0; }
  .card-grid, .tool-grid, .updates-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .textbook-toolbar { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container, .site-header__inner, .site-footer__inner { width: min(calc(100% - 1.25rem), var(--max-width)); }
  .section-heading, .site-footer__inner, .sparx-panel__top { align-items: flex-start; flex-direction: column; }
  .site-footer__meta { text-align: left; }
  .card-grid, .card-grid--two, .tool-grid, .tool-list, .unit-grid, .resource-grid, .updates-grid, .content-grid, .video-grid, .unit-option-grid, .section-nav { grid-template-columns: 1fr; }
  .stage-card { min-height: 14rem; }
  .unit-card { min-height: 0; }
  .gcse-unit-list { grid-template-columns: 1fr; }
  .gcse-group > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .gcse-group__count { display: none; }
  .home-welcome h1 { font-size: clamp(2.35rem, 12vw, 3.4rem); }
  .textbook-hero__layout { grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; }
  .textbook-guide__note { display: none; }
  .textbook-guide img { width: 5.5rem; }
  .textbook-year-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .textbook-year-tab { min-width: 0; }
  .school-mark { min-height: 12rem; }
  .math-symbol--one { left: 6%; }
  .math-symbol--two { right: 4%; }
  .math-symbol--three { right: 6%; }
  .math-symbol--four { left: 8%; }
  .site-brand small { display: none; }
}

@media (max-width: 480px) {
  .site-brand span { display: none; }
}

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