/* Design tokens: the one place colours, type, spacing, radii, shadows and motion are defined.
   docs/DESIGN-SYSTEM.md explains every group; web/design.html shows them. The map and the game quest both
   build on these names, so change a value here, never in a component.
   Look: calm and premium. The device's own type, frosted white surfaces with soft layered shadows, a violet
   accent for state, one gold thing per screen for "do this next" and "selected". Data colours (ramps,
   categories) stay neutral: a colour never means good or bad. */

:root {
  color-scheme: light;

  /* ---- colour roles ---- */
  /* surfaces */
  --c-bg: #eef0ea;            /* page behind the map = the map's land colour, so loading never flashes */
  --c-surface: #ffffff;       /* cards, sheets */
  --c-surface-2: #f7f6fa;     /* rows and wells inside a card */
  --c-surface-3: #f0eef6;
  --c-hover: #f0eef8;
  --c-overlay: rgba(255, 255, 255, .95);
  --c-scrim: rgba(28, 26, 38, .38);
  /* glass: surfaces that float on the map. Without a live blur they are almost solid; on a device with a real
     GPU the page adds `fx-glass` to <html> and they become frosted (see the end of this file). */
  --c-glass: rgba(255, 255, 255, .92);
  --c-glass-edge: rgba(255, 255, 255, .7);
  --glass-filter: none;
  /* ink */
  --c-ink: #1c1a26;
  --c-ink-2: #3f3c50;
  --c-muted: #6b6880;
  /* lines */
  --c-line: #ebe9f2;
  --c-line-strong: #d9d5e8;
  --c-control-edge: #85819c;
  /* accent: violet = active, chosen, links */
  --c-accent: #5b34d6;
  --c-accent-2: #7c5cf0;
  --c-accent-deep: #3a1f9e;
  --c-accent-soft: #f0ecff;
  --c-on-accent: #ffffff;
  /* gold = the next thing to do, selected on the map, rewards */
  --c-gold: #f5bd41;
  --c-gold-2: #fadc8c;
  --c-gold-deep: #b77e08;
  --c-gold-soft: #fdf4da;
  --c-on-gold: #2a1f05;
  /* supporting colours: feedback only, never used to rate a place */
  --c-mint: #12b886;
  --c-mint-soft: #e1f7ef;
  --c-sky: #3a8fe8;
  --c-sky-soft: #e6f1fd;
  --c-coral: #f0624e;
  --c-coral-soft: #fdebe8;
  /* chips */
  --c-chip: #f2f0f8;
  --c-chip-muted: #efeef3;
  /* states */
  --c-focus: #5b34d6;
  --c-warn-bg: #fff8e0;
  --c-warn-line: #ecdca0;
  --c-warn-ink: #5e4f00;
  --c-badge: #ffcc00;
  --c-on-badge: #000000;
  --c-tooltip: rgba(28, 26, 38, .92);
  --c-on-tooltip: #ffffff;
  --c-label-plate: rgba(255, 255, 255, .86);
  --c-selftest-bg: #111111;
  --c-selftest-ink: #99ffee;
  --c-swatch-edge: rgba(28, 26, 38, .12);
  --c-hatch-a: #efeef3;
  --c-hatch-b: #a4a1b5;
  /* map text drawn in HTML */
  --c-map-label: #1c1a26;
  --c-map-halo: #ffffff;
  --c-side-label: rgba(28, 26, 38, .66);
  --c-river-label: #46759b;
  --c-water: #a9d3ee;
  /* small text roles shared with the Lite view and the notices (game-0 shell) */
  --c-ink-3: #4f4c62;
  --c-sample: #f0eef6;
  --c-notice: #f2f1f6;
  --c-line-soft: #eeedf3;
  --c-line-faint: #f3f2f7;
  --c-segment-on: #1c1a26;    /* the active segment of a segmented control (components.css: ink with surface text) */
  --c-on-segment: #ffffff;
  --c-caveat-ink: #3f3c50;
  --c-caveat-line: #d9d5e8;
  --c-tooltip-edge: rgba(28, 26, 38, .12);
  --shadow-pop: 0 0 0 .5px rgba(28, 26, 38, .09), 0 2px 6px rgba(28, 26, 38, .06), 0 14px 32px -10px rgba(28, 26, 38, .24);
  /* Lite view (ui/lite/svgmap.js): one flat SVG of the areas on the map's land colour. Neutral fills; quest states
     step by lightness only (never red/green); the picked pin is two-tone so it shows on every fill. */
  --lite-bg: #eef0ea;
  --lite-res: #c9c6e0;
  --lite-nonres: #dddcde;
  --lite-edge: #555366;
  --lite-water: #a9d3ee;
  --lite-water-edge: #7fb0dc;
  --lite-strong: #3b2a6b;
  --lite-good: #6a51a3;
  --lite-soft: #9e9ac8;
  --lite-fog: #cdd0ca;
  --lite-picked: #f5bd41;
  --lite-b1: #0e4a5a;
  --lite-b2: #2f7d8f;
  --lite-b3: #78b2c0;
  --lite-b4: #bddbe3;
  --lite-week-pin: #1c1a26;
  --lite-week-pin-ring: #ffffff;
  --lite-flag-ring: #111111;
  --lite-selected: #111111;
  --lite-label: #1c1a26;
  --lite-label-halo: #ffffff;
  --lite-bridge: #4a4a4a;
  /* zoning bar: four categorical hues in a fixed order plus a neutral "other" (checked for colour-blind separation) */
  --z-0: #6250d6;
  --z-1: #eb6834;
  --z-2: #1baf7a;
  --z-3: #eda100;
  --z-4: #8d8aa0;

  /* ---- type: the device's own UI face (San Francisco, Roboto, Segoe). No webfont. ---- */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: system-ui, -apple-system, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --fw-display: 650;          /* headings, buttons, chips (falls to 600 or 700 where a face has no 650) */
  --fw-num: 700;              /* big numbers */
  --track-tight: -.022em;     /* big numbers and titles */
  --track-snug: -.011em;      /* headings, buttons */
  --track-caps: .09em;        /* small caps lines */
  --fs-2xs: 10.5px;  /* source lines, footnote marks */
  --fs-xs: 11.5px;   /* captions, sub-labels */
  --fs-sm: 12.5px;   /* chips, secondary text */
  --fs-base: 14px;   /* body */
  --fs-md: 15px;     /* tile labels, card titles */
  --fs-l: 16px;      /* buttons, section titles */
  --fs-xl: 20px;     /* page titles */
  --fs-2xl: 26px;    /* stat numbers, panel name */
  --fs-hero: 40px;   /* the one hero number in a view */

  /* ---- spacing (4 px grid), radii, shadows ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 28px;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --r-xl: 24px;
  --r-pill: 999px;
  /* soft, layered shadows: a hairline ring, a tight contact shadow and one wide ambient one. Only two levels. */
  --shadow-1: 0 0 0 .5px rgba(28, 26, 38, .09), 0 1px 2px rgba(28, 26, 38, .06), 0 6px 16px -6px rgba(28, 26, 38, .16);
  --shadow-2: 0 0 0 .5px rgba(28, 26, 38, .09), 0 2px 6px rgba(28, 26, 38, .06), 0 20px 44px -12px rgba(28, 26, 38, .26);
  /* "shelf": what makes a thing look pressable. A faint contact shadow for neutral parts, a soft glow of its own
     colour under the gold and violet buttons. */
  --shelf: 0 1px 2px rgba(28, 26, 38, .05);
  --shelf-accent: 0 6px 14px -4px rgba(91, 52, 214, .42);
  --shelf-gold: 0 6px 14px -4px rgba(183, 126, 8, .45);
  --ring: inset 0 0 0 1px var(--c-line);            /* hairline edge of a tile or row */
  --tap: 44px;                                      /* smallest touch target */
  --ico: 20px;                                      /* glyph size inside every tool and icon button */

  /* ---- motion: transform and opacity only ---- */
  --dur-fast: 140ms;   /* press, hover */
  --dur-base: 200ms;   /* chips, popovers */
  --dur-slow: 320ms;   /* sheets, panels */
  --dur-pop: 360ms;    /* reveal: tiles, toasts, level up */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-pop: cubic-bezier(.25, 1.25, .45, 1);     /* a small overshoot: things "land" */
  --press-scale: .97;
  --stagger: 40ms;                                  /* delay between tiles in a reveal */

  /* ---- layout ---- */
  --gap: 12px;
  --top-h: 46px;
  --foot-h: 30px;
  --panel-w: 408px;
}

