/* =============================================================================
 * TWE UI — tokens.css
 * The design-token contract for the TWE / EdaphOS tool fleet.
 *
 *   Version : 2.1.0
 *   Date    : 2026-09-11
 *   Supersedes: "TWE Design Tokens v1.0.0" (the untracked file copy-pasted into
 *               OCC/tokens.css and EdaphOS/electron/renderer/tokens.css).
 *               v1 is retired: its colour identity drifted from the brand
 *               (maroon #6D1A36 vs the real TWE red #a81d28), its light theme
 *               was flat mid-greys, and its base size was a hard 13px.
 *
 * DO NOT EDIT THIS FILE IN A TOOL REPO. It is vendored. Change it upstream in
 * claude-config and re-run scripts/twe_ui_sync.py, or your edit is lost on the
 * next sync and the fleet silently forks again — which is exactly the failure
 * this file exists to end.
 *
 * ---------------------------------------------------------------------------
 * WHAT A TOOL OVERRIDES
 * ---------------------------------------------------------------------------
 * Exactly one thing: its accent. Put this AFTER the tokens.css link:
 *
 *     :root { --twe-accent-h: 210; --twe-accent-s: 100%; --twe-accent-l: 64%; }
 *
 * Ratified fleet accents (Matt, 2026-09-04 — "shared base + one per-tool accent"):
 *     Panoptes  210 100% 64%   (cyan-blue  #4A9EFF)
 *     Lilly     145  65% 52%   (green)
 *     Domhan    356  73% 58%   (crimson — the brand signal)
 *     Saga       28  90% 55%   (amber)
 *     default   356  73% 58%   (brand signal — a tool that declares nothing)
 * Never override the neutral ramp, the elevation ramp, the type scale, or the
 * semantic status hues. Those are what make eight open tools read as one suite.
 *
 * ---------------------------------------------------------------------------
 * BROWSER FLOOR — VERIFIED 2026-09-04, READ THIS BEFORE ADDING A MODERN FEATURE
 * ---------------------------------------------------------------------------
 * The fleet is 100% Chromium, but NOT 100% modern Chromium:
 *     Edge / Chrome on TWEI-PC468 ........ 152   (28 of 30 tools, browser-served)
 *     Lilly geointel ..... Electron 41.2.1 ~146  (the Electron flagship)
 *     Caementum .......... Electron 32.x    128
 *     Daishi/EdaphOS/Fjarri/Nedra/OCC ... 30.x  124
 *     Tatara ............. Electron 28.3.3  120  <-- THE FLOOR
 *
 * => Baseline everything on Chromium 120. `appearance:none` (the actual cure for
 *    default-looking controls) works everywhere, so the mandatory layer is safe.
 *    `appearance:base-select` (135+), `::picker(select)` (135+) and
 *    `corner-shape` (139+) are PROGRESSIVE ENHANCEMENT ONLY — always inside an
 *    @supports block, never as the only styling. A Chromium-only rule left
 *    unguarded degrades to a native OS widget, which reproduces the single
 *    complaint this system was built to fix.
 * ========================================================================== */

/* ---------------------------------------------------------------- 0. fonts --
 * Self-hosted. NO CDN, ever: these are LAN tools on an engineering network —
 * a Google Fonts <link> is both an offline failure mode and a per-pageview
 * call off-network. (Fleet baseline at v2.0.0: 230 such refs in 96 files.)
 *
 * KNOWN GAP: only weight 400 is a real file for each family. The upstream
 * jetbrains-mono-400/-500 pair was byte-identical, so weight 500 was silently
 * fake-synthesised. `font-synthesis: none` below makes that visible instead of
 * quietly ugly. To close it, vendor the VARIABLE faces (both SIL OFL 1.1):
 *   Outfit         https://github.com/Outfitio/Outfit-Fonts
 *   JetBrains Mono https://github.com/JetBrains/JetBrainsMono
 * then swap in the variable @font-face blocks commented below.
 */
