/* The Nightmap design tokens. Look chosen by the owner 2026-11-26: dark frosted panels, one sans-serif, solid blue to press.
   The one place a colour, size, radius, duration or layer number is written down. Everything in the new interface (css/nm-base.css, the kit,
   the shell) reads these and never a literal: `npm run lint:ui` fails on a hex or rgb() value anywhere else.
   Names start --ui- so they cannot collide with the older --nm-* (css/nm-theme.css, NightMap.css) and --nmc-* tokens while both exist.
   Sun, Moon and eclipse glyph colours are physical and are not tokens.

   Layer order for all new CSS. Unlayered legacy CSS beats every layer, so on a page that still loads legacy styles the legacy sheets have to be
   pulled into the `legacy` layer (@import url(...) layer(legacy)) for these to win.
   `force` is for one job only: overriding a legacy rule that is marked !important. Among !important rules the earliest layer wins, so a rule in
   `force` must itself be !important and then beats legacy's. Its normal declarations lose to everything. Keep it small; each rule there is debt. */
@layer force, legacy, ui.tokens, ui.base, ui.kit, ui.shell, ui.page;

@layer ui.tokens {
  :root {
    /* Colour: cool dark, four surface steps. Floating panels are frosted glass over whatever is behind them. */
    --ui-night: #0c1017;            /* page, and the surround of map and sky */
    --ui-surface-1: #141a24;        /* bars, cards, sticky cells: solid */
    --ui-surface-2: #1c2330;        /* rows and inputs on a surface */
    --ui-surface-3: #283040;        /* secondary buttons, hover, selected */
    --ui-glass: rgba(17, 22, 30, 0.82);   /* floating panels, with --ui-glass-blur behind */
    --ui-glass-blur: 18px;
    --ui-glass-strong: rgba(17, 22, 30, 0.92);   /* the same glass, tinted heavier, for the bar along the bottom of the orbit views and its settings panel */
    /* translucent glass (the station views' tour guide cards): a quiet deep blue tint and a hairline edge */
    --ui-frost: rgba(18, 36, 56, 0.5);
    --ui-frost-sheen: rgba(255, 255, 255, 0.05);
    --ui-frost-clear: rgba(255, 255, 255, 0);
    --ui-frost-rim: rgba(190, 215, 245, 0.2);
    --ui-line: rgba(255, 255, 255, 0.12);
    --ui-line-strong: rgba(255, 255, 255, 0.2);
    --ui-text: #ffffff;             /* 17:1 on surface 1 */
    --ui-text-2: #e2e7ee;           /* body copy */
    --ui-muted: #a5afbd;            /* labels: 7.9:1 on surface 1, 6:1 on surface 3 */
    --ui-accent: #94b8f7;           /* links, the current choice, slider fill: 8.6:1 on surface 1 */
    --ui-on-accent: #0c1730;
    --ui-accent-wash: rgba(148, 184, 247, 0.18);
    --ui-orbitcam: #f0b93b;         /* OrbitCam's own gold, only for its name, button and page */
    --ui-orbitcam-wash: rgba(240, 185, 59, 0.16);
    --ui-orbitcam-line: rgba(240, 185, 59, 0.6);
    --ui-action: #2f62c4;           /* filled buttons, switches that are on, the current place */
    --ui-on-action: #ffffff;        /* 5.7:1 on action */
    --ui-good: #8fd6a0;
    --ui-caution: #f0bf6c;
    --ui-problem: #ffa2a2;
    --ui-scrim: rgba(6, 9, 14, 0.62);  /* behind a dialog */
    --ui-focus: #b7d0ff;
    /* the sky through a day, for time sliders; and peak names on a map */
    --ui-sky-day: #5f9fe0;
    --ui-sky-golden: #e8a55a;
    --ui-sky-civil: #8a6aa8;
    --ui-sky-nautical: #35457d;
    --ui-sky-astro: #1b2550;
    --ui-sky-night: #080c1c;
    --ui-peak: #ffe2ab;
    --ui-reserve: #dacde5;          /* dark-sky reserves on the map: a pale purple that shows on satellite pictures */

    /* Type: the device's own sans-serif (SF Pro on Apple). The serif and mono names stay so pages need no change, and point at it too. */
    --ui-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --ui-font-serif: var(--ui-font-sans);
    --ui-font-mono: var(--ui-font-sans);
    --ui-size-display: 44px;  --ui-lh-display: 48px;
    --ui-size-title: 28px;    --ui-lh-title: 32px;
    --ui-size-heading: 17px;  --ui-lh-heading: 22px;
    --ui-size-body: 15px;     --ui-lh-body: 22px;
    --ui-size-small: 13px;    --ui-lh-small: 18px;
    --ui-size-label: 13px;    --ui-lh-label: 18px;
    --ui-track-label: 0;

    /* Space: 4 pt */
    --ui-space-1: 4px;  --ui-space-2: 8px;  --ui-space-3: 12px; --ui-space-4: 16px;
    --ui-space-5: 24px; --ui-space-6: 32px; --ui-space-7: 48px;
    --ui-gutter: 18px;              /* side padding of a sheet or page; 24px from 1024 up (set in nm-base.css) */

    /* Shape */
    --ui-radius-control: 10px;      /* anything pressed or typed in */
    --ui-radius-card: 14px;         /* cards */
    --ui-radius-sheet: 18px;        /* a floating sheet; the top corners of a bottom sheet */
    --ui-radius-pill: 999px;        /* chips and switches only */
    --ui-target: 44px;              /* smallest touch target, every close button included */
    --ui-control-h: 44px;
    --ui-control-h-small: 32px;
    --ui-bar-h: 60px;               /* the bottom bar on phones, before the safe area */
    --ui-rail-w: 64px;              /* the same navigation as a rail on desktop */
    --ui-sheet-w: 400px;            /* a side sheet on desktop */
    --ui-safe-top: env(safe-area-inset-top, 0px);
    --ui-safe-bottom: env(safe-area-inset-bottom, 0px);
    --ui-shadow-sheet: 0 16px 44px rgba(0, 0, 0, 0.38);   /* the one shadow: under a sheet floating over map or sky */

    /* Motion */
    --ui-dur-control: 160ms;
    --ui-dur-sheet: 240ms;
    --ui-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

    /* Layers. The map and its pins keep Leaflet's own numbers (up to 1000); the interface sits above them in this order. */
    --ui-z-bar: 1100;
    --ui-z-sheet: 1200;
    --ui-z-scrim: 1290;             /* the dimmer behind a dialog */
    --ui-z-dialog: 1300;
    --ui-z-toast: 1400;
    --ui-z-splash: 100100;          /* the welcome splash: above the old map's sheets and the tour */

    /* Breakpoints cannot be variables in a media query. The three sizes are: phone to 599px, tablet 600 to 1023px, desktop from 1024px.
       Write them only as (min-width: 600px) and (min-width: 1024px). */
  }

  /* Article variant: long-form guides only. Same token names, paper values. */
  .ui-article {
    --ui-night: #f2efe8;
    --ui-surface-1: #f2efe8;
    --ui-surface-2: #e9e5dc;
    --ui-surface-3: #dfdacf;
    --ui-line: rgba(35, 34, 31, 0.14);
    --ui-line-strong: rgba(35, 34, 31, 0.3);
    --ui-text: #23221f;
    --ui-text-2: #3b3934;
    --ui-muted: #5e5a53;
    --ui-accent: #1a6b7b;           /* 5.3:1 on paper */
    --ui-on-accent: #f2efe8;
    --ui-accent-wash: rgba(26, 107, 123, 0.1);
    --ui-action: #1a6b7b;
    --ui-on-action: #f2efe8;
    --ui-glass: rgba(242, 239, 232, 0.94);
    --ui-glass-strong: rgba(242, 239, 232, 0.97);
    --ui-font-serif: Georgia, "Times New Roman", serif;
    --ui-good: #2f7d45;
    --ui-caution: #8a5a12;
    --ui-problem: #a8322f;
    --ui-focus: #1a6b7b;
  }

  @media (prefers-reduced-motion: reduce) {
    :root { --ui-dur-control: 0ms; --ui-dur-sheet: 0ms; }
  }
}