/* Dark set (opt-in with <html data-theme="dark">; the map skin has no dark version yet, see DESIGN-SYSTEM §11). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #151326;
  --c-surface: #211e36;
  --c-surface-2: #2a2644;
  --c-surface-3: #332e52;
  --c-hover: #332e52;
  --c-overlay: rgba(33, 30, 54, .95);
  --c-glass: rgba(33, 30, 54, .92);
  --c-glass-edge: rgba(255, 255, 255, .08);
  --c-ink: #f4f2ff;
  --c-ink-2: #d6d1ee;
  --c-muted: #a9a3c7;
  --c-line: #3a3559;
  --c-line-strong: #4b4572;
  --c-control-edge: #7c76a3;
  --c-accent: #a48bff;
  --c-accent-2: #c2b0ff;
  --c-accent-deep: #5b34d6;
  --c-accent-soft: #33295e;
  --c-on-accent: #17132b;
  --c-gold-soft: #4a3a10;
  --c-mint-soft: #123f33;
  --c-sky-soft: #15314f;
  --c-coral-soft: #4d211c;
  --c-chip: #2f2a4d;
  --c-chip-muted: #2b2940;
  --c-focus: #c2b0ff;
  --c-tooltip: #f4f2ff;
  --c-on-tooltip: #17132b;
  --c-swatch-edge: rgba(255, 255, 255, .24);
  --c-warn-bg: #3a3214;
  --c-warn-line: #6b5a1e;
  --c-warn-ink: #f2dd8a;
  --c-label-plate: rgba(21, 19, 38, .8);
  --c-hatch-a: #3a3d44;
  --c-hatch-b: #8a8f99;
  --c-map-label: #f4f2ff;
  --c-map-halo: #151326;
  --c-side-label: rgba(244, 242, 255, .7);
  --c-river-label: #a9cdf2;
  --c-ink-3: #c9c4e2;
  --c-sample: #332e52;
  --c-notice: #2a2644;
  --c-line-soft: #2f2b4a;
  --c-line-faint: #2a2644;
  --c-segment-on: #f4f2ff;
  --c-on-segment: #17132b;
  --c-caveat-ink: #d6d1ee;
  --c-caveat-line: #4b4572;
  --c-tooltip-edge: #3a3559;
  --lite-bg: #151326;
  --lite-res: #3d3a5c;
  --lite-nonres: #2b2e35;
  --lite-edge: #9aa3b2;
  --lite-water: #27496b;
  --lite-water-edge: #4f7aa6;
  --lite-strong: #e9e4ff;
  --lite-good: #bcb1ee;
  --lite-soft: #8c84c4;
  --lite-fog: #1d2129;
  --lite-picked: #f5bd41;
  --lite-b1: #d3eef4;
  --lite-b2: #8ecbd8;
  --lite-b3: #4b93a5;
  --lite-b4: #245866;
  --lite-week-pin: #ffffff;
  --lite-week-pin-ring: #111111;
  --lite-flag-ring: #111111;
  --lite-selected: #ffffff;
  --lite-label: #f4f2ff;
  --lite-label-halo: #151326;
  --lite-bridge: #c8ccd4;
}

/* Frosted glass, only where it is cheap: the page sets this class once the map is running on a real GPU (never on
   a software renderer, a weak device, with "reduce motion" or data saver). Parts that use it: `.glass`. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root.fx-glass { --c-glass: rgba(255, 255, 255, .72); --glass-filter: blur(16px) saturate(1.7); }
  :root.fx-glass[data-theme="dark"] { --c-glass: rgba(33, 30, 54, .7); }
}

@media (max-width: 720px) {
  :root { --gap: 10px; --foot-h: 34px; --top-h: 48px; }
}

/* Reduced motion: every duration is 0 and nothing scales on press (app.css also stops all animations). */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; --dur-pop: 0ms; --stagger: 0ms; --press-scale: 1; }
}
