/* Roote Shule design tokens.
   Every colour, size and timing used by the web app, the public site and
   printed documents. Schools override the four --school-* inputs; everything
   else derives from them. Production emits computed hex values from the
   server (ThemeTokens) so PDFs and the Flutter app get the same numbers. */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-serif-4-opsz.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-serif-4-opsz-italic.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
}

:root {
  /* ---- School inputs (white label). Default: forest and marigold. ---- */
  --school-brand: #1d5c45;
  --school-accent: #e1a33a;

  /* ---- Neutrals ---- */
  --ground: #f4f5f1;
  --ground-2: #eceee8;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --ink: #16201b;
  --ink-2: #4b5852;
  --ink-3: #66726b;
  --line: #dfe3dc;
  --line-strong: #c7cec6;
  --scrim: rgb(13 19 17 / 0.48);

  /* ---- Brand, derived ---- */
  --brand: var(--school-brand);
  --brand-ink: color-mix(in oklab, var(--school-brand) 88%, #000);
  --brand-strong: color-mix(in oklab, var(--school-brand) 78%, #000);
  --brand-tint: color-mix(in oklab, var(--school-brand) 9%, var(--surface));
  --brand-tint-2: color-mix(in oklab, var(--school-brand) 16%, var(--surface));
  --on-brand: #ffffff;
  --accent: var(--school-accent);
  --accent-ink: #8a5a00;
  --accent-tint: color-mix(in oklab, var(--school-accent) 16%, var(--surface));

  /* ---- Status ---- */
  --pos: #17703f;   --pos-bg: #e3f3e8;   --pos-line: #a9d8b8;
  --warn: #8a5a00;  --warn-bg: #fbf0d9;  --warn-line: #ecd29a;
  --neg: #b3261e;   --neg-bg: #fbe7e5;   --neg-line: #efb9b4;
  --info: #245c99;  --info-bg: #e5eef8;  --info-line: #b5cdea;
  --sim: #5b3e99;   --sim-bg: #efeafa;   --sim-line: #c9b9ea;

  /* ---- Chart series (validated against both grounds) ---- */
  --chart-1: var(--brand);
  --chart-2: color-mix(in oklab, var(--school-brand) 38%, #e2e6e1);
  --chart-3: var(--accent);
  --chart-grid: var(--line);

  /* ---- Type ---- */
  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Work density scale */
  --t-xs: 0.75rem;     /* 11.3px at 15px root */
  --t-sm: 0.8125rem;
  --t-md: 0.875rem;    /* work body */
  --t-lg: 1rem;
  --t-xl: 1.25rem;
  --t-2xl: 1.5rem;
  --t-3xl: 2rem;
  --t-num: 2.25rem;    /* headline figures */

  /* Public density scale */
  --p-body: 1.0625rem;
  --p-lead: 1.25rem;
  --p-h3: 1.5rem;
  --p-h2: clamp(2rem, 1.2rem + 2.6vw, 3.25rem);
  --p-h1: clamp(2.5rem, 1.3rem + 4vw, 4.25rem);

  /* ---- Space (0.25rem steps) ---- */
  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem; --s-5: 1.25rem;
  --s-6: 1.5rem; --s-8: 2rem; --s-10: 2.5rem; --s-12: 3rem; --s-16: 4rem; --s-24: 6rem;

  /* ---- Shape ---- */
  --r-ctl: 0.625rem;
  --r-panel: 0.875rem;
  --r-tray: 2rem;
  --r-tray-in: 1.5rem;
  --r-pill: 999px;

  /* ---- Rows and controls ---- */
  --row: 2.75rem;
  --row-compact: 2.25rem;
  --row-touch: 3.25rem;
  --ctl-h: 2.25rem;

  /* ---- Depth (tinted) ---- */
  --shadow-1: 0 1px 2px rgb(22 32 27 / 0.06);
  --shadow-2: 0 2px 6px rgb(22 32 27 / 0.06), 0 12px 32px rgb(22 32 27 / 0.10);
  --shadow-3: 0 4px 12px rgb(22 32 27 / 0.08), 0 28px 64px rgb(22 32 27 / 0.18);

  /* ---- Motion ---- */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --t-press: 140ms;
  --t-quick: 180ms;
  --t-sheet: 320ms;

  /* ---- Layers ---- */
  --z-sticky: 10;
  --z-nav: 20;
  --z-drawer: 40;
  --z-dialog: 50;
  --z-toast: 60;

  /* ---- Layout ---- */
  --content-max: 80rem;
  --sidebar-w: 15rem;

  color-scheme: light;
}

/* ---- Alternative school colours (white-label previews) ---- */
[data-brand="navy"]   { --school-brand: #1c3d6e; --school-accent: #e1a33a; }
[data-brand="maroon"] { --school-brand: #7a1f2b; --school-accent: #d9a520; }

/* ---- Dark theme ----
   A small script in <head> (js/theme-boot.js, inlined in production) sets
   data-theme on <html> before first paint: the stored choice, otherwise the
   device setting. Styles only swap tokens. */
:root[data-theme="dark"] {
  --ground: #0d1311;
  --ground-2: #111916;
  --surface: #141c18;
  --surface-2: #1a241f;
  --ink: #e7ece8;
  --ink-2: #b4beb8;
  --ink-3: #8f9a94;
  --line: #26312c;
  --line-strong: #34413a;
  --scrim: rgb(0 0 0 / 0.6);

  --brand-ink: color-mix(in oklab, var(--school-brand) 45%, #fff);
  --brand-strong: color-mix(in oklab, var(--school-brand) 70%, #fff);
  --brand-tint: color-mix(in oklab, var(--school-brand) 22%, var(--surface));
  --brand-tint-2: color-mix(in oklab, var(--school-brand) 34%, var(--surface));
  --accent-ink: #f0c26d;
  --accent-tint: color-mix(in oklab, var(--school-accent) 18%, var(--surface));

  --pos: #6fd29a;  --pos-bg: #15291e;  --pos-line: #23523a;
  --warn: #f0c26d; --warn-bg: #2b2213; --warn-line: #5a4519;
  --neg: #f59c93;  --neg-bg: #2f1715;  --neg-line: #5f2a25;
  --info: #93bdf0; --info-bg: #142336; --info-line: #24456e;
  --sim: #c5b0f5;  --sim-bg: #221b33;  --sim-line: #463568;

  --chart-1: color-mix(in oklab, var(--school-brand) 50%, #9fe0bf);
  --chart-2: color-mix(in oklab, var(--school-brand) 45%, #2b3530);

  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 2px 6px rgb(0 0 0 / 0.35), 0 12px 32px rgb(0 0 0 / 0.45);
  --shadow-3: 0 4px 12px rgb(0 0 0 / 0.4), 0 28px 64px rgb(0 0 0 / 0.55);
  color-scheme: dark;
}
