/* ============================================================
   Mr Goddard's Maths — BRAND (2026 rebrand)
   Tokens for both themes, the six strand colours, and the shared
   pieces every new page uses: top bar, theme pill, buttons, cards,
   inputs and the Google Classroom block.

   Theme: no attribute = follow the device; <html data-theme="light|dark">
   is set by /assets/theme.js when someone uses the pill.
   Strand: <body data-strand="number|algebra|graphs|geometry|vectors|statistics">
   sets --strand for that page.
   ============================================================ */

:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --sunken: #EDEDF0;
  --fg: #1C1C1E;
  --muted: #6E6E73;
  --line: rgba(28, 28, 30, 0.10);
  --accent: #F5C518;
  --accent-ink: #1C1C1E;
  --good: #1F9D55;
  --good-bg: rgba(31, 157, 85, 0.12);
  --bad: #D93A3A;
  --bad-bg: rgba(217, 58, 58, 0.10);

  /* Strand colours (the folder colours) */
  --c-number: #F5C518;
  --c-algebra: #4F8CF7;
  --c-graphs: #2FBF71;
  --c-geometry: #FF7A3D;
  --c-vectors: #9B6BFF;
  --c-statistics: #FF5C8A;
  --strand: var(--accent);
  --strand-ink: #1C1C1E;

  /* Rungs */
  --r-bronze: #B87333;
  --r-silver: #A8A9AD;
  --r-gold: #D4A30B;
  --r-platinum: #5E6AD2;

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Inter Tight', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', ui-monospace, Menlo, 'Courier New', monospace;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C1C1E; --surface: #2C2C2E; --sunken: #3A3A3C; --fg: #F5F5F7; --muted: #A1A1A6;
    --line: rgba(245, 245, 247, 0.10); --good: #3DD68C; --good-bg: rgba(61, 214, 140, 0.14);
    --bad: #FF6B6B; --bad-bg: rgba(255, 107, 107, 0.14); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1C1C1E; --surface: #2C2C2E; --sunken: #3A3A3C; --fg: #F5F5F7; --muted: #A1A1A6;
  --line: rgba(245, 245, 247, 0.10); --good: #3DD68C; --good-bg: rgba(61, 214, 140, 0.14);
  --bad: #FF6B6B; --bad-bg: rgba(255, 107, 107, 0.14); color-scheme: dark;
}

body[data-strand="number"] { --strand: var(--c-number); --strand-ink: #1C1C1E; }
body[data-strand="algebra"] { --strand: var(--c-algebra); --strand-ink: #FFFFFF; }
body[data-strand="graphs"] { --strand: var(--c-graphs); --strand-ink: #0E2A1A; }
body[data-strand="geometry"] { --strand: var(--c-geometry); --strand-ink: #2A1305; }
body[data-strand="vectors"] { --strand: var(--c-vectors); --strand-ink: #FFFFFF; }
body[data-strand="statistics"] { --strand: var(--c-statistics); --strand-ink: #2A0712; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Top bar ── */
.gm-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 16px; }
.gm-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; color: var(--fg); min-width: 0; }
.gm-mark { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.gm-crumb { color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-theme { display: inline-flex; flex-shrink: 0; padding: 4px; gap: 2px; border-radius: 999px; background: var(--sunken); }
.gm-theme button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 600 14px var(--font-body); cursor: pointer; }
.gm-theme button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.gm-wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ── Buttons, inputs, cards ── */
.gm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border: 0; border-radius: 12px; font: 700 16px var(--font-body); text-decoration: none; cursor: pointer; background: var(--accent); color: var(--accent-ink); }
.gm-btn.strand { background: var(--strand); color: var(--strand-ink); }
.gm-btn.quiet { background: var(--sunken); color: var(--fg); font-weight: 600; }
.gm-btn:disabled { opacity: 0.5; cursor: default; }
.gm-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.gm-input { height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--fg); font: 500 18px var(--font-body); min-width: 0; }
.gm-input:focus { border-color: var(--strand); outline: none; }
.gm-card { background: var(--surface); border-radius: var(--radius-lg); padding: 28px; }

/* ── Google Classroom block ── */
.gm-slip { margin: 0; padding: 16px; border-radius: 12px; background: var(--bg); color: var(--fg); font: 14px/1.7 var(--font-body); white-space: pre-wrap; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 560px) { .gm-crumb { display: none; } }