@font-face {
  font-family: 'Outfit';
  src: url('fonts/outfit.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* When the variable faces are vendored, replace the two blocks above with:
@font-face { font-family:'Outfit'; src:url('fonts/outfit-var.woff2') format('woff2-variations');
             font-weight:100 900; font-display:swap; }
@font-face { font-family:'JetBrains Mono'; src:url('fonts/jetbrains-mono-var.woff2') format('woff2-variations');
             font-weight:100 800; font-display:swap; }
*/

/* ------------------------------------------------------ 1. brand primitives --
 * Authority: the client-facing site (TWE-Website app/globals.css +
 * tailwind.config.ts). These are the only legitimate TWE brand values; the
 * maroons that appeared in tool code (#6D1A36, #8B1A2C) were drift.
 */
:root {
  --twe-brand-navy:        #222a35;  /* structural navy                       */
  --twe-brand-navy-light:  #2c3542;
  --twe-brand-navy-deep:   #181e27;
  --twe-brand-red:         #a81d28;  /* TWE red — the corporate mark          */
  --twe-brand-signal:      #e0454f;  /* live crimson — accents, data, glow    */
  --twe-brand-key:         #d9b45a;  /* key gold — sparingly, never as accent */
  --twe-brand-steel:       #5b636e;
  --twe-brand-ink:         #eceef2;
  --twe-brand-mist:        #e9eef4;
  --twe-brand-paper:       #f2f5f8;

  /* Navy-tinted neutral ramp. Deliberately NOT pure grey: a hue-neutral grey
   * ramp is the single biggest contributor to the "flat, dead, pre-2020" read.
   * Every surface colour in every theme comes from here. */
  --twe-navy-950: #0d1117;
  --twe-navy-900: #12171f;
  --twe-navy-850: #171d26;
  --twe-navy-800: #1c232e;
  --twe-navy-750: #222a35;
  --twe-navy-700: #2b3441;
  --twe-navy-600: #3a4453;
  --twe-navy-500: #4c5767;
  --twe-navy-400: #5f6b7c;
  --twe-navy-300: #8994a5;
  --twe-navy-200: #b4bdca;
  --twe-navy-100: #d7dde6;
  --twe-navy-050: #eef1f6;

  /* Accent, as HSL channels so a tool overrides ONE hue and every derived
   * tint/shade/ring/glow follows. Default = brand signal. */
  --twe-accent-h: 356;
  --twe-accent-s: 73%;
  --twe-accent-l: 58%;

  --twe-accent:        hsl(var(--twe-accent-h) var(--twe-accent-s) var(--twe-accent-l));
  --twe-accent-hover:  hsl(var(--twe-accent-h) var(--twe-accent-s) calc(var(--twe-accent-l) + 8%));
  --twe-accent-active: hsl(var(--twe-accent-h) var(--twe-accent-s) calc(var(--twe-accent-l) - 6%));
  --twe-accent-dim:    hsl(var(--twe-accent-h) var(--twe-accent-s) var(--twe-accent-l) / 0.14);
  --twe-accent-ring:   hsl(var(--twe-accent-h) var(--twe-accent-s) var(--twe-accent-l) / 0.45);
  --twe-accent-glow:   hsl(var(--twe-accent-h) var(--twe-accent-s) var(--twe-accent-l) / 0.28);
  --twe-accent-text:   hsl(var(--twe-accent-h) calc(var(--twe-accent-s) - 8%) 72%);

  /* Semantic status. Identity hues — these do NOT flip between themes, only
   * their tinted backgrounds do. Dual-encode always: never colour alone. */
  --twe-ok:      #2ecc71;
  --twe-warn:    #f39c12;
  --twe-danger:  #e74c3c;
  --twe-info:    #4a9eff;
  --twe-neutral: var(--twe-navy-400);

  /* Status INK — the darkened on-light variants. These exist because the
   * identity hues above are fill/border colours and FAIL AA as text on white:
   * measured #2ecc71 ~1.9:1 and #e74c3c ~3.3:1 against #fff, both under the
   * 4.5:1 floor. Any light-theme, field-theme or print surface that colours
   * TEXT by status must use --twe-*-ink, never the raw hue. The raw hue stays
   * correct for a fill, a dot, a border or a chart series.
   * (Found by the print.css author during the v2.0.0 build — a real defect,
   * not a preference: it would have shipped failing contrast in three themes.) */
  --twe-ok-ink:     #0f7a3d;
  --twe-warn-ink:   #8a5205;
  --twe-danger-ink: #a3201a;
  --twe-info-ink:   #1256a8;

  /* Status GLYPHS — one vocabulary shared by screen, print and forced-colors,
   * so status is never encoded in hue alone on any surface. Pair every status
   * colour with its glyph. */
  --twe-glyph-ok:      '\2713';  /* check      */
  --twe-glyph-warn:    '\26A0';  /* warning    */
  --twe-glyph-danger:  '\2715';  /* cross      */
  --twe-glyph-info:    '\24D8';  /* circled i  */
  --twe-glyph-neutral: '\2022';  /* bullet     */

  /* --------------------------------------------------------- type scale -----
   * rem-based and fluid. v1's hard `--base-font-size: 13px` ignored user zoom
   * and OS text scaling — a real accessibility defect on a 14-office firm's
   * workstations, and it made every tool feel cramped. */
  --twe-font-sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --twe-font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --twe-text-2xs: 0.6875rem;                          /* 11px — eyebrows, tags */
  --twe-text-xs:  0.75rem;                            /* 12px — meta, captions */
  --twe-text-sm:  0.8125rem;                          /* 13px — dense tables   */
  --twe-text-base: 0.875rem;                          /* 14px — UI default     */
  --twe-text-md:  1rem;                               /* 16px — body prose     */
  --twe-text-lg:  1.125rem;
  --twe-text-xl:  clamp(1.25rem, 1.1rem + 0.5vw,  1.5rem);
  --twe-text-2xl: clamp(1.5rem,  1.25rem + 1vw,   2rem);
  --twe-text-3xl: clamp(2rem,    1.5rem + 2vw,    3rem);

  --twe-leading-tight: 1.2;
  --twe-leading-snug:  1.35;
  --twe-leading-body:  1.6;

  /* Outfit is a geometric DISPLAY face. It is charming at size and mediocre in
   * dense data, and it has no true tabular figures — so numbers must not be set
   * in it. Rule: every numeric column, metric readout, ID, coordinate, currency
   * and timestamp uses --twe-font-mono with --twe-nums. Enforced by .num /
   * .twe-td--num in data.css and checked by the linter. */
  --twe-nums: tabular-nums lining-nums;
  --twe-tracking-eyebrow: 0.14em;

  /* ------------------------------------------------------------ geometry ----
   * Nothing in this system has a 0 radius. Sharp corners on cards, inputs and
   * buttons are legacy-tell #5. */
  --twe-radius-xs:   4px;
  --twe-radius-sm:   6px;
  --twe-radius:      8px;
  --twe-radius-md:  10px;
  --twe-radius-lg:  14px;
  --twe-radius-xl:  20px;
  --twe-radius-pill: 999px;

  /* 4px base spacing scale */
  --twe-space-1: 0.25rem;  --twe-space-2: 0.5rem;   --twe-space-3: 0.75rem;
  --twe-space-4: 1rem;     --twe-space-5: 1.25rem;  --twe-space-6: 1.5rem;
  --twe-space-8: 2rem;     --twe-space-10: 2.5rem;  --twe-space-12: 3rem;
  --twe-space-16: 4rem;

  /* Hairlines must survive 125%/150% Windows DPI. Below 1px they vanish on some
   * scale factors and double on others, so borders are always >= 1px, never
   * fractional, and separation leans on the elevation ramp instead. */
  --twe-border-width: 1px;

  /* Focus ring. A global ring is exactly the thing that must not be a literal
   * in one stylesheet — Panoptes hand-maintained a selector list and every
   * control added afterwards silently shipped with no ring at all. */
  --twe-ring-width:  2px;
  --twe-ring-offset: 2px;

  /* Scrollbar geometry. Tokenised because unstyled scrollbars are legacy
   * tell #1 (29 of 39 tools) and the fleet must not drift on the fix. */
  --twe-scrollbar-size:      10px;
  --twe-scrollbar-size-thin:  6px;

  /* Travel distances for hover/press/reveal. Note these are NOT affected by the
   * reduced-motion override, which only zeroes durations — so a reveal still
   * needs its own prefers-reduced-motion guard. */
  --twe-lift-1:  2px;   /* hover lift on a card or button */
  --twe-lift-2:  6px;   /* page/section entrance          */
  --twe-lift-3: 10px;   /* toast + reveal travel          */

  /* Prose measure. Long lines are one of the quieter amateur tells. */
  --twe-measure: 68ch;

  /* Weight scale. WARNING: only weight 400 is a real vendored face today, so
   * 500/600 are synthesised. base.css scopes a deliberate exception for
   * <strong>/<b> — with font-synthesis:none and no bold face, emphasis would
   * render pixel-identical to body text, i.e. encoded in nothing (WCAG 1.3.1).
   * Ugly synthetic bold beats invisible emphasis. Delete that exception once
   * the variable faces are vendored. */
  --twe-weight-normal: 400;
  --twe-weight-medium: 500;
  --twe-weight-bold:   600;

  /* True paper white, for print surfaces only. Distinct from --twe-brand-paper
   * (#f2f5f8, a screen tint): on paper, ink must not be spent describing the
   * page itself. */
  --twe-paper: #ffffff;

  /* Field/touch: several tools are used on tablets in the field. 44px is the
   * floor for a bare finger, 48px for a gloved one. */
  --twe-tap-min: 44px;
  --twe-tap-min-gloved: 48px;

  /* ---------------------------------------------------------- motion --------
   * One easing curve fleet-wide, lifted from TWE-Website. A single shared
   * curve is most of what makes a set of tools feel like one product.
   * Durations are deliberately short: >250ms on a UI affordance reads as slow,
   * not as polished. */
  --twe-ease:        cubic-bezier(0.16, 1, 0.3, 1);
  --twe-ease-out:    cubic-bezier(0.33, 1, 0.68, 1);
  --twe-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --twe-dur-instant: 90ms;
  --twe-dur-fast:   140ms;
  --twe-dur:        180ms;
  --twe-dur-slow:   240ms;
  --twe-dur-enter:  300ms;   /* overlays/sheets only */
  --twe-dur-loop:   960ms;   /* spinners, shimmer, pulse — anything repeating */
  --twe-transition: var(--twe-dur) var(--twe-ease);

  /* Spring, for direct-manipulation feedback ONLY (a toggle knob following the
   * thumb). Never on an entrance — bounce on arriving content reads as a toy. */
  --twe-ease-spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%,
    0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%,
    1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 84.2%, 1);

  /* Layering. One scale, so no tool invents z-index: 99999 again. */
  --twe-z-base: 0;      --twe-z-sticky: 100;  --twe-z-rail: 200;
  --twe-z-dropdown: 300; --twe-z-overlay: 400; --twe-z-modal: 500;
  --twe-z-toast: 600;   --twe-z-tooltip: 700;
}

/* ============================================================== 2. themes ===
 * Dark is the default. Every rule in every TWE stylesheet reads a var(), so a
 * theme is a token swap and nothing else — no per-rule overrides anywhere.
 *
 * Boot contract (prevents the theme flash on full-page FastAPI navigations):
 *   1. inline this file's :root block as critical CSS in <head>, OR link it
 *      as the FIRST stylesheet, before any tool CSS;
 *   2. set data-twe-theme on <html> from a synchronous inline script that
 *      reads localStorage, BEFORE first paint. A late <link> or a deferred
 *      script gives every navigation a white flash.
 */
:root,
[data-twe-theme='dark'] {
  color-scheme: dark;

  --twe-bg:            var(--twe-navy-950);
  --twe-bg-surface:    var(--twe-navy-900);
  --twe-bg-raised:     var(--twe-navy-850);
  --twe-bg-card:       var(--twe-navy-800);
  --twe-bg-card-hover: var(--twe-navy-750);
  --twe-bg-input:      #0a0e14;
  --twe-bg-inset:      #0a0e14;
  --twe-bg-overlay:    rgb(5 8 13 / 0.72);

  --twe-text:           #e6ebf3;
  --twe-text-secondary: #9aa5b8;
  --twe-text-muted:     #6f7b8e;   /* AA-verified >=4.5:1 on --twe-bg */
  --twe-text-inverse:   var(--twe-navy-950);

  --twe-border:        rgb(255 255 255 / 0.08);
  --twe-border-strong: rgb(255 255 255 / 0.14);
  --twe-border-light:  rgb(255 255 255 / 0.05);

  /* Top-light: a 1px inner highlight on the upper edge. This one line does
   * more for perceived dimensionality than any blur — it is how a surface
   * reads as a physical panel catching light rather than a coloured div. */
  --twe-highlight: inset 0 1px 0 rgb(255 255 255 / 0.07);

  --twe-shadow-rgb: 0 0 0;
  --twe-shadow-alpha: 1;

  --twe-glass-bg:     rgb(23 29 38 / 0.62);
  --twe-glass-border: rgb(255 255 255 / 0.10);
  --twe-glass-blur:   14px;
  --twe-glass-sat:    1.5;

  --twe-ok-bg:     rgb(46 204 113 / 0.13);
  --twe-warn-bg:   rgb(243 156 18 / 0.13);
  --twe-danger-bg: rgb(231 76 60 / 0.13);
  --twe-info-bg:   rgb(74 158 255 / 0.13);

  --twe-scrollbar-thumb:       rgb(255 255 255 / 0.16);
  --twe-scrollbar-thumb-hover: rgb(255 255 255 / 0.28);
  --twe-scrollbar-track:       transparent;
}

/* ---------------------------------------------------------------- light -----
 * v1's light theme was #f5f5f5 / #eee / #e8e8e8 / #e0e0e0 — flat mid-greys with
 * no hue and no elevation, i.e. the exact "muted grey, no dimension" look this
 * system exists to eliminate. This one instead uses a white-to-mist ramp with
 * the navy hue carried through, and takes its separation from real shadows.
 */
[data-twe-theme='light'] {
  color-scheme: light;

  --twe-bg:            #f6f8fb;
  --twe-bg-surface:    #ffffff;
  --twe-bg-raised:     #ffffff;
  --twe-bg-card:       #ffffff;
  --twe-bg-card-hover: var(--twe-navy-050);
  --twe-bg-input:      #ffffff;
  --twe-bg-inset:      var(--twe-navy-050);
  --twe-bg-overlay:    rgb(18 23 31 / 0.42);

  --twe-text:           #151b24;
  --twe-text-secondary: #4d5766;
  --twe-text-muted:     #6b7688;   /* AA-verified >=4.5:1 on --twe-bg */
  --twe-text-inverse:   #ffffff;

  --twe-border:        rgb(20 28 40 / 0.11);
  --twe-border-strong: rgb(20 28 40 / 0.20);
  --twe-border-light:  rgb(20 28 40 / 0.06);

  --twe-highlight: inset 0 1px 0 rgb(255 255 255 / 0.9);

  --twe-shadow-rgb: 20 28 45;      /* hue-matched, never neutral black */
  --twe-shadow-alpha: 0.5;

  --twe-glass-bg:     rgb(255 255 255 / 0.68);
  --twe-glass-border: rgb(20 28 40 / 0.10);

  /* Accent must be darkened for AA on white — reusing the dark-theme lightness
   * on a light ground is the classic hand-rolled-light-theme failure. */
  --twe-accent-l: 44%;
  --twe-accent-text: hsl(var(--twe-accent-h) var(--twe-accent-s) 38%);

  --twe-ok-bg:     rgb(46 204 113 / 0.12);
  --twe-warn-bg:   rgb(243 156 18 / 0.14);
  --twe-danger-bg: rgb(231 76 60 / 0.10);
  --twe-info-bg:   rgb(74 158 255 / 0.10);

  --twe-scrollbar-thumb:       rgb(20 28 40 / 0.22);
  --twe-scrollbar-thumb-hover: rgb(20 28 40 / 0.36);
}

/* ---------------------------------------------------------------- field -----
 * For tablets in direct sunlight. This is NOT "light theme, brighter": glass
 * and low-alpha borders are unreadable outdoors, so it maximises contrast,
 * removes translucency entirely, and enlarges tap targets. Any tool with a
 * field surface must offer it. Dark glass on a tablet at a boring site is
 * unusable, however good it looks at a desk.
 */
[data-twe-theme='field'] {
  color-scheme: light;

  --twe-bg:            #ffffff;
  --twe-bg-surface:    #ffffff;
  --twe-bg-raised:     #ffffff;
  --twe-bg-card:       #ffffff;
  --twe-bg-card-hover: #eef2f7;
  --twe-bg-input:      #ffffff;
  --twe-bg-inset:      #e8edf3;
  --twe-bg-overlay:    rgb(0 0 0 / 0.55);

  --twe-text:           #000000;
  --twe-text-secondary: #24303f;
  --twe-text-muted:     #45525f;
  --twe-text-inverse:   #ffffff;

  --twe-border:        rgb(0 0 0 / 0.34);
  --twe-border-strong: rgb(0 0 0 / 0.55);
  --twe-border-light:  rgb(0 0 0 / 0.20);
  --twe-border-width:  2px;

  --twe-highlight: none;
  --twe-shadow-rgb: 0 0 0;
  --twe-shadow-alpha: 0.32;

  --twe-glass-bg:     #ffffff;      /* translucency OFF outdoors */
  --twe-glass-border: rgb(0 0 0 / 0.34);
  --twe-glass-blur:   0px;
  --twe-glass-sat:    1;

  --twe-accent-l: 38%;
  --twe-tap-min: var(--twe-tap-min-gloved);
  --twe-text-base: 1rem;           /* nothing under 16px in the field */
  --twe-text-sm:   0.9375rem;
}

/* Respect the OS when no explicit choice is stored. */
@media (prefers-color-scheme: light) {
  :root:not([data-twe-theme]) {
    color-scheme: light;
    --twe-bg: #f6f8fb;            --twe-bg-surface: #ffffff;
    --twe-bg-raised: #ffffff;     --twe-bg-card: #ffffff;
    --twe-bg-card-hover: var(--twe-navy-050);
    --twe-bg-input: #ffffff;      --twe-bg-inset: var(--twe-navy-050);
    --twe-bg-overlay: rgb(18 23 31 / 0.42);
    --twe-text: #151b24;          --twe-text-secondary: #4d5766;
    --twe-text-muted: #6b7688;    --twe-text-inverse: #ffffff;
    --twe-border: rgb(20 28 40 / 0.11);
    --twe-border-strong: rgb(20 28 40 / 0.20);
    --twe-border-light: rgb(20 28 40 / 0.06);
    --twe-highlight: inset 0 1px 0 rgb(255 255 255 / 0.9);
    --twe-shadow-rgb: 20 28 45;   --twe-shadow-alpha: 0.5;
    --twe-glass-bg: rgb(255 255 255 / 0.68);
    --twe-glass-border: rgb(20 28 40 / 0.10);
    --twe-accent-l: 44%;
    --twe-accent-text: hsl(var(--twe-accent-h) var(--twe-accent-s) 38%);
    --twe-scrollbar-thumb: rgb(20 28 40 / 0.22);
    --twe-scrollbar-thumb-hover: rgb(20 28 40 / 0.36);
  }
}

/* ======================================================== 3. elevation ======
 * The depth ramp. This is the heart of the "not flat" requirement, so it is
 * worth saying why it looks like this.
 *
 * A single `box-shadow: 0 2px 4px rgba(0,0,0,.2)` is the tell of a cheap UI —
 * real objects cast TWO shadows: a tight contact shadow directly beneath, and
 * a wide soft ambient one. Every level below pairs them, and each level also
 * carries --twe-highlight so the lit top edge and the cast shadow agree about
 * where the light is. The shadow colour is hue-matched to the surface
 * (--twe-shadow-rgb), never neutral black, because black shadows on a tinted
 * ground look like dirt.
 *
 * Assign by MEANING, not by taste:
 *   0  flush     — sits in the page (table rows, list items)
 *   1  resting   — cards, tiles, chips
 *   2  raised    — hover state of a resting element, sticky headers
 *   3  floating  — dropdowns, popovers, tooltips, command palette
 *   4  overlay   — modals, sheets, dialogs
 *   5  detached  — drag-in-flight only
 */
:root {
  --twe-elev-0: none;

  --twe-elev-1:
    0 1px 1px -0.5px rgb(var(--twe-shadow-rgb) / calc(0.20 * var(--twe-shadow-alpha))),
    0 2px 4px  -1px  rgb(var(--twe-shadow-rgb) / calc(0.14 * var(--twe-shadow-alpha)));

  --twe-elev-2:
    0 1px 1px -0.5px rgb(var(--twe-shadow-rgb) / calc(0.18 * var(--twe-shadow-alpha))),
    0 3px 6px  -1px  rgb(var(--twe-shadow-rgb) / calc(0.16 * var(--twe-shadow-alpha))),
    0 8px 16px -4px  rgb(var(--twe-shadow-rgb) / calc(0.14 * var(--twe-shadow-alpha)));

  --twe-elev-3:
    0 1px 1px -0.5px rgb(var(--twe-shadow-rgb) / calc(0.16 * var(--twe-shadow-alpha))),
    0 4px 8px  -2px  rgb(var(--twe-shadow-rgb) / calc(0.16 * var(--twe-shadow-alpha))),
    0 12px 24px -6px rgb(var(--twe-shadow-rgb) / calc(0.18 * var(--twe-shadow-alpha))),
    0 24px 40px -12px rgb(var(--twe-shadow-rgb) / calc(0.14 * var(--twe-shadow-alpha)));

  --twe-elev-4:
    0 2px 2px -1px   rgb(var(--twe-shadow-rgb) / calc(0.16 * var(--twe-shadow-alpha))),
    0 8px 16px -4px  rgb(var(--twe-shadow-rgb) / calc(0.18 * var(--twe-shadow-alpha))),
    0 20px 36px -8px rgb(var(--twe-shadow-rgb) / calc(0.20 * var(--twe-shadow-alpha))),
    0 40px 72px -20px rgb(var(--twe-shadow-rgb) / calc(0.18 * var(--twe-shadow-alpha)));

  --twe-elev-5:
    0 2px 4px -1px    rgb(var(--twe-shadow-rgb) / calc(0.18 * var(--twe-shadow-alpha))),
    0 12px 24px -6px  rgb(var(--twe-shadow-rgb) / calc(0.20 * var(--twe-shadow-alpha))),
    0 32px 56px -12px rgb(var(--twe-shadow-rgb) / calc(0.22 * var(--twe-shadow-alpha))),
    0 60px 100px -28px rgb(var(--twe-shadow-rgb) / calc(0.20 * var(--twe-shadow-alpha)));

  /* Accent-tinted glow for the focused/active/critical case. Use sparingly —
   * a glow on everything is worse than a glow on nothing. */
  --twe-elev-glow: 0 0 0 1px var(--twe-accent-ring), 0 4px 20px -4px var(--twe-accent-glow);
}

/* ==================================================== 4. reduced motion =====
 * Non-negotiable, and declared here so no tool has to remember it. Motion is
 * removed; state changes still happen instantly rather than being lost.
 */
@media (prefers-reduced-motion: reduce) {
  :root {
    --twe-dur-instant: 0.01ms; --twe-dur-fast: 0.01ms; --twe-dur: 0.01ms;
    --twe-dur-slow: 0.01ms;    --twe-dur-enter: 0.01ms;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* The universal selector does NOT match the ::view-transition pseudo tree, so
   * page transitions would keep animating for a user who opted out. Killed here
   * once, centrally, so no future stylesheet has to remember it. */
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* Viewers who ask for less transparency get solid surfaces, not glass. */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --twe-glass-bg: var(--twe-bg-raised);
    --twe-glass-blur: 0px;
    --twe-glass-sat: 1;
  }
}

@media (prefers-contrast: more) {
  :root {
    --twe-border:        rgb(from var(--twe-text) r g b / 0.5);
    --twe-border-strong: rgb(from var(--twe-text) r g b / 0.75);
    --twe-text-muted:    var(--twe-text-secondary);
  }
}
