/* Curriculum Design System Tokens v2.0
 * Imported only by curriculum code path (CurriculumHome.js and descendants).
 * Legacy pages continue using global.css with Public Sans — this file does not affect them.
 */

:root {
  /* Brand Colors */
  --brand-primary: #FB923C;
  --brand-primary-dark: #EA580C;
  --brand-primary-light: #FFEDD5;
  --brand-primary-surface: #FFF8F1;
  --streak-heat-mid: #F97316;
  --streak-gold: #F5C15C;
  --frame-dark: #1B3A4B;
  --frame-medium: #4B7A8F;
  --frame-light: #F1F5F9;

  /* Topic Colors */
  --topic-red: #DC2626;
  --topic-cyan: #0E7490;
  --topic-violet: #7E22CE;
  --topic-teal: #0D9488;
  --topic-pink: #DB2777;
  --topic-indigo: #4F46E5;
  --topic-emerald: #059669;
  --topic-blue: #2563EB;
  --topic-orange: #EA580C;

  /* Semantic Colors */
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* Neutral Scale */
  --neutral-900: #1E293B;
  --neutral-700: #334155;
  --neutral-500: #64748B;
  --neutral-300: #CBD5E1;
  --neutral-200: #E2E8F0;
  --neutral-100: #F1F5F9;
  --neutral-50: #F8FAFC;

  /* Typography */
  --font-primary: 'Nunito', 'Noto Sans Devanagari', system-ui, sans-serif;
  --text-display: 28px;
  --text-h1: 22px;
  --text-h2: 18px;
  --text-h3: 16px;
  --text-body: 15px;
  --text-body-bold: 15px;
  --text-small: 13px;
  --text-small-bold: 13px;
  --text-xs: 11px;

  /* Spacing (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
}


/* Public SEO pages (/math/**) — step page layout 2a + plain hubs.
 *
 * Step pages follow the approved lo-fi hand-back (HANDBACK_2a_step_page.md,
 * ratified 2026-10-13, rulings in seo/SEO_PLAN.md): a full-bleed dark band
 * holding header + hero, a two-column body at desktop (questions/worked |
 * skills/grades/details rail), full-width topics + closing sign-up band.
 * Hub/index pages keep the plain centred column — their templates are the
 * NEXT design pass and reuse this band system when it lands.
 *
 * Colour comes from the design tokens (curriculumTokens.css, prepended by the
 * generator). Crumbs/vocab on the dark band use --neutral-300, the designer's
 * AA-safe fallback — their preferred #9FB8C6 is NOT a token and awaits
 * sign-off (hand-back §5). White on #FB923C is retired everywhere: filled
 * buttons are terracotta with dark-ocean text, the closing band's button is
 * ocean with terracotta text (the DS "no terracotta button on cream" rule).
 *
 * Contract: ../../../SEO_PAGES_DESIGN_SPEC.md §6. The two rules that have
 * actually broken things in this repo before:
 *
 *  - C6: `box-sizing: border-box` is set EXPLICITLY. The repo has no global
 *    reset, and that exact omission has shipped four separate layout bugs.
 *  - C8: there is NO `*` font-family rule anywhere in this file. The app's
 *    universal font rules re-font KaTeX's inner spans, which makes its
 *    Private-Use-Area glyphs fall back to arbitrary system characters (a
 *    production bug, 2026-10-08). Fonts are set on named elements only, and
 *    `.katex` is never touched.
 */

:root {
  --seo-max: 44rem;
  --seo-wide: 1280px;
  --seo-ink: var(--neutral-900, #1e293b);
  --seo-muted: var(--neutral-500, #64748b);
  --seo-rule: var(--neutral-200, #e2e8f0);
  --seo-accent: var(--brand-primary, #fb923c);
  --seo-accent-ink: var(--brand-primary-dark, #ea580c);
  --seo-frame: var(--frame-dark, #1b3a4b);
  --seo-surface: var(--brand-primary-surface, #fff8f1);
  --seo-band-ink-muted: var(--neutral-300, #cbd5e1); /* crumbs/vocab on dark */
  --seo-cream: var(--brand-primary-light, #ffedd5);
}

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

/* Inherit the box model rather than asserting it universally, so this cannot
   leak into anything the app owns if the file is ever loaded elsewhere. */
*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  /* Nunito matches the app; the generic stack carries the mathematical
     glyphs (ℤ ℝ ∥ ∝ Σ) that Nunito does not cover. */
  font-family: Nunito, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--seo-ink);
  background: var(--seo-surface);
}

/* ── chrome ─────────────────────────────────────────────────────────────── */

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
  z-index: 10;
  background: #fff;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--seo-frame);
  border-radius: 6px;
}

/* Header shares the hero's dark band (2a §3.1 preferred option: no
   reordering — both elements simply carry the dark background). */
.site-head {
  background: var(--seo-frame);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  /* The side padding grows so the header content aligns with the band's
     1280px column on wide screens. */
  padding: 1rem max(1.25rem, calc((100% - 1280px) / 2));
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.head-actions .login {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.head-actions .login:hover {
  text-decoration: underline;
}

.wordmark {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--seo-accent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  max-width: var(--seo-max);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  margin-top: 3rem;
  border-top: 1px solid var(--seo-rule);
  color: var(--seo-muted);
  font-size: 0.9375rem;
}
.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-foot .fine {
  margin: 0;
  margin-left: auto;
}
/* Step pages run at the wide measure; their footer follows suit. */
main.page-band ~ .site-foot {
  max-width: var(--seo-wide);
}

/* Hubs/index: the plain centred column. */
main {
  max-width: var(--seo-max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}

/* Band pages (step, grade hub, index): the band + body system owns the width. */
main.page-band {
  max-width: none;
  padding: 0;
}

/* ── the dark band (step pages) ─────────────────────────────────────────── */

.hero {
  background: var(--seo-frame);
}
.hero-inner {
  max-width: var(--seo-wide);
  margin: 0 auto;
  padding: 2rem 1.25rem 2.5rem;
}
.hero h1 {
  color: #fff;
  margin: 0.5rem 0 0.25rem;
}
.hero .step-name {
  color: var(--seo-accent);
}
.hero .lead {
  color: var(--seo-rule);
  max-width: 38rem;
}
.hero .crumbs,
.hero .vocab {
  color: var(--seo-band-ink-muted);
}
.hero .crumbs a {
  color: var(--seo-band-ink-muted);
}
.hero .cta {
  margin: 1.25rem 0 0;
}

/* Step-page body: centred wide column; two columns at desktop. */
.body {
  max-width: var(--seo-wide);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}

/* ── type ───────────────────────────────────────────────────────────────── */

h1 {
  font-size: clamp(1.875rem, 1.2rem + 2.2vw, 2.375rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.25rem;
  color: var(--seo-frame);
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 2.25rem 0 0.75rem;
  color: var(--seo-frame);
}

h3 {
  font-size: 1.0625rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--seo-ink);
}

p {
  margin: 0 0 1rem;
}

.step-name {
  font-weight: 700;
  color: var(--seo-accent-ink);
  margin-bottom: 0.75rem;
}

.lead {
  font-size: 1.125rem;
}

.vocab,
.fine {
  color: var(--seo-muted);
  font-size: 0.9375rem;
}

a {
  color: var(--seo-accent-ink);
}
a:hover {
  text-decoration: none;
}

.crumbs {
  font-size: 0.875rem;
  color: var(--seo-muted);
  margin-bottom: 0.5rem;
}
.crumbs .sep {
  margin: 0 0.35rem;
}

/* ── CTAs ───────────────────────────────────────────────────────────────── */

/* Filled button: terracotta with dark-ocean text (DS "primary on dark";
   white-on-#FB923C is retired — it fails AA at button sizes). */
.btn {
  display: inline-block;
  background: var(--seo-accent);
  color: var(--seo-frame);
  font-weight: 800;
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 1.0625rem;
}
.btn:hover,
.btn:focus {
  background: var(--seo-accent-ink);
  color: #fff;
}
.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.9375rem;
}

/* Closing band button: ocean with terracotta text (DS rule: no terracotta
   button on cream). */
.btn-close {
  background: var(--seo-frame);
  color: var(--seo-accent);
}
.btn-close:hover,
.btn-close:focus {
  background: var(--seo-ink);
  color: var(--seo-accent);
}

.cta {
  margin: 1.25rem 0 1.75rem;
}
.cta-end {
  margin: 0;
}

/* The demo row stacks when tight — container-driven, not breakpoint-gated
   (C10 / the repo's stack-when-tight rule). */
.cta-demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 1.25rem 0 0;
}
.cta-demo span {
  flex: 1 1 220px;
  min-width: 0;
  font-weight: 700;
  color: var(--seo-frame);
}
.cta-demo a {
  flex-shrink: 0;
  margin-left: auto;
}

/* Closing sign-up band: full-width cream. */
.s-signup {
  background: var(--seo-cream);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  margin: 2.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.s-signup .cta {
  margin: 0;
}

/* ── samples ────────────────────────────────────────────────────────────── */

.samples-lead {
  color: var(--seo-muted);
  font-size: 0.9375rem;
  margin: -0.25rem 0 1rem;
}

.samples {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sample {
  border: 1px solid var(--seo-rule);
  border-radius: 12px;
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
  background: #fff;
}

.skill {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--seo-muted);
}

/* Wide math must scroll inside its own box, never the page (C10). */
.stem,
.options li,
.solution li {
  overflow-x: auto;
  max-width: 100%;
}

.stem {
  font-size: 1.0625rem;
  margin-bottom: 0.75rem;
}

/* Question math reads in the page font, matching the app (owner fix
   2026-10-13: the KaTeX default serif look clashed with the Nunito prose
   around it). This is SAFE here and only here: the snapshot's math went
   through seo/lib/katexRender.js, which carries the app LatexRenderer's
   \neq-family rewrites, so no Private-Use-Area glyph exists to be re-fonted
   into a fallback box (the 2026-10-08 production bug). Deliberately SCOPED
   to the four question containers and set on the .katex ROOT only — inner
   spans inherit, while KaTeX's own higher-specificity rules (.mathnormal
   etc.) keep variables in math italic. Never a bare `*`, never `.katex *`. */
.stem .katex,
.options .katex,
.reveal .katex,
.solution .katex {
  font-family: Nunito, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1.05em;
}

/* MCQ options: 2×2 at every width down to 375px (2a §4); two options simply
   render one row — no extra rule. */
.options {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.options li {
  border: 1px solid var(--seo-rule);
  border-radius: 8px;
  background: var(--seo-surface);
  padding: 0.5rem 0.75rem;
}

/* Reveal: highlight the correct option with no JS. The answer text inside
   <details> stays as the fallback for browsers without :has() (2a §3.4). */
.sample:has(details[open]) .option[data-correct] {
  border: 2px solid var(--seo-frame);
  background: var(--seo-cream);
  font-weight: 700;
}

/* Show-answer: the DS hint pill. */
.answer summary {
  cursor: pointer;
  display: inline-block;
  font-weight: 700;
  font-size: 0.9375rem;
  color: #92400e;
  background: var(--seo-cream);
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
}
.answer .reveal {
  margin: 0.5rem 0 0;
}

/* Worked example: numbered steps with an ocean counter. */
.solution {
  list-style: none;
  counter-reset: seo-step;
  margin: 0;
  padding: 0;
}
.solution li {
  counter-increment: seo-step;
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 0.625rem;
}
.solution li::before {
  content: counter(seo-step);
  position: absolute;
  left: 0;
  top: 0.125rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--seo-frame);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
}
.worked-stem {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* ── lists ──────────────────────────────────────────────────────────────── */

.skills,
.link-list {
  margin: 0;
  padding-left: 1.25rem;
}
.skills li,
.link-list li {
  margin-bottom: 0.375rem;
}

.detail {
  margin: 2rem 0;
  padding: 0.875rem 1rem;
  border: 1px solid var(--seo-rule);
  border-radius: 10px;
  background: #fff;
}
.detail summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--seo-frame);
}
.detail p {
  margin: 0.75rem 0 0;
  color: var(--seo-muted);
  font-size: 0.9375rem;
}

/* The topics grid: plain list on phones; 2 then 4 columns with room. */
.topics-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem 1.5rem;
}

/* ── layout bands ───────────────────────────────────────────────────────── */

/* Tablet (2a §4): band single column, body one centred column. */
@media (min-width: 40rem) {
  .topics-grid {
    grid-template-columns: 1fr 1fr;
  }
  .body-main,
  .body-rail {
    max-width: var(--seo-max);
    margin-inline: auto;
    width: 100%;
  }
}

/* Hub link lists keep their two columns once there is room. */
@media (min-width: 48rem) {
  .skills,
  .link-list:not(.topics-grid) {
    columns: 2;
    column-gap: 2rem;
  }
  .skills li,
  .link-list li {
    break-inside: avoid;
  }
  /* The rail renders its lists single-column — 340px has no room for two. */
  .body-rail .skills,
  .body-rail .link-list {
    columns: 1;
  }
}

/* Desktop (2a §4): hero two columns, body main + 340px rail (not sticky). */
@media (min-width: 64rem) {
  .hero-inner {
    padding: 2.5rem 4rem 3rem;
  }
  .hero-inner.hero-split {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    column-gap: 3rem;
    align-items: end;
    padding: 2.5rem 4rem 3rem;
  }
  .hero-inner.hero-split > * {
    grid-column: 1;
  }
  .hero-inner.hero-split > .cta {
    grid-column: 2;
    /* Span more rows than the text can occupy; implicit rows are 0-height. */
    grid-row: 1 / span 9;
    align-self: end;
    justify-self: start;
    margin: 0;
  }

  .body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    column-gap: 3.5rem;
    padding: 2rem 4rem 0;
  }
  .body-main {
    grid-column: 1;
    max-width: none;
    margin-inline: 0;
  }
  .body-rail {
    grid-column: 2;
    grid-row: 1;
    max-width: none;
    margin-inline: 0;
  }
  .s-topics,
  .s-signup {
    grid-column: 1 / -1;
  }
  .topics-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Phone (2a §4): tighter band, full-width CTA. */
@media (max-width: 39.9375rem) {
  .hero-inner {
    padding: 1.25rem 1rem 1.75rem;
  }
  .hero h1 {
    font-size: 1.875rem;
  }
  .hero .cta .btn {
    display: block;
    text-align: center;
  }
}

/* ── hub-tier band + cards (3a; grade hub reuses the system) ───────────── */

/* Demo CTA on the DARK band: outline weight (3a I3). The on-light demo
   button under the step page's samples stays a filled .btn (owner fix). */
.btn-outline-dark {
  display: inline-block;
  background: transparent;
  border: 1.5px solid var(--frame-medium, #4b7a8f);
  color: var(--seo-rule);
  font-weight: 700;
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 1.0625rem;
}
.btn-outline-dark:hover,
.btn-outline-dark:focus {
  border-color: #fff;
  color: #fff;
}

.hero .cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Hub-tier body: one wide centred column under the band. */
.body-wide {
  max-width: var(--seo-wide);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}

.section-note {
  margin: -0.25rem 0 1rem;
  color: var(--seo-muted);
  font-size: 0.9375rem;
}

.grade-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  /* Cards vary 3–8 rows; stretching them would leave dead white space. */
  align-items: start;
}

.grade-card {
  background: #fff;
  border: 1.5px solid var(--seo-rule);
  border-radius: 16px;
  padding: 20px;
}
.grade-card:hover {
  border-color: var(--seo-frame);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.card-head h3 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--seo-frame);
}
.card-head h3 a {
  color: var(--seo-frame);
  text-decoration: none;
}
.card-head h3 a:hover,
.card-head h3 a:focus {
  text-decoration: underline;
}
.count {
  font-size: 0.8125rem;
  color: var(--seo-muted);
  white-space: nowrap;
}
.card-note {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--seo-muted);
}

.leaves {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}
.leaf-row {
  border-top: 1px solid #f1e7dc;
}
.leaf-row a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0;
  min-height: 44px;
  text-decoration: none;
  color: var(--seo-ink);
}
.leaf-row a:hover .leaf-name,
.leaf-row a:focus .leaf-name {
  color: var(--seo-accent-ink);
  text-decoration: underline;
}
.tile {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--neutral-100, #f1f5f9);
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--seo-frame);
}
.leaf-text {
  min-width: 0;
}
.leaf-name {
  font-size: 0.9375rem;
  font-weight: 600;
}
.leaf-sub {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--seo-muted);
}
/* A locked row (index cards): visible, muted, clicking through to the
   grade page (or /signup on a fully locked card) rather than an unwritten
   leaf. A locked CARD mutes its title too. */
.leaf-locked .leaf-name {
  color: var(--seo-muted);
}
.card-locked .card-head h3 {
  color: var(--seo-muted);
}

.s-signup .line {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--seo-frame);
  flex: 1 1 260px;
  min-width: 0;
}
.s-signup .cta {
  margin-left: auto;
  flex-shrink: 0;
}

@media (min-width: 40rem) {
  .grade-cards {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 64rem) {
  .grade-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .body-wide {
    padding: 2rem 4rem 0;
  }
}
@media (max-width: 39.9375rem) {
  .hero .cta {
    flex-direction: column;
  }
  .hero .cta .btn,
  .hero .cta .btn-outline-dark {
    width: 100%;
    text-align: center;
  }
}

/* ── accessibility ──────────────────────────────────────────────────────── */

:focus-visible {
  outline: 3px solid var(--seo-accent-ink);
  outline-offset: 2px;
}
.hero :focus-visible,
.site-head :focus-visible {
  outline-color: var(--seo-accent);
}

/* No animations are used, but honour the preference for anything a future
   designer adds (C10). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
