/* ============================================================
   Study v5 (2026-11-15): the study area's token layer, one source of truth.
   The same names as the notebook system, with the site's v5 values
   (docs/redesign/STUDY-DESIGN.md): by day the mist desk, white sheets, the
   v5 ink and blue; by night Apple's black desk, raised greys, an off-white
   reading ink and a lighter blue. Every pair is held by
   tools/audit/contrast_check.py; DESIGN.md and .impeccable/design.json carry
   the same values (pages/tests_design_doc_sync.py).
   Scopes match the theme boot: html.theme-light, and html.theme-dark (dark
   is also the absence of .theme-light, for the legacy chrome).
   ============================================================ */

html.theme-light {
  /* native scrollbars and controls follow the theme */
  color-scheme: light;
  background-color: var(--nb-paper);
  /* the desk and its surfaces (v5: mist desk, white sheets; night: Apple's black, raised greys) */
  --nb-paper: #F5F5F7;
  --nb-paper-raised: #FFFFFF;
  --nb-paper-sunken: #ECECF0;
  --nb-chrome: #FBFBFD;
  --nb-grid-dot: rgba(11, 13, 18, 0);
  /* the reading sheet: what a student reads sits on a plain sheet on the desk (notebook-reading.css) */
  --nb-read-desk: #F5F5F7;
  --nb-read-dot: rgba(11, 13, 18, 0);
  --nb-read-sheet: #FFFFFF;
  --nb-read-edge: #E3E4E8;
  --nb-read-ink: var(--nb-ink);
  --nb-read-figure: none;
  /* one ink; the quiet inks only for states that must not read as live, and for rules that are not words */
  --nb-ink: #0B0D12;
  --nb-ink-2: var(--nb-ink);
  --nb-ink-3: var(--nb-ink);
  --nb-quiet-2: #4B4E57;
  --nb-quiet-3: #636368;
  --nb-footer-ink-2: #4B4E57;
  --nb-footer-ink-3: #636368;
  /* the soft ink: words that only state something (a meta line, a caption, a placeholder) */
  --nb-soft: #66666B;
  /* hairlines; a control's edge clears 3:1 */
  --nb-border: #E3E4E8;
  --nb-border-strong: #7E818B;
  --nb-control-border: #7E818B;
  --nb-border-figure: color-mix(in srgb, var(--nb-ink) 12%, transparent);
  /* actions and selection: the site's blue (v5 --blue); red is the examiner's, never a button */
  --nb-blue: #175BE8;
  --nb-blue-strong: #0F47C4;
  --nb-on-blue: #FFFFFF;
  --nb-blue-wash: #EDF2FE;
  --nb-red: #B42318;
  --nb-red-wash: #FCEFED;
  --nb-hl: #EDF2FE;
  /* the summaries' one warm register (a 3px stripe and a 7% wash; --nb-summary is never text) */
  --nb-summary: #E8913A;
  --nb-summary-ink: #9C5310;
  /* semantic selection */
  --nb-selection-fill: var(--nb-blue);
  --nb-selection-fill-hover: var(--nb-blue-strong);
  --nb-selection-ink: var(--nb-on-blue);
  --nb-selection-border: var(--nb-blue);
  --nb-selection-marker: transparent;
  --nb-selection-wash: var(--nb-blue-wash);
  --nb-selection-soft-ink: var(--nb-blue-strong);
  --nb-selection-soft-border: var(--nb-blue);
  /* functional voice: errors and confirmations */
  --nb-error: #A8261C;
  --nb-success: #0A6B48;
  /* the AI marker's comment, text only */
  --nb-feedback-ink: #000000;
  /* the callouts: one accent per purpose, AA on the sheet and on its own wash (DESIGN.md section 2) */
  --nb-adm-warn: #A33B35;
  --nb-adm-tip: #176B57;
  --nb-adm-insight: #805914;
  --nb-adm-key: #175BE8;
  --nb-adm-def: #21665F;
  --nb-adm-example: #355A74;
  --nb-adm-scope: #55635E;
  --nb-adm-mnemonic: #8A4452;
  --nb-adm-mathskill: #236077;
  --nb-adm-derivation: #31567C;
  --nb-adm-result: #176B57;
  --nb-adm-interp: #2C607B;
  --nb-adm-scenario: #53645E;
  --nb-adm-proportion: #805914;
  --nb-adm-tint: 5%;
  /* the MCQ correction voice: DELIBERATELY EQUAL TO --nb-adm-mathskill TODAY, AND OWNED SEPARATELY (DESIGN.md, the correction voice) */
  --nb-correction: #236077;
  /* the desk's accents (the dashboard and the profile) */
  --nb-desk-teal: #0C7078;
  --nb-desk-teal-wash: #DCF2F1;
  --nb-desk-amber: #9A520A;
  --nb-desk-amber-wash: #FBEBD6;
  --nb-desk-text-2: var(--nb-ink);
  --nb-desk-text-3: var(--nb-ink);
  /* the minimal desk: the dashboard and the profile */
  --nb-m-paper: #F5F5F7;
  --nb-m-surface: #FFFFFF;
  --nb-m-ink: #0B0D12;
  --nb-m-ink-2: var(--nb-m-ink);
  --nb-m-hairline: #E3E4E8;
  --nb-m-edge: #D2D4DA;
  --nb-m-edge-strong: #B3B6BE;
  --nb-m-blue: #175BE8;
  --nb-m-blue-strong: #0F47C4;
  --nb-m-blue-wash: #EDF2FE;
  --nb-m-tint: #E3EBFD;
  --nb-m-green: #0C7A5B;
  --nb-m-amber: #A64B06;
  /* the mastery tiers: strong, fair, needs work (--nb-m-green is the strong tier; the tier lab's Now palette mirrors these) */
  --nb-m-fair: #F0C700;
  --nb-m-weak: #D21D32;
  --nb-m-strong-ink: var(--nb-m-green);
  --nb-m-fair-ink: #826A00;
  --nb-m-weak-ink: var(--nb-m-weak);
  --nb-m-track: #E3E4E8;
  --nb-m-control: #7E818B;
  --nb-m-hover: rgba(11, 13, 18, 0.05);
  --nb-m-press: rgba(11, 13, 18, 0.09);
  --nb-m-on-blue: #FFFFFF;
  --nb-m-shape-a: 0.10;
  --nb-m-dot-teal: #0C7078;
  --nb-m-dot-blue: #175BE8;
  --nb-m-dot-amber: #B45309;
  --nb-m-logo-filter: brightness(0);
  --nb-m-toast: #0B0D12;
  --nb-m-toast-ink: #F5F5F7;
  --nb-m-toast-edge: transparent;
  --nb-m-raised: var(--nb-m-surface);
  --nb-m-raised-edge: var(--nb-m-edge);
  /* the profile's state colours */
  --nb-m-ok-ink: #0C7A52;
  --nb-m-ok-wash: #E8F4EE;
  --nb-m-ok-edge: #90C2B2;
  --nb-m-warn-wash: #F3EAE2;
  --nb-m-warn-edge: #D5AC8C;
  --nb-m-danger: #B42318;
  --nb-m-flame: #D92D20;
  --nb-m-danger-strong: #961C13;
  --nb-m-danger-wash: #FCEFED;
  --nb-m-danger-press: #F0D9D6;
  --nb-m-danger-edge: #CE7169;
  --nb-m-on-danger: #FFFFFF;
  --nb-m-blue-edge: #5788ED;
  --nb-m-toast-ok: #4CC99A;
  --nb-m-toast-warn: #F0A45B;
  /* the Premium marker: the site's blue, worn quietly */
  --nb-premium: var(--nb-blue);
  --nb-premium-wash: color-mix(in srgb, var(--nb-premium) 12%, transparent);
  /* subject identity (picker plates only) */
  --nb-subject-biology: #216747;
  --nb-subject-chemistry: #21665F;
  --nb-subject-physics: #175BE8;
  --nb-subject-mathematics: #355A74;
  --nb-subject-english: #8A4452;
  --nb-subject-economics: #6E553D;
  --nb-subject-icon-wash: 8%;
  --nb-subject-icon-line: 28%;
  /* resource identity (hub plates only) */
  --nb-resource-notes: #175BE8;
  --nb-resource-flashcards: #355A74;
  --nb-resource-questions: #8C4A32;
  --nb-resource-summaries: #21665F;
  --nb-resource-videos: #8A4452;
  --nb-resource-pastpapers: #31567C;
  --nb-resource-mocks: #216747;
  --nb-resource-icon-wash: 8%;
  --nb-resource-icon-line: 28%;
  --nb-resource-featured-wash: 8%;
  /* homepage roles (aliases) */
  --nb-home-recall: var(--nb-resource-flashcards);
  --nb-home-depth: var(--nb-resource-questions);
  --nb-home-check: var(--nb-resource-videos);
  --nb-home-system: var(--nb-resource-summaries);
  --nb-home-card-wash: 5%;
  --nb-home-card-line: 24%;
  --nb-home-icon-wash: 8%;
  --nb-home-icon-line: 28%;
  /* programme and board identity (aliases) */
  --nb-programme-igcse: var(--nb-resource-mocks);
  --nb-programme-alevel: var(--nb-resource-notes);
  --nb-programme-ap: var(--nb-resource-questions);
  --nb-programme-sat: var(--nb-resource-summaries);
  --nb-board-edexcel: var(--nb-resource-notes);
  --nb-board-cie: var(--nb-resource-mocks);
  --nb-programme-icon-wash: 8%;
  --nb-programme-icon-line: 28%;
  /* elevation: three soft shadows, for what floats (v5: no decorative shadow) */
  --nb-shadow-1: 0 1px 2px rgba(11, 13, 18, 0.06);
  --nb-shadow-2: 0 4px 14px rgba(11, 13, 18, 0.08);
  --nb-shadow-3: 0 14px 36px rgba(11, 13, 18, 0.14);
  /* the tutor sheet: one component's own surface (notebook-tutor.css) */
  --nb-tutor-paper: #FFFFFF;
  --nb-tutor-ink: #0B0D12;
  --nb-tutor-pencil: #4B4E57;
  --nb-tutor-accent: #175BE8;
  --nb-tutor-edge: #E3E4E8;
  --nb-tutor-chip-ink: #FFFFFF;
  --nb-tutor-shadow: 0 18px 40px rgba(11, 13, 18, 0.12), 0 2px 6px rgba(11, 13, 18, 0.06);
  --nb-tutor-edge-shadow: -10px 0 28px rgba(11, 13, 18, 0.10);
}

