/* =============================================================================
   EduAI theme contract.

   THIS FILE IS THE CONTRACT. Nothing else invents a value.

   Rules that keep it that way:
     1. A component may only read tokens. It never writes a literal colour,
        radius, blur, shadow or duration.
     2. Every token has a default here, so a page renders correctly before the
        runtime has said anything — which is what stops the flash of unthemed
        content, and what makes a no-JS render legible rather than blank.
     3. The runtime overrides these from a <style> element, not this file and
        not the style attribute. See `runtime.ts` -> `apply()`.

   THE CASCADE, DECLARED ONCE
   --------------------------
   Five layers, in this order, plus one thing that is deliberately outside them:

     eduai.reset       box-sizing, margin zeroing, the things with no opinion
     eduai.tokens      this file, and the compiled <style> the runtime writes
     eduai.material    .mat / .mat-inset — how a surface is physically drawn
     eduai.components  .btn .field .badge .nav-item .table …
     eduai.app         application chrome (styles/app.css)
     eduai.overrides   the escape hatch, for the handful of genuine exceptions

   THE TENANT STYLESHEET IS UNLAYERED, ON PURPOSE. `GET /theme/{slug}.css` is
   served by the backend and linked into <head>; an unlayered rule outranks every
   layered one no matter how specific, so a tenant's white-label values win over
   all five layers without anyone having to reason about ordering. That is the
   correct precedence for it, and it is why this file declares layers at all.

   Scoping:
     [data-family="glass" | "traditional"]     which material
     [data-mode="light" | "dark"]              which palette
     [data-tier="auto" | "frost" | "clear"]    how hard the material may work
     [data-contrast="normal" | "more"]         the high-contrast role swap
   All four are stamped on <html> — three by the runtime, and `data-mode` also by
   the pre-boot script in index.html so the first paint is already correct.
   ========================================================================== */

@layer eduai.reset, eduai.tokens, eduai.material, eduai.components, eduai.app, eduai.overrides;

