/* Save Garage design system: tokens.
   One file for the app (save-garage/ui) and the website (savegarage.dev). Copy this file together with fonts/ and keep
   them side by side: the @font-face URLs below are relative to this file.

   The idea in one line: Vice City at blue hour. Night-indigo surfaces, one warm light (the magenta-to-orange sunset)
   that means "act" or "this is yours", cool character colours for data, road signs for risk, and neon tubes that are
   visibly unlit glass until something is selected, active or edited. See SYSTEM.md for the rules behind every value.

   Layers: primitives (named for what they are) -> semantic roles (named for what they do; [data-light="day"] remaps
   them) -> a few component tokens where a component has several states. Every token is prefixed --sg- so it can live
   next to the app's current variables during the migration. */

/* ------------------------------------------------------------------ fonts
   Archivo (display) and Onest (text), SIL OFL 1.1, subset to Latin, Latin Extended-A and UI punctuation; Onest also
   carries Cyrillic. Licences: fonts/Archivo-OFL.txt, fonts/Onest-OFL.txt. 168 KB for all three files. */
@font-face {
  font-family: "Archivo SG";
  src: url("fonts/archivo-display.woff2") format("woff2");
  font-weight: 500 900;
  font-stretch: 62% 100%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo SG";
  src: url("fonts/archivo-display-italic.woff2") format("woff2");
  font-weight: 600 900;
  font-stretch: 62% 85%;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Onest SG";
  src: url("fonts/onest-text.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* ================================================================ 1. PRIMITIVES */

  /* Night: blue-hour indigo. Hue held at 283-290, only lightness and chroma step (OKLCH in the comments). */
  --sg-night-950: #09081b;   /* oklch(15% .040 283)  sunken: inputs, code, the floor under cards */
  --sg-night-900: #100f27;   /* oklch(18.5% .048 283) canvas: the page */
  --sg-night-850: #1a1734;   /* oklch(22.5% .055 285) raised: cards, panels, the unsaved bar */
  --sg-night-800: #252142;   /* oklch(27% .060 287)   overlay: menus, toasts, hover on raised */
  --sg-night-750: #302b50;   /* oklch(31.5% .065 288) strong: pressed, selected chips */
  --sg-night-700: #474168;   /* oklch(40% .065 290)   the darkest line that still reads as a line */

  /* Light on night. Shell is warm on purpose: text is lit by the sunset, not by a screen. */
  --sg-shell: #f8f0e8;       /* oklch(96% .014 70)  16.6:1 on canvas */
  --sg-haze: #c4c1d8;        /* oklch(82% .032 292) 10.7:1 on canvas */
  --sg-smoke: #a29fbb;       /* oklch(71.5% .040 290) 7.3:1 on canvas, 5.2:1 on night-750 */

  /* The sunset: the only warm light. Magenta -> coral -> tangerine, with gold for the sun itself. */
  --sg-vice-magenta: #fa2889; /* oklch(65% .245 0) */
  --sg-coral: #fd5d62;        /* oklch(69% .195 22) */
  --sg-tangerine: #ff943c;    /* oklch(77% .165 55) */
  --sg-sun-gold: #fbd26b;     /* oklch(88% .130 88) the sun's core; projected values ("after your edits") */
  --sg-flamingo: #ff93bc;     /* oklch(79% .140 357) the sunset as TEXT on night: 9:1 on canvas */
  --sg-sunset-ink: #29081a;   /* text on sunset fills: 5.0:1 on magenta, 6.0:1 on coral, 8.4:1 on tangerine */

  /* Characters and money. Cool hues so the warm sunset stays the only "act" colour. */
  --sg-orchid: #c797fd;       /* oklch(76% .150 305) Lucia: 8.5:1 on canvas */
  --sg-lagoon: #46ded6;       /* oklch(82% .125 190) Jason: 11.7:1 on canvas */
  --sg-cash: #6be49c;         /* oklch(83% .150 155) money amounts only: 12.1:1 on canvas */

  /* Risk, as Leonida road signs. The sign colour fills the shape; the text colour is for words. */
  --sg-sign-green: #35c26d;        /* "Tested on PS5": square */
  --sg-sign-green-text: #94e7b1;   /* 13.2:1 on canvas */
  --sg-sign-yellow: #f6d732;       /* "Not tested yet": diamond */
  --sg-sign-yellow-text: #f6e281;  /* 14.8:1 on canvas */
  --sg-sign-red: #f3413c;          /* "Can break your save": octagon */
  --sg-sign-red-text: #fba8a0;     /* 10.3:1 on canvas */

  /* Day: sun-bleached Ocean Drive stucco. Website day sections and printed/README art only; the app is night. */
  --sg-stucco: #ffe4e1;       /* oklch(94% .030 25) flamingo stucco */
  --sg-stucco-hi: #fff3f2;    /* oklch(97.5% .015 25) sunlit wall: cards on stucco */
  --sg-seafoam: #d2f2e8;      /* oklch(93.5% .035 175) the second facade colour */
  --sg-ink: #1f1c3f;          /* oklch(25% .065 285) text on day: 13.5:1 on stucco */
  --sg-ink-2: #4b486c;        /* 7.1:1 on stucco */
  --sg-ink-3: #615e81;        /* 5.1:1 on stucco */
  --sg-magenta-deep: #c1005f; /* the sunset as text on day: 5.1:1 on stucco */

  /* ================================================================ 2. GRADIENTS AND SKIES */

  /* The sunset runs from the reading start to the reading end; RTL flips the angle (see the [dir="rtl"] block). */
  --sg-sunset-angle: 100deg;
  --sg-sunset: linear-gradient(var(--sg-sunset-angle), var(--sg-vice-magenta) 0%, var(--sg-coral) 52%, var(--sg-tangerine) 100%);
  /* Hover/pressed for sunset fills: the same light, one step brighter, never a different hue */
  --sg-sunset-hi: linear-gradient(var(--sg-sunset-angle), #ff3d97 0%, #ff6f6c 52%, #ffa24f 100%);
  /* The horizon: a 2px sunset line with the sun burning in it. Progress, the unsaved bar's edge, hero bottoms. */
  --sg-horizon: linear-gradient(90deg, transparent 0%, var(--sg-vice-magenta) 12%, var(--sg-coral) 50%, var(--sg-tangerine) 88%, transparent 100%);

  /* Skies for art-less backgrounds (masthead fallback, empty hero, README banner) */
  --sg-sky-day: linear-gradient(180deg, #8fd0ff 0%, #c6eaff 46%, #ffe3d3 100%);
  --sg-sky-dusk: linear-gradient(180deg, #16123d 0%, #33185a 34%, #7d2569 58%, #d63f6b 76%, #ff7f4a 90%, #ffbc66 100%);
  --sg-sky-night: linear-gradient(180deg, #0a0920 0%, #141133 55%, #251542 100%);

  /* ================================================================ 3. SEMANTIC ROLES (night is the default) */

  --sg-bg: var(--sg-night-900);
  --sg-surface-1: var(--sg-night-850);     /* cards, panels */
  --sg-surface-2: var(--sg-night-800);     /* raised inside a card, menus, toasts, hover on surface-1 */
  --sg-surface-3: var(--sg-night-750);     /* pressed, selected */
  --sg-surface-sunken: var(--sg-night-950);/* inputs, code, tracks */

  --sg-text-1: var(--sg-shell);
  --sg-text-2: var(--sg-haze);
  --sg-text-3: var(--sg-smoke);
  --sg-text-accent: var(--sg-flamingo);    /* links, "was 57,794", the active label */
  --sg-text-on-accent: var(--sg-sunset-ink);
  --sg-text-projected: var(--sg-sun-gold); /* values the save will have after your edits */

  --sg-line-1: rgb(255 255 255 / .08);     /* hairline dividers */
  --sg-line-2: rgb(255 255 255 / .14);     /* card and panel edges */
  --sg-line-control: rgb(255 255 255 / .36); /* input + secondary-button borders: 3.2:1 or better on every night surface */
  --sg-focus: #ff689b;                     /* oklch(72% .19 2): 5.6:1 or better on every night surface */

  --sg-accent-solid: var(--sg-coral);      /* where a gradient can't go: 1px rules, checkbox ticks, the sun dot */
  --sg-changed: var(--sg-coral);           /* the border of an edited field */

  /* status dots (masthead pills, job states) */
  --sg-ok: var(--sg-sign-green);
  --sg-wait: var(--sg-sign-yellow);
  --sg-bad: var(--sg-sign-red);

  /* character tubes: set --sg-tube on a component to light it in that colour */
  --sg-tube-lucia: var(--sg-orchid);
  --sg-tube-jason: var(--sg-lagoon);
  --sg-tube-off: rgb(255 255 255 / .14);   /* an unlit glass tube: visible, never invisible */

  /* ================================================================ 4. TYPE */

  --sg-font-display: "Archivo SG", "Onest SG", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --sg-font-text: "Onest SG", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, "Noto Sans", Arial, sans-serif;
  --sg-font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* The ladder. A screen uses 4 to 6 of these; the display step sits 2.5x or more above the one below it. */
  --sg-text-label: 0.8125rem;  /* 13px: labels, tags, captions, step numbers. The only size under 14. */
  --sg-text-small: 0.875rem;   /* 14px: help text, secondary lines */
  --sg-text-body: 1rem;        /* 16px: body, inputs, buttons */
  --sg-text-lead: 1.1875rem;   /* 19px: intro paragraphs, the website hero line */
  --sg-text-h3: 1.5rem;        /* 24px display: card titles, the unsaved count */
  --sg-text-h2: 2rem;          /* 32px display: section heads, character names */
  --sg-text-num: 2.75rem;      /* 44px display: the one big number in a card */
  --sg-text-h1: clamp(2.75rem, 1.9rem + 3.4vw, 4.75rem);   /* 44 -> 76px display: screen titles */
  --sg-text-hero: clamp(3.25rem, 1.5rem + 6.6vw, 8rem);    /* 52 -> 128px display: website hero only */

  /* Display shaping. Archivo gets narrower before it gets smaller: long words wrap less. */
  --sg-display-weight: 760;
  --sg-display-weight-heavy: 860;   /* hero and the big moment only */
  --sg-display-stretch: 72%;        /* headings */
  --sg-display-stretch-tight: 62%;  /* long-word languages, narrow screens */
  --sg-num-stretch: 78%;            /* big numbers: a touch wider so 1 and 7 don't crowd */
  --sg-display-style: normal;       /* italic is for one moment per surface (hero line, "Edits saved") */
  --sg-display-scale: 1;            /* script tuning below multiplies every display size */

  --sg-text-weight: 400;
  --sg-text-weight-strong: 600;

  --sg-leading-display: 0.96;       /* 44px and up */
  --sg-leading-heading: 1.08;       /* 24-40px */
  --sg-leading-ui: 1.3;             /* labels, buttons, table cells */
  --sg-leading-body: 1.55;          /* paragraphs */

  --sg-tracking-hero: -0.015em;
  --sg-tracking-display: -0.005em;
  --sg-tracking-label: 0.01em;
  --sg-tracking-code: 0.12em;       /* sign-in codes such as WDJB-MJHT */

  --sg-measure: 66ch;               /* paragraphs */
  --sg-measure-narrow: 52ch;        /* help text beside a control */

  /* ================================================================ 5. SPACE AND LAYOUT */

  --sg-space-1: 0.25rem;  /* 4  label to its control, icon to its text */
  --sg-space-2: 0.5rem;   /* 8  inside a group */
  --sg-space-3: 0.75rem;  /* 12 button gaps, chip gaps */
  --sg-space-4: 1rem;     /* 16 related blocks, card padding on phones */
  --sg-space-5: 1.5rem;   /* 24 card padding, grid gaps */
  --sg-space-6: 2rem;     /* 32 between components */
  --sg-space-7: 3rem;     /* 48 between groups of a screen */
  --sg-space-8: 4rem;     /* 64 between screen regions */
  --sg-space-9: 6rem;     /* 96 website sections (small end) */
  --sg-space-10: 8rem;    /* 128 website sections (large end) */

  --sg-gutter: clamp(1rem, 4vw, 3rem);               /* page side padding: 16 -> 48 */
  --sg-section-gap: clamp(4rem, 2rem + 8vw, 10rem);  /* website: 64 -> 160 between major sections */
  --sg-page-max: 77.5rem;      /* 1240: app content and website text columns */
  --sg-page-max-wide: 90rem;   /* 1440: website art and screenshot rows */
  --sg-card-min: 18rem;        /* 288: the smallest a character or bank card gets before it stacks */
  /* Breakpoints (media queries can't read custom properties): 600, 860, 1100, 1440, 1920. Content decides, not devices. */

  /* ================================================================ 6. RADII (vary by element; never one radius everywhere) */

  --sg-radius-xs: 4px;     /* risk-sign corners, tiny count badges */
  --sg-radius-sm: 8px;     /* chips, table rows, menu items */
  --sg-radius-md: 12px;    /* inputs, toasts, menus */
  --sg-radius-lg: 18px;    /* panels, the bank card */
  --sg-radius-xl: 26px;    /* character cards, website feature frames */
  --sg-radius-window: 14px;/* the screenshot window frame: an OS window, not a card */
  --sg-radius-pill: 999px; /* buttons, toggles, steppers, status pills: the neon-tube shape */

  /* ================================================================ 7. ELEVATION
     On night, shadows alone vanish: every level pairs a top-edge highlight with a deep, indigo-tinted drop. */
  --sg-elev-1: inset 0 1px 0 rgb(255 255 255 / .05), 0 1px 2px rgb(3 2 14 / .5), 0 8px 20px -6px rgb(3 2 14 / .5);
  --sg-elev-2: inset 0 1px 0 rgb(255 255 255 / .06), 0 2px 6px rgb(3 2 14 / .45), 0 18px 40px -10px rgb(3 2 14 / .65);
  --sg-elev-3: inset 0 1px 0 rgb(255 255 255 / .07), 0 6px 14px rgb(3 2 14 / .5), 0 32px 80px -16px rgb(3 2 14 / .75);
  --sg-elev-bar: 0 -1px 0 rgb(255 255 255 / .06), 0 -20px 44px -14px rgb(3 2 14 / .8);

  /* Glows: real neon is a thin bright tube with a tight halo, not a fog. Three layers: tube edge, near halo, far halo. */
  --sg-glow-sunset: 0 0 0 1px rgb(253 93 98 / .9), 0 0 6px 0 rgb(250 40 137 / .55), 0 0 22px -2px rgb(255 148 60 / .45);
  --sg-glow-orchid: 0 0 0 1px rgb(199 151 253 / .9), 0 0 6px 0 rgb(199 151 253 / .5), 0 0 20px -2px rgb(199 151 253 / .3);
  --sg-glow-lagoon: 0 0 0 1px rgb(70 222 214 / .9), 0 0 6px 0 rgb(70 222 214 / .45), 0 0 20px -2px rgb(70 222 214 / .28);
  --sg-glow-cash: 0 0 0 1px rgb(107 228 156 / .9), 0 0 6px 0 rgb(107 228 156 / .45), 0 0 20px -2px rgb(107 228 156 / .28);
  /* the same halos for SVG strokes (rings, the wordmark): use as `filter:` */
  --sg-glow-filter-sunset: drop-shadow(0 0 1.5px rgb(253 93 98 / .9)) drop-shadow(0 0 6px rgb(250 40 137 / .5));
  --sg-glow-filter-orchid: drop-shadow(0 0 1.5px rgb(199 151 253 / .85)) drop-shadow(0 0 6px rgb(199 151 253 / .45));
  --sg-glow-filter-lagoon: drop-shadow(0 0 1.5px rgb(70 222 214 / .85)) drop-shadow(0 0 6px rgb(70 222 214 / .4));
  /* the sunset light under a window frame or the hero art: the horizon glowing on the page below it */
  --sg-glow-horizon: 0 34px 60px -34px rgb(250 40 137 / .55), 0 26px 44px -36px rgb(255 148 60 / .6);

  /* ================================================================ 8. MOTION
     Things move to answer the player: a press, a change, a step forward, the pointer. Nothing idles or loops except
     loading indicators. Exits run at about 75% of their entrance. */
  --sg-dur-instant: 90ms;   /* press feedback, toggle knob */
  --sg-dur-fast: 140ms;     /* colour and opacity: hover, focus ring */
  --sg-dur-base: 200ms;     /* tabs, chips, steppers, small reveals, toast exit */
  --sg-dur-medium: 280ms;   /* cards lifting, toast enter, the unsaved bar rising */
  --sg-dur-slow: 420ms;     /* screen-to-screen, skill-ring segment drawing, number roll */
  --sg-dur-ignite: 520ms;   /* a neon tube lighting up (state change only) */
  --sg-dur-scene: 900ms;    /* once per visit: the website hero, the "Edits saved" sign */
  --sg-dur-loop: 1400ms;    /* loading tube scanner: keeps running under reduced motion as a pulse */
  --sg-stagger: 60ms;       /* between siblings in the one orchestrated entrance */
  --sg-light-lag: 0.12;     /* pointer-light easing per frame (0-1): the sun follows, it doesn't snap */

  --sg-ease-out: cubic-bezier(.22, 1, .36, 1);      /* arrivals and most UI */
  --sg-ease-in-out: cubic-bezier(.65, 0, .35, 1);   /* things already on screen that move */
  --sg-ease-emph: cubic-bezier(.2, 0, 0, 1);        /* one element per view: the bar rising, the hero line */
  --sg-ease-exit: cubic-bezier(.4, 0, 1, 1);        /* leaving */

  --sg-lift: -2px;          /* hover lift for cards and round buttons (pointer devices only) */
  --sg-press: 0.97;         /* press scale for buttons */

  /* ================================================================ 9. IMAGERY
     Official art is shown big and never recoloured. Two treatments only: scrims (night gradients under any words) and,
     for daytime shots placed behind the night UI, a mild dim. Layer order on an art block: <img> (object-fit: cover)
     -> ::after scrim -> text. Every image also gets a 1px inner outline (outline: 1px solid; outline-offset: -1px). */
  /* Scrims are the contrast guarantee. Headings may sit where the scrim is >= 70% night (6.2:1 worst case on a white
     pixel); body text only where it is >= 80% (9.1:1 for text-1, 5.8:1 for text-2). */
  --sg-scrim-start: linear-gradient(90deg, rgb(16 15 39 / .9) 0%, rgb(16 15 39 / .8) 36%, rgb(16 15 39 / .4) 50%, rgb(16 15 39 / 0) 62%);
  --sg-scrim-end: linear-gradient(270deg, rgb(16 15 39 / .9) 0%, rgb(16 15 39 / .8) 36%, rgb(16 15 39 / .4) 50%, rgb(16 15 39 / 0) 62%);
  --sg-scrim-bottom: linear-gradient(0deg, rgb(16 15 39 / .96) 0%, rgb(16 15 39 / .86) 26%, rgb(16 15 39 / .4) 56%, rgb(16 15 39 / 0) 78%);
  --sg-scrim-top: linear-gradient(180deg, rgb(16 15 39 / .7) 0, rgb(16 15 39 / 0) 9rem);   /* behind a nav over art */
  --sg-scrim-floor: linear-gradient(0deg, var(--sg-bg) 0%, var(--sg-bg) 12%, rgb(16 15 39 / .55) 26%, rgb(16 15 39 / 0) 40%); /* art melting into the page */
  --sg-start-x: 0%;   /* the reading-start edge as a position; 100% in RTL */
  --sg-scrim-mast: radial-gradient(52% 150% at var(--sg-start-x) 0%, rgb(16 15 39 / .9) 0%, rgb(16 15 39 / .8) 42%, rgb(16 15 39 / 0) 100%),
                   linear-gradient(180deg, rgb(16 15 39 / .55) 0%, rgb(16 15 39 / .25) 40%, rgb(16 15 39 / .9) 88%, var(--sg-night-900) 100%); /* app masthead: the brand corner is always dark enough for 13px text */
  --sg-dim-day: saturate(.9) brightness(.75);  /* `filter:` for daytime shots behind night UI (app mastheads, steps 1-2) */
  --sg-image-outline: rgb(255 255 255 / .1);   /* the 1px inner outline on every image */
  --sg-palm-shadow: rgb(46 26 84 / .16);       /* palm-shadow.svg's colour if you use it as a CSS mask on day surfaces */

  /* ================================================================ 10. LAYERS */
  --sg-z-raised: 1;
  --sg-z-sticky: 20;   /* website nav, app masthead when it sticks */
  --sg-z-bar: 30;      /* the unsaved-changes bar */
  --sg-z-toast: 40;
  --sg-z-moment: 50;   /* "Edits saved" */
  --sg-z-skip: 60;     /* the skip link */

  /* ================================================================ 11. COMPONENT TOKENS (only where states multiply) */
  --sg-control-h: 2.75rem;      /* 44px: every button, input and stepper on touch-capable screens */
  --sg-control-h-sm: 2.25rem;   /* 36px visual; keep a 44px hit area around it */
  --sg-control-h-lg: 3.25rem;   /* 52px: website hero CTA */
  --sg-round-btn: 4rem;         /* 64px: round section buttons (3.5rem under 600px) */
  --sg-ring-size: 4.5rem;       /* 72px skill ring (4rem under 600px) */
  --sg-ring-stroke: 5px;        /* ring tube thickness at 72px */
  --sg-input-bg: var(--sg-surface-sunken);
  --sg-input-border: var(--sg-line-control);
  --sg-input-border-hover: rgb(255 255 255 / .5);
  --sg-input-border-focus: var(--sg-focus);
  --sg-input-border-invalid: var(--sg-sign-red);
  --sg-bar-bg: rgb(26 23 52 / .97);  /* night-850 at 97%: solid enough to read over anything, no blur needed */
}

/* ------------------------------------------------------------------ P3 screens: the same sunset, less clipped */
@supports (color: oklch(0% 0 0)) {
  @media (color-gamut: p3) {
    :root {
      --sg-vice-magenta: oklch(65% .27 0);
      --sg-tangerine: oklch(77% .18 55);
      --sg-flamingo: oklch(79% .155 357);
    }
  }
}

/* ------------------------------------------------------------------ day: sun-bleached stucco (website sections only)
   Put data-light="day" on a section. Same keys, remapped: this is a designed light theme, not an inversion. */
[data-light="day"] {
  color-scheme: light;
  --sg-bg: var(--sg-stucco);
  --sg-surface-1: var(--sg-stucco-hi);
  --sg-surface-2: #ffffff;
  --sg-surface-3: #ffd3cd;
  --sg-surface-sunken: #f7d6d1;
  --sg-text-1: var(--sg-ink);
  --sg-text-2: var(--sg-ink-2);
  --sg-text-3: var(--sg-ink-3);
  --sg-text-accent: var(--sg-magenta-deep);
  --sg-text-projected: #9a5a00;
  --sg-line-1: rgb(31 28 63 / .08);
  --sg-line-2: rgb(31 28 63 / .14);
  --sg-line-control: rgb(31 28 63 / .5);   /* 3.1:1 on stucco */
  --sg-focus: #b5045a;
  --sg-tube-off: rgb(31 28 63 / .16);
  /* warm, hue-matched shadows: stucco throws rose-violet shade, never grey */
  --sg-elev-1: 0 1px 2px rgb(120 40 70 / .12), 0 8px 22px -8px rgb(120 40 70 / .2);
  --sg-elev-2: 0 2px 6px rgb(120 40 70 / .12), 0 18px 40px -12px rgb(120 40 70 / .26);
  --sg-elev-3: 0 6px 14px rgb(120 40 70 / .14), 0 32px 70px -18px rgb(120 40 70 / .32);
  --sg-image-outline: rgb(0 0 0 / .1);
}

/* ------------------------------------------------------------------ scripts and languages
   html[lang] is set by i18n.js (app) and by each page (website). Script fonts are the system's own: nothing extra
   is downloaded for Arabic, CJK or Cyrillic display. Never track Arabic or CJK; never italicise them. */
:root:lang(de), :root:lang(nl), :root:lang(pl) {
  --sg-display-stretch: var(--sg-display-stretch-tight);   /* "Speicherstände" fits a phone at 62% */
  --sg-display-scale: 0.94;
}
:root:lang(ru) {
  /* Archivo has no Cyrillic: display falls through to Onest (Cyrillic, but not condensed), so step down a little */
  --sg-display-scale: 0.86;
  --sg-tracking-display: 0;
  --sg-tracking-hero: 0;
}
:root:lang(ar) {
  --sg-font-text: "Onest SG", "Segoe UI", "Noto Sans Arabic", "SF Arabic", "Geeza Pro", Tahoma, system-ui, sans-serif;
  --sg-font-display: "Archivo SG", "Segoe UI", "Noto Kufi Arabic", "Noto Sans Arabic", "SF Arabic", "Geeza Pro", Tahoma, sans-serif;
  --sg-display-scale: 0.86;
  --sg-display-style: normal;
  --sg-tracking-hero: 0;
  --sg-tracking-display: 0;
  --sg-tracking-label: 0;     /* letter-spacing breaks Arabic joining */
  --sg-leading-display: 1.25;
  --sg-leading-heading: 1.35;
  --sg-leading-body: 1.75;
  --sg-sunset-angle: 260deg;
}
:root:lang(ja), :root:lang(ko), :root:lang(zh) {
  --sg-display-scale: 0.78;   /* full-width glyphs read about a fifth larger than Latin at the same size */
  --sg-display-style: normal;
  --sg-tracking-hero: 0;
  --sg-tracking-display: 0;
  --sg-tracking-label: 0;
  --sg-leading-display: 1.22;
  --sg-leading-heading: 1.3;
  --sg-leading-body: 1.75;
}
:root:lang(ja) {
  --sg-font-text: "Onest SG", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
  --sg-font-display: "Archivo SG", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
}
:root:lang(ko) {
  --sg-font-text: "Onest SG", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
  --sg-font-display: "Archivo SG", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
}
:root:lang(zh) {
  --sg-font-text: "Onest SG", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --sg-font-display: "Archivo SG", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
}
[dir="rtl"] {
  --sg-sunset-angle: 260deg;
  --sg-start-x: 100%;
}

/* ------------------------------------------------------------------ reduced motion
   Durations collapse so every state still arrives, instantly. Pointer light, tilt, parallax and the ignition flicker
   are switched off in JS by reading --sg-motion (0 = off). Loading indicators keep --sg-dur-loop but pulse instead of
   travelling (see SYSTEM.md). Colour and opacity changes stay. */
:root { --sg-motion: 1; }
@media (prefers-reduced-motion: reduce) {
  :root {
    --sg-motion: 0;
    --sg-dur-instant: 1ms;
    --sg-dur-base: 1ms;
    --sg-dur-medium: 1ms;
    --sg-dur-slow: 1ms;
    --sg-dur-ignite: 1ms;
    --sg-dur-scene: 1ms;
    --sg-stagger: 0ms;
    --sg-lift: 0px;
    --sg-press: 1;
    /* --sg-dur-fast stays: colour and focus changes are not motion */
  }
}

/* ------------------------------------------------------------------ keyframes both surfaces share */

/* A neon tube lighting: a stutter, then steady. Animate the GLOW layer's opacity (a ::after or the halo filter),
   never the text, so the label is readable from the first frame. Only on a state change, never on hover. */
@keyframes sg-ignite {
  0% { opacity: 0; }
  9% { opacity: .9; }
  16% { opacity: .2; }
  27% { opacity: 1; }
  34% { opacity: .55; }
  46%, 100% { opacity: 1; }
}
/* The loading tube: a bright segment travels along an unlit tube. */
@keyframes sg-scan {
  from { transform: translateX(-100%); }
  to { transform: translateX(260%); }
}
/* Reduced-motion stand-in for sg-scan: the tube breathes in place. */
@keyframes sg-breathe {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}
/* Arrivals: up and in. Exits use the same keyframes reversed at 75% of the duration. */
@keyframes sg-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes sg-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