/* the night scope; equal specificity (0,1,1) with the day scope */
html.theme-dark,
html:not(.theme-light) {
  color-scheme: dark;
  /* the desk and its surfaces (v5: mist desk, white sheets; night: Apple's black, raised greys) */
  --nb-paper: #000000;
  --nb-paper-raised: #1D1D1F;
  --nb-paper-sunken: #0C0C0E;
  --nb-chrome: #161617;
  --nb-grid-dot: rgba(245, 245, 247, 0);
  /* the reading sheet: what a student reads sits on a plain sheet on the desk (notebook-reading.css) */
  --nb-read-desk: var(--nb-paper);
  --nb-read-dot: rgba(245, 245, 247, 0);
  --nb-read-sheet: #161617;
  --nb-read-edge: #2C2C2E;
  --nb-read-ink: #E8E8ED;
  --nb-read-figure: brightness(0.9) contrast(1.04);
  /* one ink; the quiet inks only for states that must not read as live, and for rules that are not words */
  --nb-ink: #F5F5F7;
  --nb-ink-2: var(--nb-ink);
  --nb-ink-3: var(--nb-ink);
  --nb-quiet-2: #AEAEB2;
  --nb-quiet-3: #8E8E93;
  --nb-footer-ink-2: #AEAEB2;
  --nb-footer-ink-3: #8E8E93;
  /* the soft ink: words that only state something (a meta line, a caption, a placeholder) */
  --nb-soft: #AEAEB2;
  /* hairlines; a control's edge clears 3:1 */
  --nb-border: #333336;
  --nb-border-strong: #48484C;
  --nb-control-border: #6E6E73;
  --nb-border-figure: var(--nb-border);
  /* actions and selection: the site's blue (v5 --blue); red is the examiner's, never a button */
  --nb-blue: #6B9BFF;
  --nb-blue-strong: #9DBBFF;
  --nb-on-blue: #000000;
  --nb-blue-wash: rgba(107, 155, 255, 0.14);
  --nb-red: #FF7B72;
  --nb-red-wash: rgba(255, 123, 114, 0.12);
  --nb-hl: rgba(107, 155, 255, 0.14);
  /* the summaries' one warm register (a 3px stripe and a 7% wash; --nb-summary is never text) */
  --nb-summary: #E8913A;
  --nb-summary-ink: #E8913A;
  /* semantic selection */
  --nb-selection-fill: var(--nb-blue);
  --nb-selection-fill-hover: var(--nb-blue-strong);
  --nb-selection-ink: var(--nb-on-blue);
  --nb-selection-border: var(--nb-blue);
  --nb-selection-marker: transparent;
  --nb-selection-wash: var(--nb-blue-wash);
  --nb-selection-soft-ink: var(--nb-blue);
  --nb-selection-soft-border: color-mix(in srgb, var(--nb-blue) 28%, transparent);
  /* functional voice: errors and confirmations */
  --nb-error: #FF7B72;
  --nb-success: #4FCF9A;
  /* the AI marker's comment, text only */
  --nb-feedback-ink: #FFFFFF;
  /* the callouts: one accent per purpose, AA on the sheet and on its own wash (DESIGN.md section 2) */
  --nb-adm-warn: #E86A5A;
  --nb-adm-tip: #6FBF8F;
  --nb-adm-insight: #D2A24E;
  --nb-adm-key: var(--nb-blue);
  --nb-adm-def: #6FB3AE;
  --nb-adm-example: #9AA6D0;
  --nb-adm-scope: #8A919E;
  --nb-adm-mnemonic: #E39BB0;
  --nb-adm-mathskill: #6FC0D6;
  --nb-adm-derivation: #8AA2CC;
  --nb-adm-result: #63C694;
  --nb-adm-interp: #7CBFD9;
  --nb-adm-scenario: #9AA6C0;
  --nb-adm-proportion: #DDB05C;
  --nb-adm-tint: 10%;
  /* the MCQ correction voice: DELIBERATELY EQUAL TO --nb-adm-mathskill TODAY, AND OWNED SEPARATELY (DESIGN.md, the correction voice) */
  --nb-correction: #6FC0D6;
  /* the desk's accents (the dashboard and the profile) */
  --nb-desk-teal: #4FD3D8;
  --nb-desk-teal-wash: rgba(79, 211, 216, 0.14);
  --nb-desk-amber: #F2B65E;
  --nb-desk-amber-wash: rgba(242, 182, 94, 0.16);
  --nb-desk-text-2: var(--nb-ink);
  --nb-desk-text-3: var(--nb-ink);
  /* the minimal desk: the dashboard and the profile */
  --nb-m-paper: #000000;
  --nb-m-surface: #1D1D1F;
  --nb-m-ink: #F5F5F7;
  --nb-m-ink-2: var(--nb-m-ink);
  --nb-m-hairline: #2C2C2E;
  --nb-m-edge: #3A3A3C;
  --nb-m-edge-strong: #545458;
  --nb-m-blue: #6B9BFF;
  --nb-m-blue-strong: #9DBBFF;
  --nb-m-blue-wash: rgba(107, 155, 255, 0.14);
  --nb-m-tint: #2A3143;
  --nb-m-green: #4CC99A;
  --nb-m-amber: #FFB340;
  /* the mastery tiers: strong, fair, needs work (--nb-m-green is the strong tier; the tier lab's Now palette mirrors these) */
  --nb-m-fair: #FFD400;
  --nb-m-weak: #FB5760;
  --nb-m-strong-ink: var(--nb-m-green);
  --nb-m-fair-ink: var(--nb-m-fair);
  --nb-m-weak-ink: var(--nb-m-weak);
  --nb-m-track: #2C2C2E;
  --nb-m-control: #6E6E73;
  --nb-m-hover: rgba(245, 245, 247, 0.06);
  --nb-m-press: rgba(245, 245, 247, 0.10);
  --nb-m-on-blue: #000000;
  --nb-m-shape-a: 0.16;
  --nb-m-dot-teal: #4FD3D8;
  --nb-m-dot-blue: #789FF2;
  --nb-m-dot-amber: #F0A45B;
  --nb-m-logo-filter: none;
  --nb-m-toast: #2C2C2E;
  --nb-m-toast-ink: #F5F5F7;
  --nb-m-toast-edge: #3A3A3C;
  --nb-m-raised: #2C2C2E;
  --nb-m-raised-edge: var(--nb-m-edge-strong);
  /* the profile's state colours */
  --nb-m-ok-ink: var(--nb-m-green);
  --nb-m-ok-wash: #203430;
  --nb-m-ok-edge: #306A58;
  --nb-m-warn-wash: #382E29;
  --nb-m-warn-edge: #7A593C;
  --nb-m-danger: #FF7B72;
  --nb-m-flame: #FF6B5E;
  --nb-m-danger-strong: #FF9A93;
  --nb-m-danger-wash: #35272B;
  --nb-m-danger-press: #402C30;
  --nb-m-danger-edge: #A35552;
  --nb-m-on-danger: #000000;
  --nb-m-blue-edge: #546CA2;
  --nb-m-toast-ok: #4CC99A;
  --nb-m-toast-warn: #F0A45B;
  /* the Premium marker: the site's blue, worn quietly */
  --nb-premium: var(--nb-blue);
  --nb-premium-wash: color-mix(in srgb, var(--nb-premium) 16%, transparent);
  /* subject identity (picker plates only) */
  --nb-subject-biology: #70BD91;
  --nb-subject-chemistry: #70BEC1;
  --nb-subject-physics: #8DAFE6;
  --nb-subject-mathematics: #9AA3E0;
  --nb-subject-english: #E09AA6;
  --nb-subject-economics: #C09A80;
  --nb-subject-icon-wash: 10%;
  --nb-subject-icon-line: 34%;
  /* resource identity (hub plates only) */
  --nb-resource-notes: var(--nb-blue);
  --nb-resource-flashcards: #95A5DF;
  --nb-resource-questions: #E8864F;
  --nb-resource-summaries: #5DC5BC;
  --nb-resource-videos: #F08AA6;
  --nb-resource-pastpapers: #7FA0E0;
  --nb-resource-mocks: #5FCB88;
  --nb-resource-icon-wash: 10%;
  --nb-resource-icon-line: 34%;
  --nb-resource-featured-wash: 16%;
  /* homepage roles (aliases) */
  --nb-home-recall: var(--nb-resource-flashcards);
  --nb-home-depth: var(--nb-resource-questions);
  --nb-home-check: var(--nb-resource-videos);
  --nb-home-system: var(--nb-resource-summaries);
  --nb-home-card-wash: 14%;
  --nb-home-card-line: 30%;
  --nb-home-icon-wash: 10%;
  --nb-home-icon-line: 34%;
  /* programme and board identity (aliases) */
  --nb-programme-igcse: var(--nb-resource-mocks);
  --nb-programme-alevel: var(--nb-resource-notes);
  --nb-programme-ap: var(--nb-resource-questions);
  --nb-programme-sat: var(--nb-resource-summaries);
  --nb-board-edexcel: var(--nb-resource-notes);
  --nb-board-cie: var(--nb-resource-mocks);
  --nb-programme-icon-wash: 10%;
  --nb-programme-icon-line: 34%;
  /* elevation: three soft shadows, for what floats (v5: no decorative shadow) */
  --nb-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --nb-shadow-2: 0 4px 14px rgba(0, 0, 0, 0.55);
  --nb-shadow-3: 0 14px 36px rgba(0, 0, 0, 0.6);
  /* the tutor sheet: one component's own surface (notebook-tutor.css) */
  --nb-tutor-paper: #1D1D1F;
  --nb-tutor-ink: #F5F5F7;
  --nb-tutor-pencil: #AEAEB2;
  --nb-tutor-accent: #6B9BFF;
  --nb-tutor-edge: #333336;
  --nb-tutor-chip-ink: #000000;
  --nb-tutor-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  --nb-tutor-edge-shadow: -12px 0 30px rgba(0, 0, 0, 0.55);
}

