/* Design tokens: the Survey style (see the map-game-style skill).

   Every colour, size and spacing the game's CSS uses is defined here, and only here.
   The canvases read the same values from MG.style in js/config.js; change both together.
   Fluid sizes run from a 375px wide window (phone) to a 1280px one (desktop):
   clamp(phone, …, desktop), with both values in the comment.
   They're on :root because the game has the page to itself (the game template), so the
   page background and popups can use them too. */

:root {
  /* ---- colours ---- */
  --chrome: #F4F5F1;          /* page background */
  --paper: #FCFCFA;           /* map paper and every surface */
  --sheet: #F1F2EE;           /* map margin, quiet panels */
  --ink: #1D2421;             /* text */
  --muted: #66706A;           /* secondary text and labels */
  --line: #D9DDD6;            /* borders, dividers, empty tracks */
  --contour: #2A2622;         /* contour lines while guessing */
  --contour-relief: rgba(74, 52, 34, 0.62);
  --grid: #C6D6E6;            /* the 1 km grid */
  --sea: #DDEEF0;             /* the sea on a map with one (a special map's), by the coast */
  --coast: #2E6E7C;           /* its coast */
  --you: #F26A1B;             /* the player, and only the player */
  --you-deep: #C9500E;
  --you-tint: #FFF1E8;
  --answer: #1E4FC2;          /* the answer, and only the answer */
  --answer-tint: #E4ECFA;
  --danger: #E0402C;          /* errors and notifications only */
  --danger-deep: #B3261A;     /* a destructive button's fill (white text on it 6.5:1; on --danger only 4.3:1) */
  --grass: #86A860;
  --rock: #A29C93;
  --white: #FFFFFF;
  --gold: #F2B33D;            /* festive: particles and the streak outline only */
  --flag: #D7263D;            /* a special map's flag in the 3D view (Find a friend's red pole), never the page's own UI */
  --violet: #8E5BD9;
  --clue-hit: #2F7D3B;        /* a clue that's right, in a round of several guesses (white text on it 5.1:1)... */
  --clue-near: #EBC44B;       /* ...one that's close (ink text on it 9.5:1)... */
  --clue-miss: #CDD2CA;       /* ...and one that's far off (ink text on it 10.3:1): lighter or darker than the green, for colour-blind players */
  --on-image: rgba(20, 26, 23, 0.58);
  --on-image-hover: rgba(20, 26, 23, 0.78);
  --on-image-fade: rgba(12, 18, 14, 0.5);
  --backdrop: rgba(20, 26, 23, 0.45);
  --view-sky: #B9D3EE;        /* behind the view while it draws */
  --view-loading: rgba(244, 245, 241, 0.88);
  --danger-tint: #FBE6E2;

  /* ---- fonts ---- */
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* ---- type sizes ---- */
  --fs-score: clamp(4rem, 3.275rem + 3.094vw, 5.75rem);              /* 64 → 92 */
  --fs-title: clamp(1.75rem, 1.595rem + 0.663vw, 2.125rem);          /* 28 → 34 */
  --fs-brand: clamp(1.25rem, 1.172rem + 0.331vw, 1.4375rem);         /* 20 → 23 */
  --fs-heading: 1.375rem;                                            /* 22 */
  --fs-subheading: clamp(1.0625rem, 1.037rem + 0.11vw, 1.125rem);    /* 17 → 18 */
  --fs-data-lg: clamp(1.3125rem, 1.235rem + 0.331vw, 1.5rem);        /* 21 → 24 */
  --fs-data: 0.875rem;                                               /* 14 */
  --fs-body: 0.9375rem;                                              /* 15 */
  --fs-small: 0.8125rem;                                             /* 13 */
  --fs-label: clamp(0.6875rem, 0.776rem - 0.11vw, 0.75rem);          /* 12 → 11 */
  --fs-button: 1rem;                                                 /* 16 */
  --fs-button-lg: 1.0625rem;                                         /* 17 */
  --fs-chip: 0.8125rem;                                              /* 13 */
  --fs-kbd: 0.75rem;                                                 /* 12 */
  --fs-ruler: 0.625rem;                                              /* 10 */

  /* ---- spacing ---- */
  --sp-1: 0.25rem;   /* 4 */
  --sp-2: 0.5rem;    /* 8 */
  --sp-3: 0.75rem;   /* 12 */
  --sp-4: 1rem;      /* 16 */
  --sp-5: 1.25rem;   /* 20 */
  --sp-6: 1.5rem;    /* 24 */
  --sp-8: 2rem;      /* 32 */
  --sp-10: 2.5rem;   /* 40 */
  --sp-12: 3rem;     /* 48 */
  --gutter: clamp(0.75rem, 0.439rem + 1.326vw, 1.5rem);              /* 12 → 24 */
  --gap: clamp(0.75rem, 0.543rem + 0.884vw, 1.25rem);                /* 12 → 20 */

  /* ---- radii ---- */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 12px;
  --r-sheet: 22px;
  --r-pill: 999px;
  --r-button: var(--r-md);

  /* ---- heights ---- */
  --h-bar: clamp(3.125rem, 2.97rem + 0.663vw, 3.5rem);               /* 50 → 56 */
  --h-button: 3rem;      /* 48 */
  --h-cta: 3.25rem;      /* 52 */
  --h-icon: 2.25rem;     /* 36 */
  --h-on-image: 1.875rem;/* 30 */
  --h-track: 10px;
  --h-fade: 30px;
  --icon: 1.125rem;      /* 18 */
  --icon-chip: 0.9375rem;/* 15 */

  /* ---- lines and shadows ---- */
  --border: 1px solid var(--line);
  --shadow-primary: 0 2px 0 var(--you-deep);
  --shadow-primary-hover: 0 3px 0 var(--you-deep);
  --shadow-map: 0 6px 14px rgba(30, 36, 33, 0.14);
  --shadow-sheet: 0 -10px 30px rgba(20, 26, 23, 0.22);
  --shadow-popup: 0 18px 40px -18px rgba(0, 0, 0, 0.45);
  --shadow-image-chip: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-tooltip: 0 4px 12px rgba(0, 0, 0, 0.25);
  --text-shadow-image: 0 1px 2px rgba(0, 0, 0, 0.6);
  --vignette: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.24));

  /* ---- motion ---- */
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 400ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.25, 1);

  /* ---- layers ---- */
  --z-map-overlay: 2;
  --z-view-special: 2;        /* a special map's own layer over the view (js/ui/viewPanel.js), under its chips and buttons */
  --z-view-overlay: 3;
  --z-rules: 15;              /* a special map's rules on phones: over the map, under the dock */
  --z-dock: 20;
  --z-sheet: 30;
  --z-menu: 35;
  --z-fx: 40;
  --z-tooltip: 45;
}

/* A special map's colours: its button, chip, Rules button and rules panel. A theme (css/themes/<name>.css)
   sets its own, keeping orange the player's and blue the answer's, and text on --special at 4.5:1 or more.
   data-theme="" asks for these, the default, inside a themed special map (the Dev tools' ruleset dots). */
:root, #mapgame [data-theme=""] {
  --special: #7B4FC9;         /* white text on it 5.4:1 */
  --special-ink: #FFFFFF;     /* text and icons on --special */
  --special-tint: #F1EAFB;    /* a quiet background */
  --special-deep: #5B35A0;    /* text on --special-tint */
}

/* Touch: bigger controls and labels (layout is decided by size, these by the pointer). */
@media (pointer: coarse) {
  :root {
    --fs-label: 0.75rem;   /* 12 */
    --fs-ruler: 0.6875rem; /* 11 */
    --h-button: 3.125rem;  /* 50 */
    --h-cta: 3.375rem;     /* 54 */
    --h-icon: 2.75rem;     /* 44 */
    --h-on-image: 2.75rem; /* 44 */
    --h-fade: 36px;
    --r-button: var(--r-xl);
  }
}