@layer eduai.tokens {
  :root {
    color-scheme: light dark;

    /* -------------------------------------------------------------------
       1. SEED
       The inputs. Change these and everything downstream moves with them.
       The colour seeds are consumed by `ramp.ts` in JavaScript rather than by
       CSS: deriving fourteen perceptual steps and then choosing between them
       by measured contrast is not something `calc()` can do.
       ------------------------------------------------------------------- */

    --seed-brand-l: 0.58; /* 0-1   lightness of step 500            */
    --seed-brand-c: 0.19; /* 0-0.4 chroma, clamped to sRGB per step */
    --seed-brand-h: 279; /*  0-360 hue                             */

    /* The PEAK of the neutral chroma envelope, not a constant. A grey cannot
       hold the same chroma at 97% lightness and at 15%; `ramp.ts` carries the
       shape. */
    --seed-neutral-c: 0.036;
    --seed-neutral-h: 277;

    /* Geometry */
    --seed-radius: 16px;
    /* Grid pitch of the glass backdrop rules (see material.css). The same in both
       modes, so it lives here rather than in the two mode blocks. */
    --bd-grid: 88px;
    /* liqui's fixed geometry, named once so the material reads tokens rather than numbers:
       the half-pixel spread of the rim's left catch-light, the frost tier's blur floor, and
       the line weights of the backdrop's rings and band. */
    --lq-rim-spread: 0.5px;
    --lq-frost-floor: 10px;
    --bd-ring-line: 1.5px;
    --bd-band-line: 2px;
    /* How far the page behind an open dialog is blurred in the glass family - the owner's
       own number for the dialog scrim (2026-09-29), restored on 2026-10-03. */
    --lq-scrim-blur: 4px;
    --seed-radius-scale: 1;
    --seed-density: 1;

    /* Type */
    --seed-font-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system,
      "Segoe UI", Roboto, sans-serif;
    --seed-font-display: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
    --seed-font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --seed-font-size: 16px;

    /* -------------------------------------------------------------------
       2. SPACE
       One 4px rhythm, multiplied by density. Every gap in the product is one
       of these eight; a ninth value is a bug, and `verify-tokens.mjs` counts
       them.
       ------------------------------------------------------------------- */
    --space-1: calc(4px * var(--seed-density));
    --space-2: calc(8px * var(--seed-density));
    --space-3: calc(12px * var(--seed-density));
    --space-4: calc(16px * var(--seed-density));
    --space-5: calc(20px * var(--seed-density));
    --space-6: calc(24px * var(--seed-density));
    --space-7: calc(32px * var(--seed-density));
    --space-8: calc(40px * var(--seed-density));
    /* The gap a page leaves under its last block, so content ends on purpose
       rather than at the fold. */
    --space-9: calc(56px * var(--seed-density));

    /* -------------------------------------------------------------------
       3. TYPE

       IN REM, ANCHORED ON THE SEED. `--seed-font-size` is expressed in px
       because that is what a person tuning it wants to type, but it is applied
       as a RATIO to the browser's own root size — so somebody who has set
       their browser to 20px gets a 25% larger interface, which is the single
       most effective low-vision accommodation there is and the one a px scale
       silently refuses.

       `--text-xs` carries most of the labels in this product, so it has a hard
       floor of 12px rather than being allowed to follow the ratio down. At a
       1.2 scale off a 16px body it would otherwise compute to 11.11px.
       ------------------------------------------------------------------- */
    --font-ratio: calc(var(--seed-font-size) / 16px);
    --text-unit: calc(var(--font-ratio) * 1rem);

    /* AN ANCHORED TABLE, NOT A RATIO CHAIN, and the reason is arithmetic rather
       than taste. The ramp this product is set to is 12, 13, 15, 17, 20, 22, 28,
       34, 44 - consecutive ratios of 1.083, 1.154, 1.133, 1.176, 1.100, 1.273,
       1.214, 1.294. A geometric sequence has exactly ONE ratio by definition, so
       no value of a scale knob reproduces those steps; the closest single ratio
       still misses the top of the ramp by six pixels and cannot reach the display
       size at all.

       Every step is still a multiple of `--text-unit`, so the seed's font size
       goes on scaling the whole ramp proportionally and a reader who has set a
       larger root size still gets a larger interface. What is gone is the
       constant-ratio knob, which could not express this ramp and now has nothing
       left to multiply. */
    --text-xs: calc(var(--text-unit) * 0.75);
    --text-sm: calc(var(--text-unit) * 0.8125);
    --text-base: calc(var(--text-unit) * 0.9375);
    --text-md: calc(var(--text-unit) * 1.0625);
    --text-lg: calc(var(--text-unit) * 1.25);
    --text-xl: calc(var(--text-unit) * 1.375);
    --text-2xl: calc(var(--text-unit) * 1.75);
    --text-3xl: calc(var(--text-unit) * 2.125);

    /* Display steps. A heading that leads a page is not the same job as the
       largest body step, and clamp() is what lets one value serve a phone and
       a desktop without a breakpoint. */
    --text-display: clamp(var(--text-3xl), calc(var(--text-xl) + 3vw), calc(var(--text-unit) * 2.75));
    --text-display-lg: clamp(var(--text-3xl), calc(var(--text-2xl) + 5vw), calc(var(--text-unit) * 3.5));

    /* Line height belongs to the step, not to the element. Small text needs
       proportionally more leading than large text, which is why one global
       line-height makes headings look loose and captions look tight. */
    --leading-tight: 1.04;
    --leading-snug: 1.25;
    --leading-body: 1.45;
    --leading-relaxed: 1.6;

    /* Optical tracking: the larger the step, the tighter it is set. One value
       cannot serve a 44px heading and a 13px label. */
    --tracking-display: -0.028em;
    --tracking-3xl: -0.022em;
    --tracking-2xl: -0.018em;
    --tracking-xl: -0.014em;
    --tracking-tight: -0.02em;
    --tracking-snug: -0.01em;
    --tracking-normal: 0;
    --tracking-label: 0.06em;

    --weight-body: 400;
    --weight-medium: 500;
    --weight-strong: 600;
    --weight-bold: 700;

    /* The reading measure. Long-form text set across a full-width container is
       unreadable however good the type is. */
    --measure-prose: 68ch;
    /* The sentence under a page title. The prototype caps it at 56ch so the lede
       is a paragraph rather than a line running the width of the screen. */
    --measure-lede: 56ch;
    --measure-narrow: 46ch;

    /* -------------------------------------------------------------------
       4. RADIUS

       NAMESPACED `--r-*`, AND THIS IS NOT COSMETIC. The backend's white-label
       stylesheet emits `--radius-sm`, `--radius-md` and `--radius-lg` with
       hard pixel values from a four-option enum. Those names used to be this
       scale's own, so a tenant froze three of five radii and left `--radius-xs`
       and `--radius-xl` still derived from the seed — producing a scale where
       `sm` could be smaller than `xs`.

       So the scale lives under `--r-*`, and the tenant's `--radius-md` is read
       as the ANCHOR the whole scale hangs from. A tenant choosing "Large" now
       re-proportions every radius in the product, monotonically, instead of
       overriding three of them.
       ------------------------------------------------------------------- */
    /* THE ANCHOR IS THE DESIGN'S, NOT THE TENANT'S, and that is a decision rather
       than an oversight. This scale used to hang from the white-label sheet's
       `--radius-md`, so a tenant that had picked "Small" got a 8px anchor and the
       whole product re-proportioned around it - which was right while the theme
       was derived, and is wrong now that it is drawn. The same call was already
       made for colour when the roles were pinned; leaving radius tenant-movable
       would mean one product with two answers to who owns its shape.

       The white-label sheet still arrives and its other custom properties still
       apply; this scale simply no longer reads its radius. */
    --r-anchor: calc(var(--seed-radius) * var(--seed-radius-scale));
    --r-xs: calc(var(--r-anchor) * 0.375);
    --r-sm: calc(var(--r-anchor) * 0.625);
    --r-md: var(--r-anchor);
    --r-lg: calc(var(--r-anchor) * 1.375);
    --r-xl: calc(var(--r-anchor) * 1.75);
    --r-2xl: calc(var(--r-anchor) * 2.75);
    --r-pill: 999px;
    --r-circle: 50%;

    /* -------------------------------------------------------------------
       5. SIZING
       Control heights track density AND type, so a dense theme produces a
       genuinely dense control rather than a short one with the same text in it.
       Every step clears the 24px WCAG 2.5.8 floor; `md` upward clears 44px on
       touch once padding is counted.
       ------------------------------------------------------------------- */
    /* The ladder the signed-off design is set on. `md` is the size almost every
       control in the product takes - a row, a button, a field - and it is 34px
       there rather than 40. The steps either side keep their proportions, so a
       tenant moving density still moves all five together. */
    --control-xs: calc(24px * var(--seed-density));
    --control-sm: calc(30px * var(--seed-density));
    --control-md: calc(34px * var(--seed-density));
    --control-lg: calc(42px * var(--seed-density));
    --control-xl: calc(50px * var(--seed-density));

    --icon-xs: 12px;
    --icon-sm: 16px;
    --icon-md: 20px;
    --icon-lg: 24px;
    --icon-xl: 32px;

    --avatar-sm: 24px;
    --avatar-md: 32px;
    --avatar-lg: 40px;
    --avatar-xl: 64px;
    /* The profile page reads its own avatar at this size; it is a real step of the
       scale rather than a one-off, so it lives here with the rest. */
    --avatar-2xl: 96px;

    /* The smallest a hit target may be, anywhere. Read it rather than
       remembering it. */
    --target-min: 24px;
    --target-comfortable: 44px;

    /* Component geometry that is a decision rather than a step of a scale. Each of these
       was typed into `components.css` and repeated, and each is fixed rather than
       density-scaled on purpose: `--control-*` and `--space-*` are
       `calc(N * var(--seed-density))`, so mapping any of these onto one would hold only
       at the shipped default and drift the moment a tenant changed density.

       Values are unchanged from the literals they replace - this names them, it does not
       retune them. */
    --spinner-stroke: 2px;    /* one ring stroke, across all three spinner diameters   */
    --focus-glow-spread: 3px; /* the reinforcement glow, NOT --focus-ring-width, which  
                                 is the indicator itself and is already a token         */
    --dot-size: 6px;          /* the badge status dot                                   */
    --meter-track: 6px;       /* a progress track. Same number as the dot and a         
                                 different decision - do not fold them                  */
    --rule-accent: 2px;       /* a shared rule width: blockquote, callout, proof item   */
    --rail-w: 3px;            /* an accent rail: beside the CURRENT navigation row and  
                                 down the leading edge of an alert - the prototype draws
                                 both at 3. Not --rule-accent, which is a border width  
                                 four other components share at 2                       */
    --rail-nav-gap: 4px;      /* how far into the gutter that rail sits                 */
    --chip-pad-y: 2px;        /* a chip is shorter than the space scale can say: half of
                                 --space-1 would scale with density and this must not   */

    /* The switch, whose four numbers only make sense together. The travel is what is
       left when the thumb and its insets come out of the track: with border-box sizing
       and a 1px border each side, 40 - 2 - 18 - 2 - 2 = 16. Change one and the arithmetic
       has to be redone, which is the reason they sit in one block. */
    --switch-track-w: 40px;
    --switch-thumb: 18px;
    --switch-inset: 2px;
    --switch-travel: 16px;

    /* -------------------------------------------------------------------
       6. LAYERING
       A z-index scale exists so that "what sits above what" is a decision made
       once, here, rather than by whoever most recently needed their thing on
       top.
       ------------------------------------------------------------------- */
    /* A LAYER MAP OF THIS APP, not a generic ladder.
       The textbook scale puts `dropdown` below `sticky`, which is wrong the
       moment a menu is anchored inside sticky chrome — and every menu here is:
       the account menu and the notification panel both open out of the topbar.
       The order below is the one the product actually needs, read off the
       shell, so a new surface has somewhere true to sit instead of picking a
       number that happens to work. */
    --z-behind: -1; /*   decorative fills painted under their own section     */
    --z-base: 0;
    --z-raised: 1;
    --z-topbar: 15; /*   sticky page chrome                                   */
    --z-sidebar: 20; /*  the rail, which overlaps the topbar                  */
    --z-dropdown: 30; /* menus and panels anchored INSIDE that chrome         */
    --z-scrim: 35; /*    the dim behind a drawer or a dialog                  */
    --z-drawer: 40; /*   the mobile navigation drawer, above its own scrim    */
    --z-modal: 50;
    --z-popover: 60;
    --z-toast: 70;
    --z-tooltip: 80;
    --z-skip: 90; /*     the skip link — reachable over everything but…       */
    --z-banner: 100; /*  …the impersonation banner, which the contract calls
                         unmissable and which must survive any overlay        */

    /* -------------------------------------------------------------------
       7. BREAKPOINTS AND CONTAINERS
       Custom properties cannot be used in a media query, so these are
       documentation with one job: every @media in the product quotes one of
       these numbers and no others.
       ------------------------------------------------------------------- */
    --bp-sm: 640px;
    --bp-md: 768px;
    --bp-lg: 1024px;
    --bp-xl: 1280px;
    --bp-2xl: 1536px;

    --container-sm: 40rem;
    --container-md: 48rem;
    --container-lg: 64rem;
    --container-xl: 78rem;
    --container-prose: var(--measure-prose);

    /* -------------------------------------------------------------------
       8. OPACITY
       Named, because `0.45` appearing in four files is four decisions nobody
       made together.
       ------------------------------------------------------------------- */
    --opacity-disabled: 0.45;
    --opacity-muted: 0.6;
    --opacity-loading: 0.7;
    --opacity-ghost: 0.04;
    --opacity-hover: 0.08;
    --opacity-pressed: 0.12;
    --opacity-selected: 0.16;

    /* -------------------------------------------------------------------
       9. MOTION
       One duration scale and three curves. `--motion-scale: 0` disables every
       transition in the system without touching a component.

       It does NOT stop the loading spinner, and that is deliberate: reduced
       motion means replace the animation, not remove the feedback. Anything
       that tells a person the system is still working reads
       `--dur-indicator`, which never scales.
       ------------------------------------------------------------------- */
    --motion-scale: 1;
    --dur-instant: calc(70ms * var(--motion-scale));
    --dur-fast: calc(120ms * var(--motion-scale));
    --dur-base: calc(240ms * var(--motion-scale));
    --dur-slow: calc(420ms * var(--motion-scale));
    --dur-indicator: 900ms;

    --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: linear(
      0, 0.15 3.3%, 0.55 9.4%, 0.85 15%, 1.02 21%, 1.06 26%, 1.03 33%, 0.99 43%, 1 60%, 1
    );

    /* Enter and exit are not symmetric. A thing arriving should take its time;
       a thing leaving should get out of the way. */
    --dur-enter: var(--dur-base);
    --dur-exit: var(--dur-fast);

    /* -------------------------------------------------------------------
       10. FOCUS
       One ring, defined once, never removed. `--focus-ring` is a COLOUR chosen
       by the runtime as the first brand step clearing 3:1 against the worst
       surface it can land on — not the brand itself, which is a fill.
       ------------------------------------------------------------------- */
    --focus-ring-width: 2px;
    --focus-ring-offset: 2px;
    --focus-ring: var(--brand);

    /* -------------------------------------------------------------------
       11. ACCESSIBILITY
       Set by the runtime from the OS, or forced in the studio.
       ------------------------------------------------------------------- */
    --a11y-contrast-boost: 0;
    --a11y-reduce-transparency: 0;

    /* Baked surface alphas, folded through the preference above.
       `.mat` folds its own inline because its alpha is a knob. Every other
       translucent surface bakes a CONSTANT — and a constant cannot honour a
       preference on its own, which is how the account menu and thirty-one
       insets stayed 70-78% see-through at the far end of the slider while the
       material behind them went solid.
       Each is A + (1 - A) x reduce: the designed alpha at 0, genuinely opaque
       at 1. */
    --a11y-mix-14: calc((0.14 + 0.86 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-16: calc((0.16 + 0.84 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-18: calc((0.18 + 0.82 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-22: calc((0.22 + 0.78 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-25: calc((0.25 + 0.75 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-28: calc((0.28 + 0.72 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-30: calc((0.30 + 0.70 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-32: calc((0.32 + 0.68 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-40: calc((0.40 + 0.60 * var(--a11y-reduce-transparency)) * 100%);
    --a11y-mix-55: calc((0.55 + 0.45 * var(--a11y-reduce-transparency)) * 100%);

    /* The two colours a material is made of, as bare channel triples so an alpha can
       ride on them: `rgb(var(--light-rgb) / <alpha>)`. Both families read them and so
       does `components.css`, which is why they sit above the family sections rather
       than inside either one.

       They are tokens rather than literals because this theme already proves the dark
       one is a decision: `--scrim` is `rgb(9 11 20 / ...)` in light and `rgb(0 0 3 / ...)`
       in dark. A shadow that is flatly `0 0 0` is a choice made once, not an absence of
       choice. These are static contract values, NOT knobs — nothing in `SolidMaterial`
       or `knobs.ts` writes them, so `compile()` never emits them and a tenant cannot
       warm its shadows today. What they buy is the precondition: the decision is in one
       place instead of typed into thirty box-shadows, so wiring a knob later is an edit
       here rather than a sweep. */
    --light-rgb: 255 255 255;
    --shadow-rgb: 0 0 0;

    /* -------------------------------------------------------------------
       12. MATERIAL — glass

       These do nothing under [data-family="traditional"]. They are declared at
       :root so the studio can always read and write them.
       ------------------------------------------------------------------- */

    /* Backdrop optics */
    --glass-blur: 4px;
    --glass-saturate: 130%;
    --glass-brightness: 100%;
    --glass-contrast: 100%;

    /* Tint — the colour of the glass itself, over the blurred backdrop.
       `thick` is the sidebar and `sheet` a dialog: thickness is not height, so
       neither is an elevation step. A dialog is the most TRANSPARENT surface
       here, because the scrim under it already separates it from the page. */
    --glass-tint: #ffffff;
    --glass-tint-alpha: 0;
    --glass-tint-alpha-thick: 0;
    --glass-tint-alpha-sheet: 0;

    /* Rim. A real edge has a bright top and a darker underside; that single
       asymmetry is most of what makes glass read as glass rather than as a
       translucent rectangle. Decoration only — the STRUCTURAL boundary of a
       control is `--control-border`, which is contrast-locked. */
    --glass-rim-width: 1px;
    --glass-edge-alpha: 0;
    --glass-rim-top-alpha: 0;
    --glass-rim-bottom-alpha: 0.08;

    /* Hover and press deltas.
       SEPARATE PROPERTIES, NOT SELF-REFERENCES, and this is a bug fix rather
       than a preference: `--glass-tint-alpha: calc(var(--glass-tint-alpha) +
       0.08)` is a dependency cycle. Every property in a cycle computes to the
       guaranteed-invalid value, so the declaration did not brighten the tint —
       it deleted it, and took the entire five-layer box-shadow with it.
       Measured in Chrome 148: background-color became rgba(0, 0, 0, 0) and
       box-shadow became none. */
    --glass-tint-delta: 0;
    --glass-rim-top-delta: 0;
    --glass-shadow-2-boost: 1;

    /* Sheen — a slow diagonal gradient across the face. Keep it low; this is
       the knob most likely to tip the effect into looking cheap. */
    --glass-sheen-alpha: 0.08;
    --glass-sheen-angle: 120deg;
    --glass-sheen-size: 155%;

    /* Grain. A little breaks up backdrop-filter's banding on wide gradients. */
    --glass-noise-alpha: 0.018;

    /* Elevation. Two layers: a tight contact shadow and a wide ambient one. */
    --glass-shadow-1-y: 1px;
    --glass-shadow-1-blur: 2px;
    --glass-shadow-1-alpha: 0.06;
    --glass-shadow-2-y: 14px;
    --glass-shadow-2-blur: 36px;
    --glass-shadow-2-alpha: 0.12;
    --glass-shadow-2-spread: -20px;

    /* Refraction. Written per element by the driver in `refraction/`, because
       a displacement map is a function of the surface's own pixel size and
       corner radius and cannot be expressed as a static value. The empty
       fallback is load-bearing: `var(--glass-lens, )` contributes nothing to
       the filter list on a surface the driver has not reached. */
    --glass-refract: 201px;
    --glass-bezel: 26px;
    --glass-dispersion: 0;
    --glass-specular: 0.85;
    --glass-lens: ;
    --glass-specular-image: none;

    /* Corner smoothing — squircles rather than circular arcs. Progressive:
       ignored where corner-shape is unsupported. */
    --glass-corner-smooth: 0.8;

    /* -------------------------------------------------------------------
       13. MATERIAL — traditional
       ------------------------------------------------------------------- */
    --solid-border-width: 1px;
    --solid-border-alpha: 1;
    --solid-shadow-1-y: 1px;
    --solid-shadow-1-blur: 2px;
    --solid-shadow-1-alpha: 0.05;
    --solid-shadow-2-y: 4px;
    --solid-shadow-2-blur: 12px;
    --solid-shadow-2-alpha: 0.08;
  }

  /* ===========================================================================
     SEMANTIC ROLES

     The only thing components are allowed to read.

     EVERY VALUE BELOW IS GENERATED. They are the output of `compile()` for the
     shipped seed, written here as literals so the very first paint — before any
     JavaScript has run — is already the correct theme rather than a guess that
     the runtime then corrects. `scripts/verify-palette.mjs --check-defaults`
     asserts they still match what the compiler produces; if you edit one by
     hand, that gate is what will catch you.

     Which step each role is is NOT fixed. Roles carrying a contrast obligation
     are chosen by measurement against the surface they sit on — see the header
     of `runtime.ts`. The numbers here are what that search returned for this
     seed, not a mapping anyone can rely on for another one.
     ======================================================================== */

  :root,
  [data-mode="light"] {
    /* --- the liqui glass material (owner, 2026-10-03) -----------------------
       The values liqui ships (`@liqui-design/glass` tokens and liqui's own site
       globals), so a glass surface here reads as the prototype the owner
       approved in `Claude outputs/glass-prototype/`. `material.css` composes
       them; nothing else reads them. A 135-degree tint from `--lq-tint` to
       `--lq-tint-deep`, a one-pixel catch-light rim, a two-layer shadow on
       elevated surfaces only, and the denser wash the clear tier and every
       nested pane fall back on because they have no blur to hide behind. */
    --lq-tint: rgb(255 255 255 / 0.48);
    --lq-tint-deep: rgb(255 255 255 / 0.14);
    --lq-wash: rgb(255 255 255 / 0.55);
    --lq-wash-deep: rgb(255 255 255 / 0.42);
    --lq-rim-hi: rgb(255 255 255 / 0.85);
    --lq-rim-lo: rgb(255 255 255 / 0.28);
    --lq-highlight: rgb(255 255 255 / 0.5);
    --lq-shadow: 0 24px 60px rgb(10 15 40 / 0.35), 0 4px 14px rgb(10 15 40 / 0.18);
    /* The near layer of liqui's shadow alone, for chrome that sits directly above content
       (see `.shell__topbar` in app.css). */
    --lq-shadow-near: 0 4px 14px rgb(10 15 40 / 0.18);
    /* ⚠ OUR SCRIM, NOT liqui's, IN LIGHT MODE ONLY. liqui's light scrim is a 32% dim; ours
       is 14%. Under the light dialog that difference is the whole contrast budget: with
       liqui's, the frosted ground behind the dialog's text measured L 0.415 on the render
       and every secondary label fell to about 3:1. Dark mode keeps liqui's - it passes there. */
    --lq-scrim: var(--scrim);

    /* The page behind the glass - liqui's backdrop. Refraction and frost only read
       as glass where there is something behind them with edges: a near-white
       ground, four soft colour fields and still rules. Glass family only; see
       `GlassBackdrop.tsx`. */
    --bd-base: oklch(0.965 0.014 255);
    --bd-aurora-1: oklch(0.88 0.095 255);
    --bd-aurora-2: oklch(0.9 0.085 325);
    --bd-aurora-3: oklch(0.91 0.085 195);
    --bd-aurora-4: oklch(0.94 0.08 85);
    --bd-rule: oklch(0.45 0.09 265 / 0.13);
    --bd-rule-strong: oklch(0.4 0.11 265 / 0.15);
    --bd-vignette: oklch(0.35 0.06 265 / 0.1);
    /* Held back in light mode, as liqui holds it: where two fields overlap, the
       composite drops far enough that small body text over it would miss AA. */
    --bd-aurora-strength: 0.72;

    --bg: #f5f6fb;
    --bg-elevated: #ffffff;
    --surface-1: #ffffff;
    --surface-2: #e8ebf5;
    --surface-3: #d8dbeb;
    --surface-sunken: #e8ebf5;

    --text: #181a29;
    --text-secondary: #53576d;
    --text-tertiary: #6a6f85;
    --text-disabled: #868ba2;

    /* The placeholder inside a field, and the one quiet grey in the system that
       is deliberately NEUTRAL rather than tinted. Every other text tier carries
       the same blue the surfaces do; a placeholder read as a tinted ghost of the
       value rather than as absent text, which is the one thing it has to say.

       Its own token, not `--text-tertiary`, for two reasons. The tertiary tier is
       also a border and a caption colour, so moving it to neutral would repaint
       far more than this; and inside a `.mat` the tertiary role resolves to the
       secondary one (material.css) because the tier measured 4.08 over a
       decorative backdrop - a placeholder that followed that mapping would change
       colour depending on which surface it sat on.

       Measured, not assumed: 5.41:1 on --surface-1 and 4.54:1 on
       --surface-2. The same lightness as the tinted #6a6f85 it replaces, so this
       is the tint removed and nothing else. */
    --field-placeholder: #6a6a6a;

    /* The focus indicator on a FIELD only — its border and the glow that
       reinforces it. Neutral grey rather than the brand blue, so that focus on an
       input is not read as the input being in a brand-coloured state; buttons and
       links keep `--focus-ring`.

       ⚠ THIS IS AN ACCESSIBILITY INDICATOR, NOT DECORATION. 1.4.11 wants 3:1
         against what surrounds it, and this file already carries the scar: the rule
         it replaced put a 1px brand border at 1.32:1 and keyboard focus was
         effectively invisible. Any future value here is measured before it ships.

       Measured: 5.41:1 on --surface-1, 4.54:1 on --surface-2.
       The owner's #b7b7b7 measures 2.01:1 here and fails the 3:1 floor, so the
       light mode takes the same neutral one tier darker. */
    --field-focus-ring: #6a6a6a;

    --border: #d8dbeb;
    --border-subtle: #e8ebf5;
    --border-strong: #c0c4d9;
    /* The visible edge of an input or a button. 1.4.11 requires 3:1 and a
       decorative hairline cannot carry that, which is why this is not
       `--border`. Measured 3.38:1 on --surface-1. */
    --control-border: #868ba2;

    --brand: #6766e7;
    --brand-hover: #5956d5;
    --brand-active: #4d45c4;
    --brand-subtle: color-mix(in oklab, #6766e7 12%, transparent);
    --brand-border: color-mix(in oklab, #6766e7 32%, transparent);
    --text-on-brand: #ffffff;
    --brand-strong: #5956d5;
    --brand-text: #5956d5;

    --success: #2b9245;
    --success-hover: #0a7f32;
    --success-active: #006a27;
    --success-subtle: color-mix(in oklab, #2b9245 12%, transparent);
    --success-border: color-mix(in oklab, #2b9245 32%, transparent);
    --text-on-success: #090b14;
    --success-strong: #006a27;
    --success-text: #0a7f32;

    --warning: #b18100;
    --warning-hover: #9a7000;
    --warning-active: #855f00;
    --warning-subtle: color-mix(in oklab, #b18100 12%, transparent);
    --warning-border: color-mix(in oklab, #b18100 32%, transparent);
    --text-on-warning: #090b14;
    --warning-strong: #855f00;
    --warning-text: #855f00;

    --danger: #d9373a;
    --danger-hover: #c6202a;
    --danger-active: #b3001b;
    --danger-subtle: color-mix(in oklab, #d9373a 12%, transparent);
    --danger-border: color-mix(in oklab, #d9373a 32%, transparent);
    --text-on-danger: #ffffff;
    --danger-strong: #c6202a;
    --danger-text: #c6202a;

    --info: #006bc1;
    --info-hover: #005da9;
    --info-active: #004f90;
    --info-subtle: color-mix(in oklab, #006bc1 12%, transparent);
    --info-border: color-mix(in oklab, #006bc1 32%, transparent);
    --text-on-info: #ffffff;
    --info-strong: #005da9;
    --info-text: #006bc1;

    --focus-ring: #6766e7;

    /* What glass tints toward in this mode, and how hard the rim reads. */
    --glass-tint: #ffffff;
    --glass-tint-alpha: 0;
    --glass-rim-top-alpha: 0.95;
    --glass-rim-bottom-alpha: 0.08;
    --glass-sheen-alpha: 0.08;
    --glass-noise-alpha: 0.018;
    --glass-shadow-2-alpha: 0.12;

    /* The dim behind a dialog and behind the phone drawer. Dark ink in BOTH
       modes - a scrim's job is to push the page back, and a light scrim over a
       light page does not. Only the strength is mode-aware: the prototype dims a
       light page by 14 and a dark one by 28, because a light page needs half the
       push-back. It folds reduce-transparency like every other translucent
       surface. This token was defined at 55 and read by nothing; the dialog was
       writing its own 28 inline in both modes. */
    --scrim: color-mix(in oklab, var(--p-neutral-1000) var(--a11y-mix-14), transparent);
  }

  [data-mode="dark"] {
    /* The liqui glass material, dark. See the light block for what each one is. */
    --lq-tint: rgb(30 32 46 / 0.62);
    --lq-tint-deep: rgb(18 20 32 / 0.4);
    --lq-wash: rgb(30 32 46 / 0.52);
    --lq-wash-deep: rgb(18 20 32 / 0.47);
    --lq-rim-hi: rgb(255 255 255 / 0.5);
    --lq-rim-lo: rgb(255 255 255 / 0.12);
    --lq-highlight: rgb(255 255 255 / 0.18);
    --lq-shadow: 0 24px 60px rgb(0 0 5 / 0.55), 0 4px 14px rgb(0 0 5 / 0.35);
    --lq-shadow-near: 0 4px 14px rgb(0 0 5 / 0.35);
    --lq-scrim: rgb(0 0 6 / 0.48);

    --bd-base: oklch(0.155 0.028 268);
    --bd-aurora-1: oklch(0.44 0.17 268);
    --bd-aurora-2: oklch(0.4 0.16 328);
    --bd-aurora-3: oklch(0.42 0.13 205);
    --bd-aurora-4: oklch(0.36 0.1 60);
    --bd-rule: oklch(0.97 0.02 265 / 0.1);
    --bd-rule-strong: oklch(0.99 0.01 265 / 0.2);
    --bd-vignette: oklch(0.06 0.02 265 / 0.45);
    --bd-aurora-strength: 1;

    --bg: #090b14;
    --bg-elevated: #181a29;
    --surface-1: #181a29;
    --surface-2: #2a2c3e;
    --surface-3: #3c4053;
    --surface-sunken: #090b14;

    --text: #f5f6fb;
    --text-secondary: #c0c4d9;
    --text-tertiary: #868ba2;
    --text-disabled: #6a6f85;

    /* The placeholder inside a field, and the one quiet grey in the system that
       is deliberately NEUTRAL rather than tinted. Every other text tier carries
       the same blue the surfaces do; a placeholder read as a tinted ghost of the
       value rather than as absent text, which is the one thing it has to say.

       Its own token, not `--text-tertiary`, for two reasons. The tertiary tier is
       also a border and a caption colour, so moving it to neutral would repaint
       far more than this; and inside a `.mat` the tertiary role resolves to the
       secondary one (material.css) because the tier measured 4.08 over a
       decorative backdrop - a placeholder that followed that mapping would change
       colour depending on which surface it sat on.

       Measured, not assumed: 8.30:1 on the composited field ground in the
       glass rail, rgb(20 31 44). Owner's value, 2026-09-30. */
    --field-placeholder: #b7b7b7;

    /* The focus indicator on a FIELD only — its border and the glow that
       reinforces it. Neutral grey rather than the brand blue, so that focus on an
       input is not read as the input being in a brand-coloured state; buttons and
       links keep `--focus-ring`.

       ⚠ THIS IS AN ACCESSIBILITY INDICATOR, NOT DECORATION. 1.4.11 wants 3:1
         against what surrounds it, and this file already carries the scar: the rule
         it replaced put a 1px brand border at 1.32:1 and keyboard focus was
         effectively invisible. Any future value here is measured before it ships.

       Measured: 8.30:1 on the composited field ground in the
       glass rail and 9.30:1 on the page behind it — stronger than the #4f88ff it
       replaces, which measured 4.99:1 and 5.59:1. Owner's value, 2026-09-30. */
    --field-focus-ring: #b7b7b7;

    --border: #3c4053;
    --border-subtle: #2a2c3e;
    --border-strong: #53576d;
    --control-border: #6a6f85;

    --brand: #8287ff;
    --brand-hover: #9ea6ff;
    --brand-active: #bcc3ff;
    --brand-subtle: color-mix(in oklab, #8287ff 18%, transparent);
    --brand-border: color-mix(in oklab, #8287ff 40%, transparent);
    /* Near-black, not white. White on this brand measures 3.09:1. */
    --text-on-brand: #090b14;
    --brand-strong: #8287ff;
    --brand-text: #8287ff;

    --success: #5dbf70;
    --success-hover: #73d584;
    --success-active: #88eb98;
    --success-subtle: color-mix(in oklab, #5dbf70 18%, transparent);
    --success-border: color-mix(in oklab, #5dbf70 40%, transparent);
    --text-on-success: #090b14;
    --success-strong: #5dbf70;
    --success-text: #5dbf70;

    --warning: #cd9926;
    --warning-hover: #e4af43;
    --warning-active: #fbc55b;
    --warning-subtle: color-mix(in oklab, #cd9926 18%, transparent);
    --warning-border: color-mix(in oklab, #cd9926 40%, transparent);
    --text-on-warning: #090b14;
    --warning-strong: #cd9926;
    --warning-text: #cd9926;

    --danger: #fb5856;
    --danger-hover: #ff8981;
    --danger-active: #ffb2ab;
    --danger-subtle: color-mix(in oklab, #fb5856 18%, transparent);
    --danger-border: color-mix(in oklab, #fb5856 40%, transparent);
    --text-on-danger: #090b14;
    --danger-strong: #fb5856;
    --danger-text: #fb5856;

    --info: #3b99f8;
    --info-hover: #6db3ff;
    --info-active: #9fccff;
    --info-subtle: color-mix(in oklab, #3b99f8 18%, transparent);
    --info-border: color-mix(in oklab, #3b99f8 40%, transparent);
    --text-on-info: #090b14;
    --info-strong: #3b99f8;
    --info-text: #3b99f8;

    --focus-ring: #8287ff;

    /* Dark glass is a different material, not the same one inverted. It tints
       toward black, the rim carries almost all the definition, and the ambient
       shadow deepens because there is less contrast to separate it from the
       page. */
    --glass-tint: #181a29;
    --glass-blur: 4px;
    --glass-saturate: 130%;
    --glass-tint-alpha: 0;
    --glass-brightness: 100%;
    --glass-contrast: 100%;
    --glass-edge-alpha: 0;
    --glass-rim-top-alpha: 0;
    --glass-rim-bottom-alpha: 0.05;
    --glass-sheen-alpha: 0.05;
    --glass-noise-alpha: 0.022;
    --glass-shadow-1-alpha: 0.1;
    --glass-shadow-2-y: 18px;
    --glass-shadow-2-blur: 50px;
    --glass-shadow-2-alpha: 0.38;
    --glass-refract: 201px;
    --glass-bezel: 26px;
    --glass-specular: 0.85;

    --solid-shadow-1-alpha: 0.2;
    --solid-shadow-2-blur: 16px;
    --solid-shadow-2-alpha: 0.28;

    --scrim: color-mix(in oklab, var(--p-neutral-1000) var(--a11y-mix-28), transparent);
  }

  /* ===========================================================================
     HIGH CONTRAST

     A ROLE SWAP, NOT AN ALPHA NUDGE. The previous mechanism raised two border
     alphas, which cannot move any text pairing across 4.5 — and its traditional
     arm was algebraically inert, because the shipped presets set
     `--solid-border-alpha: 1` and `1 + boost x (1 - 1)` is 1 for every boost.
     Somebody who turns on "increase contrast" got nothing.

     Here the roles that carry text are repointed at steps further along their
     own ramps, which is the only change that can actually move a ratio.
     ======================================================================== */

  [data-contrast="more"] {
    --focus-ring-width: 3px;
  }

  [data-contrast="more"][data-mode="light"],
  [data-mode="light"] [data-contrast="more"] {
    --text-secondary: #181a29;
    --text-tertiary: #53576d;
    --text-disabled: #6a6f85;

    /* The placeholder inside a field, and the one quiet grey in the system that
       is deliberately NEUTRAL rather than tinted. Every other text tier carries
       the same blue the surfaces do; a placeholder read as a tinted ghost of the
       value rather than as absent text, which is the one thing it has to say.

       Its own token, not `--text-tertiary`, for two reasons. The tertiary tier is
       also a border and a caption colour, so moving it to neutral would repaint
       far more than this; and inside a `.mat` the tertiary role resolves to the
       secondary one (material.css) because the tier measured 4.08 over a
       decorative backdrop - a placeholder that followed that mapping would change
       colour depending on which surface it sat on.

       Measured, not assumed: 7.69:1 on --surface-1, 6.46:1 on
       --surface-2. The neutral of the #53576d this block already raises to. */
    --field-placeholder: #535353;

    /* The focus indicator on a FIELD only — its border and the glow that
       reinforces it. Neutral grey rather than the brand blue, so that focus on an
       input is not read as the input being in a brand-coloured state; buttons and
       links keep `--focus-ring`.

       ⚠ THIS IS AN ACCESSIBILITY INDICATOR, NOT DECORATION. 1.4.11 wants 3:1
         against what surrounds it, and this file already carries the scar: the rule
         it replaced put a 1px brand border at 1.32:1 and keyboard focus was
         effectively invisible. Any future value here is measured before it ships.

       Measured: 6.90:1 on --surface-1, 5.79:1 on --surface-2. */
    --field-focus-ring: #5a5a5a;
    --border: #868ba2;
    --border-subtle: #c0c4d9;
    --border-strong: #53576d;
    --control-border: #53576d;
    --brand-text: #4d45c4;
    --success-text: #006a27;
    --warning-text: #855f00;
    --danger-text: #b3001b;
    --info-text: #004f90;
  }

  [data-contrast="more"][data-mode="dark"] {
    --text-secondary: #f5f6fb;
    --text-tertiary: #c0c4d9;
    --text-disabled: #868ba2;

    /* The placeholder inside a field, and the one quiet grey in the system that
       is deliberately NEUTRAL rather than tinted. Every other text tier carries
       the same blue the surfaces do; a placeholder read as a tinted ghost of the
       value rather than as absent text, which is the one thing it has to say.

       Its own token, not `--text-tertiary`, for two reasons. The tertiary tier is
       also a border and a caption colour, so moving it to neutral would repaint
       far more than this; and inside a `.mat` the tertiary role resolves to the
       secondary one (material.css) because the tier measured 4.08 over a
       decorative backdrop - a placeholder that followed that mapping would change
       colour depending on which surface it sat on.

       Measured, not assumed: 9.15:1 on the same field ground as the dark
       block above, one step up from its 8.30:1, which is what this block is for. */
    --field-placeholder: #c0c0c0;

    /* The focus indicator on a FIELD only — its border and the glow that
       reinforces it. Neutral grey rather than the brand blue, so that focus on an
       input is not read as the input being in a brand-coloured state; buttons and
       links keep `--focus-ring`.

       ⚠ THIS IS AN ACCESSIBILITY INDICATOR, NOT DECORATION. 1.4.11 wants 3:1
         against what surrounds it, and this file already carries the scar: the rule
         it replaced put a 1px brand border at 1.32:1 and keyboard focus was
         effectively invisible. Any future value here is measured before it ships.

       Measured: 9.15:1 on the same field ground as the dark
       block, one step up from its 8.30:1. */
    --field-focus-ring: #c0c0c0;
    --border: #6a6f85;
    --border-subtle: #53576d;
    --border-strong: #868ba2;
    --control-border: #868ba2;
    --brand-text: #9ea6ff;
    --success-text: #73d584;
    --warning-text: #e4af43;
    --danger-text: #ff8981;
    --info-text: #6db3ff;
  }

  /* ===========================================================================
     THE TENANT ADAPTER

     `GET /theme/{slug}.css` emits a vocabulary of its own — nineteen properties
     under `--color-*`, `--radius-*` and `--font-*`. Sixteen of them used to be
     read by nothing at all, which meant a school could pick a brand colour, see
     it saved, see it published, and watch nothing on the screen change.

     This is the seam. Each line takes the server's name if it is present and
     this system's own value if it is not, so the white-label contract is
     honoured without the rest of the theme having to know it exists.

     The colour lines are the FALLBACK path, for the moment before the runtime
     has read the tenant's hex — it converts `--color-primary` back into a seed
     and generates a whole coherent ramp from it, so a tenant gets matching
     hovers, badges, subtle fills and a contrast-checked link colour rather than
     one flat overridden step. See `runtime.ts` -> `seedFromTenantBrand`.
     ======================================================================== */

  :root {
    --brand: var(--color-primary, #6766e7);
    --text-on-brand: var(--color-on-primary, #ffffff);
    --surface-1: var(--color-surface, #ffffff);
    --bg-elevated: var(--color-surface, #ffffff);
    --text: var(--color-text, #181a29);
    --seed-font-body: var(--font-body, "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif);
    --seed-font-display: var(--font-heading, "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif);
  }

  [data-mode="dark"] {
    /* A tenant picks one brand colour and one surface, both chosen against a
       light page — applying them to the dark theme would produce a white
       surface in dark mode. Only the brand carries over, and the runtime
       re-derives its dark step from the same seed. */
    --surface-1: #181a29;
    --bg-elevated: #181a29;
    --text: #f5f6fb;
    --brand: #8287ff;
    --text-on-brand: #090b14;
  }

  /* ===========================================================================
     THE OPERATING SYSTEM

     These are a genuine fallback layer now. They used to be unreachable:
     `apply()` wrote every compiled property to the style attribute, and an
     inline declaration outranks every author rule — so the three preferences
     below were overwritten by the tenant's defaults on the first render and
     never read again. The runtime emits a <style> element in this layer
     instead, and also folds the OS preference into the document before
     compiling, taking the stronger of the two per knob. A theme can turn an
     accommodation on; it can no longer turn one off.
     ======================================================================== */

  @media (prefers-reduced-motion: reduce) {
    :root {
      --motion-scale: 0;
    }
  }
  @media (prefers-reduced-transparency: reduce) {
    :root {
      --a11y-reduce-transparency: 1;
    }
  }
  @media (prefers-contrast: more) {
    :root {
      --a11y-contrast-boost: 1;
    }
  }
}

/* No `--radius-*` compatibility aliases, deliberately. Every read in the app was
   migrated to `--r-*` in the same change that introduced it, so those three
   names now belong exclusively to the tenant's wire format — which is what
   makes `--r-anchor` above able to read one of them without a cycle. */
