/* ════════════════════════════════════════════════════════════════════
 * ZeroSpread School — Shared Theme Tokens
 * ────────────────────────────────────────────────────────────────────
 * One CSS file, loaded once from `app/school/layout.tsx`, defines every
 * token that any chapter / lesson surface needs in BOTH themes.
 *
 *   - Dark mode  → :root (default).
 *   - Light mode → .light (toggled on `<html>` by SchoolThemeProvider).
 *
 * Why CSS variables (and not React state)?
 *   • Theme switches are instant — no re-renders, no closure invalidation
 *     of helper components defined at module scope (which is how
 *     chapters 2–11 are structured).
 *   • Module-level palette objects (`const C = { ... }`) keep working
 *     unchanged — they just hold `var(--zs-...)` strings.
 *   • Chapter-specific accents (e.g. green for chapter 5) stay simple:
 *     each chapter overrides only the few keys it needs.
 *
 * Naming convention: `--zs-{category}-{token}` to avoid collisions with
 * any global theme tokens elsewhere in the app.
 * ════════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces ───────────────────────────────────────────── */
  --zs-page-bg: #070B14;
  --zs-card-bg: rgba(148, 163, 184, 0.04);
  --zs-card-bg-strong: rgba(148, 163, 184, 0.06);
  /* Card border: lifted from 0.10 → 0.13 so cards never feel like ghosts
   * against the deep navy page background. Still soft, never harsh. */
  --zs-card-border: rgba(148, 163, 184, 0.13);
  --zs-card-border-strong: rgba(148, 163, 184, 0.22);
  --zs-section-bg: rgba(148, 163, 184, 0.02);
  /* Divider: lifted 0.08 → 0.11 — section dividers were nearly invisible
   * and made the rhythm hard to scan. */
  --zs-divider: rgba(148, 163, 184, 0.11);

  /* Typography ─────────────────────────────────────────── */
  --zs-text-1: #E2E8F0;
  --zs-text-2: #94A3B8;
  --zs-text-3: #64748B;

  /* Depth tokens — shared shadow recipes used by hero / cards
   * (chapter components opt-in via the .zs-chapter-typography
   * scoped helpers; they never override existing inline shadows). */
  --zs-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 1px rgba(0, 0, 0, 0.20);
  --zs-shadow-md: 0 8px 24px -10px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.30);
  --zs-shadow-lg: 0 24px 60px -22px rgba(0, 0, 0, 0.55), 0 8px 22px -10px rgba(0, 0, 0, 0.35);
  --zs-shadow-hero: 0 40px 100px -40px rgba(0, 0, 0, 0.70), 0 12px 32px -12px rgba(0, 0, 0, 0.40);

  /* Focus ring — used by the global :focus-visible polish in
   * ChapterTypography. Gold to match the lesson top bar's accent. */
  --zs-focus-ring: 0 0 0 2px rgba(7, 11, 20, 0.95), 0 0 0 4px rgba(224, 181, 71, 0.65);
  --zs-focus-ring-color: rgba(224, 181, 71, 0.65);

  /* Selection — warm gold tint that reads on every brand surface. */
  --zs-selection-bg: rgba(224, 181, 71, 0.28);
  --zs-selection-fg: #FFF8E1;

  /* Brand — accent (default = blue) ────────────────────── */
  --zs-accent: #3B82F6;
  --zs-accent-dim: rgba(59, 130, 246, 0.10);
  --zs-accent-border: rgba(59, 130, 246, 0.28);

  /* Semantic colors — green ────────────────────────────── */
  --zs-green: #10B981;
  --zs-green-dim: rgba(16, 185, 129, 0.10);
  --zs-green-border: rgba(16, 185, 129, 0.28);

  /* Semantic colors — amber ────────────────────────────── */
  --zs-amber: #F59E0B;
  --zs-amber-dim: rgba(245, 158, 11, 0.10);
  --zs-amber-border: rgba(245, 158, 11, 0.28);

  /* Semantic colors — red ──────────────────────────────── */
  --zs-red: #EF4444;
  --zs-red-dim: rgba(239, 68, 68, 0.10);
  --zs-red-border: rgba(239, 68, 68, 0.28);

  /* Semantic colors — purple ───────────────────────────── */
  --zs-purple: #A855F7;
  --zs-purple-dim: rgba(168, 85, 247, 0.10);
  --zs-purple-border: rgba(168, 85, 247, 0.28);

  /* Semantic colors — teal ─────────────────────────────── */
  --zs-teal: #14B8A6;
  --zs-teal-dim: rgba(20, 184, 166, 0.10);
  --zs-teal-border: rgba(20, 184, 166, 0.28);

  /* Semantic colors — blue (kept distinct when accent has  *
   * been overridden to a non-blue value — e.g. ch.5/6/9). */
  --zs-blue: #3B82F6;
  --zs-blue-dim: rgba(59, 130, 246, 0.10);
  --zs-blue-border: rgba(59, 130, 246, 0.28);

  /* Brand — gold (theme-shifted per spec) ──────────────── *
   * dark: #E0B547   light: #B8860B                          */
  --zs-gold: #E0B547;
  --zs-gold-dim: rgba(224, 181, 71, 0.10);
  --zs-gold-border: rgba(224, 181, 71, 0.28);
}