/* theme-independent */
:root {
  --nb-chrome-h: 64px;
  --nb-pset-card-bg: #FFFFFF;
  --nb-tutor-tab-w: 44px;
  --nb-sans: "Archivo", "IBM Plex Sans", "Archivo Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --nb-serif: var(--nb-sans);
  --nb-text-xs: 0.75rem;
  --nb-text-sm: 0.8125rem;
  --nb-text-base: 0.9375rem;
  --nb-text-md: 1.0625rem;
  --nb-text-lg: 1.25rem;
  --nb-text-xl: 1.5rem;
  --nb-text-2xl: 1.875rem;
  --nb-text-3xl: 2.375rem;
  --nb-text-hero: clamp(2.75rem, 6vw, 5.25rem);
  --nb-type-ui: 400 var(--nb-text-base)/1.5 var(--nb-sans);
  --nb-type-prose: 400 var(--nb-text-md)/1.65 var(--nb-sans);
  --nb-type-control: 600 var(--nb-text-base)/1.2 var(--nb-sans);
  --nb-type-label: 600 var(--nb-text-sm)/1.2 var(--nb-sans);
  --nb-type-title: 600 var(--nb-text-lg)/1.3 var(--nb-sans);
  --nb-type-headline: 700 var(--nb-text-2xl)/1.2 var(--nb-sans);
  --nb-type-display: 700 var(--nb-text-hero)/1.05 var(--nb-sans);
  --nb-type-examiner: italic 400 var(--nb-text-md)/1.5 var(--nb-serif);
  --nb-type-editorial: 600 var(--nb-text-xl)/1.25 var(--nb-serif);
  --nb-we-math-size: calc(1.21em * 0.85);
  --nb-s1: 4px;
  --nb-s2: 8px;
  --nb-s3: 12px;
  --nb-s4: 16px;
  --nb-s5: 20px;
  --nb-s6: 24px;
  --nb-s7: 32px;
  --nb-s8: 40px;
  --nb-s9: 48px;
  --nb-s10: 64px;
  --nb-r-sm: 6px;
  --nb-r-md: 10px;
  --nb-r-lg: 16px;
  --nb-r-pill: 999px;
  --nb-section-sm: clamp(56px, 7vh, 80px);
  --nb-section-md: clamp(80px, 10vh, 120px);
  --nb-section-lg: clamp(112px, 14vh, 176px);
  --nb-display: var(--nb-sans);
  --nb-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nb-dur-1: 120ms;
  --nb-dur-2: 240ms;
  --nb-dur-3: 420ms;
  --nb-m-dur-1: 160ms;
  --nb-m-dur-2: 220ms;
  --nb-grid-size: 18px;
}

@media (prefers-reduced-motion: reduce) {
  :root { --nb-dur-1: 0ms; --nb-dur-2: 0ms; --nb-dur-3: 0ms; --nb-m-dur-1: 0ms; --nb-m-dur-2: 0ms; }
}
