/* Ski Map design tokens (D1 colour scheme, D2 Apple-style type and motion).
   One place for every colour, font, radius and timing. The map layers read the same variables (map.js, token()),
   so changing a value here restyles both the panels and the map.
   Palette: a classic hand-painted Alpine piste map (snow white, cool blue-violet shadows, dark painted forest,
   grey rock, glacier ice) with the European piste colours. It's a stand-in until the owner's reference image
   arrives; see design/README.md for how to swap it. */
:root {
  /* ---------- Terrain (the map itself) ---------- */
  --snow: #f7f9fc;                 /* open ground: everything reads as snow, like a winter piste map */
  --snow-shadow: #3f5885;          /* hillshade shadows, painted blue-violet rather than grey */
  --snow-light: #fffdf6;           /* sunlit slopes, a touch warm */
  --snow-mid: #7489ad;             /* hillshade accent along ridges */
  --forest: #4d7a58;               /* conifer forest below the tree line */
  --rock: #b9b2a8;                 /* bare rock and scree, warm grey */
  --glacier: #e3f0fa;              /* glacier ice */
  --glacier-edge: #a8c8e2;
  --water: #8dbad9;                /* alpine lakes and rivers */
  --water-ink: #2f5f8a;
  --village: #ebe5da;              /* built-up areas, warm like chalets */
  --building: #ddd3c3;
  --building-edge: #cbbfab;
  --road: #ffffff;
  --road-casing: #d4cbbd;
  --road-minor: #e4ddd1;
  --border: #9c8fa6;               /* country and region borders */
  --sky: #b9d4ef;                  /* the sky above the ridge line in the 3D view (focus.js) */
  --sky-horizon: #eaf2fb;          /* haze where the sky meets the far mountains */
  --map-ink: #27313d;              /* place names on the map */
  --map-halo: #ffffff;

  /* ---------- Pistes and lifts (European standard) ---------- */
  --piste-green: #1f9a4b;          /* beginner (France, Spain, Scandinavia) */
  --piste-blue: #1565c0;           /* easy */
  --piste-red: #d7282f;            /* intermediate */
  --piste-black: #16181c;          /* difficult and expert */
  --piste-offpiste: #ee7d1a;       /* ski routes, freeride (dashed) */
  --piste-unknown: #7a8696;
  --piste-edge: #ffffff;           /* the white edge that makes pistes read on terrain */
  --piste-sheen: #ffffff;          /* the light down the middle of a piste that rounds it off (map.js) */
  --resort-outline: var(--navy);   /* the line around the selected resort (outline.js) */
  --lift: #1d1d1f;                 /* lifts: black lines with pylon dots */
  --lift-closed: #8a96a3;
  --selection: #ffcc00;            /* glow around the selected piste, lift or resort */
  --poi-food: #a4502a;             /* restaurants, cafés and mountain huts, warm like a hut on a piste map */
  --poi-parking: #1f5fbf;           /* car parks: the blue of a road-sign "P" */
  --poi-park: #7a52c7;                 /* snow parks: pin, area tint and name (parks.js) */
  --poi-kids: #d4701a;                 /* kids' areas (playgrounds) */
  --poi-junction: var(--navy);         /* piste junctions, places to stop and wait: the ring and glyph of the marker (junctions.js) */
  --poi-offpiste: var(--piste-offpiste);  /* the diamond sign where an off-piste route starts, and the off-piste warning (offpiste.js) */
  --poi-offpiste-ink: var(--text);        /* the "!" on the sign: dark on orange reads better than white */
  --poi-offpiste-text: #a24d06;           /* route names under the signs and the warning's title: the orange, dark enough to read */

  /* ---------- Interface ---------- */
  --navy: #0b2545;                 /* brand: resort dots, titles */
  --navy-rgb: 11 37 69;            /* for tints: rgb(var(--navy-rgb) / .07) */
  --text: #16202c;
  --muted: #5b6b7c;
  --accent: #0066cc;               /* blue for links, buttons and selected states: 5.6:1 on white, so text in it and white
                                      text on it pass WCAG AA (the system blue #0a84ff is 3.6:1; OBJECTIVES D-1) */
  --accent-rgb: 0 102 204;
  --accent-hover: #0055b3;         /* darker still, so a hovered button keeps its contrast */
  --accent-map: #0a84ff;           /* the bright system blue for what's drawn on the map: your location, the route and a
                                      recorded track. It stands apart from blue pistes; not for text */
  --focus-ring: var(--accent);     /* opaque: 5.6:1 on white and on the snow page (the old 50% tint was 2.2:1, under
                                      WCAG 1.4.11's 3:1 for focus indicators) */
  --focus-ring-on-dark: #ffffff;   /* on navy and other dark surfaces */
  --on-accent: #ffffff;
  --page: var(--snow);

  --fill: rgb(var(--navy-rgb) / .05);         /* stat tiles, quiet boxes */
  --fill-2: rgb(var(--navy-rgb) / .07);       /* buttons, segmented controls */
  --fill-hover: rgb(var(--navy-rgb) / .12);
  --separator: rgb(var(--navy-rgb) / .08);
  --separator-soft: rgb(var(--navy-rgb) / .06);
  --stroke: rgb(var(--navy-rgb) / .15);

  --sos: #d92d20;
  --sos-rgb: 217 45 32;
  --sos-dark: #b42318;
  --badge: #e5362f;                /* unread counts, compass north */
  --live: #1f9d55;                 /* "sharing your location" */
  --switch-on: #248a3d;            /* iOS's increased-contrast green: the white knob is 4.4:1 on it (#34c759 was 2.2:1) */
  --switch-off-edge: rgb(var(--navy-rgb) / .55);  /* the off track's rim: 3.7:1 on white, so an off switch is visible */
  --caution: #f5a300;              /* favourite stars */
  --caution-ink: #6b4300;
  --caution-strong: #b25000;       /* poor GPS accuracy */
  --paused: #c45200;               /* a paused recording (the home page's record button); white text on it is 4.6:1 */
  --severe: #d70015;               /* severe weather and high avalanche danger */
  --severe-ink: #8f0010;
  /* Weather heads-ups: each kind has its own calm colour, like a weather app; severe ones turn --severe */
  --wx-fog: #66768c;               /* low visibility: slate */
  --wx-wind: #13859a;              /* strong wind: teal */
  --wx-snow: #3a86d4;              /* heavy snowfall: sky blue */
  --wx-cold: #5468d4;              /* extreme cold: ice indigo */
  --wx-storm: #7a52c7;             /* thunderstorms: violet */
  --wx-avalanche: #d9730d;         /* avalanche danger: orange, as on the EAWS scale */
  --destructive: #c62828;

  /* ---------- Frosted glass (Apple "materials") ---------- */
  --glass: rgba(255, 255, 255, .72);          /* controls, search, legend */
  --glass-thick: rgba(255, 255, 255, .84);    /* cards and sheets that hold text */
  --glass-solid: rgba(255, 255, 255, .94);    /* menus and popups */
  --glass-border: rgba(255, 255, 255, .6);
  --blur: saturate(180%) blur(20px);
  --blur-thick: saturate(180%) blur(30px);
  --shadow: 0 6px 24px rgb(var(--navy-rgb) / .14), 0 1px 3px rgb(var(--navy-rgb) / .08);
  --shadow-sheet: 0 -2px 24px rgb(var(--navy-rgb) / .12), 0 0 1px rgb(var(--navy-rgb) / .2);
  --grabber: rgba(60, 60, 67, .3);

  /* ---------- Type: the system font, which is SF Pro on Apple devices ---------- */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* The ALPINE wordmark: a classic serif in spaced capitals, as in the logo (Baskerville on Apple devices) */
  --font-brand: Baskerville, "Baskerville Old Face", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-title: 20px;
  --tracking-title: -.016em;       /* SF's tighter tracking at title sizes */

  /* ---------- Shape and space ---------- */
  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --gutter: max(16px, env(safe-area-inset-left));
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  /* ---------- Motion ---------- */
  --ease: cubic-bezier(.25, .1, .25, 1);      /* standard */
  --ease-out: cubic-bezier(.2, .8, .2, 1);    /* things arriving: decelerate gently */
  --ease-sheet: cubic-bezier(.32, .72, 0, 1); /* iOS sheet curve */
  --dur-fast: .2s;
  --dur: .32s;
  --dur-slow: .45s;
}

/* ---------- Accessibility defaults for every page (see design/README.md, "Accessibility") ---------- */
/* A focus ring for anything that has no style of its own; :where() keeps it weaker than every page's own rule */
:where(a, button, input, select, textarea, summary, [tabindex], [contenteditable]):focus-visible {
  outline: 3px solid var(--focus-ring); outline-offset: 2px;
}
/* Two quick presses on a control are two presses, not Safari's double-tap zoom (iOS Safari 27, 2026-11-04: the map's +
   pressed twice zoomed the whole page to 1.6x). Pinch zoom stays; :where() lets a page's own touch-action win */
:where(a, button, input, select, textarea, label, summary, [role="button"], [role="tab"], [role="switch"], [role="option"]) {
  touch-action: manipulation;
}
/* Text for screen readers only (the same rule some pages already had; now on every page) */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Windows high contrast drops box shadows, which some focus styles use: give every focused element a system outline */
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid CanvasText !important; outline-offset: 2px; }
}
/* Reduced motion: transitions and animations finish at once, everywhere, as a safety net under each page's own rules.
   Map camera moves are JavaScript: MapLibre turns flyTo, easeTo and fitBounds into jumps under the same setting
   unless a call says essential: true (none do), and map.js checks it too */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: .01ms; --dur: .01ms; --dur-slow: .01ms; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