/* ──────────────────────────────────────────────────────────────
 * Light mode overrides
 * ──────────────────────────────────────────────────────────────
 * Surfaces become true white / soft slate; brand colors deepen
 * one notch (Tailwind 600 → 700-ish) so they keep WCAG-friendly
 * contrast on white. Borders go from translucent → solid slate
 * so cards never "disappear" into the background.
 * ────────────────────────────────────────────────────────────── */
.light,
html[data-zs-school-lesson="1"][data-school-theme="light"] {
  /* Surfaces — pearl / white / graphite (School wide presentation) */
  --zs-page-bg: #ffffff;
  --zs-card-bg: #FFFFFF;
  --zs-card-bg-strong: #fafaf7;
  /* Hairline borders — not heavy slate cards */
  --zs-card-border: rgba(11, 13, 12, 0.08);
  --zs-card-border-strong: rgba(11, 13, 12, 0.14);
  --zs-section-bg: #ffffff;
  --zs-divider: rgba(11, 13, 12, 0.08);

  /* Typography */
  --zs-text-1: #0B0D0C;
  --zs-text-2: rgba(11, 13, 12, 0.70);
  --zs-text-3: rgba(11, 13, 12, 0.50);

  /* Depth — flat / architectural, not floating card soup */
  --zs-shadow-sm: none;
  --zs-shadow-md: none;
  --zs-shadow-lg: none;
  --zs-shadow-hero: 0 1px 2px rgba(11, 13, 12, 0.04), 0 12px 40px -24px rgba(11, 13, 12, 0.18);

  /* Focus ring — uses brand gold, but the inner halo flips to white so it
   * reads against the bright surface. */
  --zs-focus-ring: 0 0 0 2px #FFFFFF, 0 0 0 4px rgba(184, 134, 11, 0.55);
  --zs-focus-ring-color: rgba(184, 134, 11, 0.55);

  --zs-selection-bg: rgba(184, 134, 11, 0.18);
  --zs-selection-fg: #2A1A00;

  /* Accent */
  --zs-accent: #2563EB;
  --zs-accent-dim: rgba(37, 99, 235, 0.08);
  --zs-accent-border: rgba(37, 99, 235, 0.30);

  /* Green */
  --zs-green: #059669;
  --zs-green-dim: rgba(5, 150, 105, 0.08);
  --zs-green-border: rgba(5, 150, 105, 0.30);

  /* Amber */
  --zs-amber: #B45309; /* amber-700: same hue, readable on white (was #D97706, 2.9:1) */
  --zs-amber-dim: rgba(217, 119, 6, 0.08);
  --zs-amber-border: rgba(217, 119, 6, 0.30);

  /* Red */
  --zs-red: #DC2626;
  --zs-red-dim: rgba(220, 38, 38, 0.08);
  --zs-red-border: rgba(220, 38, 38, 0.30);

  /* Purple */
  --zs-purple: #7C3AED;
  --zs-purple-dim: rgba(124, 58, 237, 0.08);
  --zs-purple-border: rgba(124, 58, 237, 0.30);

  /* Teal */
  --zs-teal: #0D9488;
  --zs-teal-dim: rgba(13, 148, 136, 0.08);
  --zs-teal-border: rgba(13, 148, 136, 0.30);

  /* Blue */
  --zs-blue: #2563EB;
  --zs-blue-dim: rgba(37, 99, 235, 0.08);
  --zs-blue-border: rgba(37, 99, 235, 0.30);

  /* Gold (light spec) */
  --zs-gold: #B8860B;
  --zs-gold-dim: rgba(184, 134, 11, 0.08);
  --zs-gold-border: rgba(184, 134, 11, 0.30);
}

