/* The CST Practice theme: every colour the pages use, by name, for the light theme and the dark one.
   Every page loads it first; the other stylesheets only use these names (var(--name)), so a colour is
   changed here, once. The pages start dark (theme.js sets data-theme, dark unless the header switch chose light),
   which gives the same names their dark values below; these first values are the light theme.

   The ☘️ Irish colours at the end of this file (greens in place of the indigo, on top of light or dark) are
   switched off for now (IRISH_THEME in theme.js), and their button hidden.

   Drawn pictures (dice, polygon and map cards, charts, the 3D scene, the PDF report) are made in the
   scripts and keep their own colours; on the page the card colours below restyle the polygon cards. */

:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  --radius: 18px;

  /* Page: cool grey background, white surfaces, indigo accent, teal for status. */
  --bg: #f3f5fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #5b6477;
  --border: #e1e6ef;
  --accent: #4f46e5;           /* filled buttons and the selected duration */
  --accent-text: #ffffff;      /* text on any filled button */
  --brand: #4338ca;            /* small section labels */
  --teal: #0f766e;
  --teal-bg: #e6f6f3;
  --tint: #eef2ff;             /* soft indigo panels: score card, letter tiles */
  --tint-text: #3730a3;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px rgb(15 23 42 / 0.06);
  --backdrop: rgb(15 23 42 / 0.45);          /* behind dialogs */
  --tooltip-shadow: 0 4px 12px rgb(0 0 0 / 0.08);
  --pad-shadow: 0 -6px 20px rgb(15 23 42 / 0.12); /* the number pad, along its top */

  /* Answers and states. */
  --correct: #16a34a;
  --wrong: #dc2626;
  --ok-text: #15803d;          /* darker than --correct so small text stays readable */
  --warn: #ea580c;
  --warn-text: #c2410c;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  --danger-fill: #dc2626;
  --danger-fill-hover: #b91c1c;
  --go-fill: #15803d;
  --go-fill-hover: #166534;

  /* The Correct / Wrong overlay on an example: white text on a see-through green or red. */
  --overlay-text: #ffffff;
  --overlay-text-shadow: 0 1px 4px rgb(0 0 0 / 0.45), 0 0 14px rgb(0 0 0 / 0.25);
  --overlay-correct: rgb(22 163 74 / 0.4);
  --overlay-wrong: rgb(220 38 38 / 0.4);

  /* Landing and information pages. */
  --hero-from: #eef2ff;
  --hero-to: #e0f2fe;
  --preview-bg: #eef2ff;
  --timed-bg: #e8f7ee;
  --timed-text: #166534;
  --soon-bg: #fef3c7;          /* "Coming soon": yellow */
  --soon-text: #92400e;
  --notice-bg: #fff7ed;
  --notice-text: #9a3412;

  /* Account bar and plan badges. */
  --account-ok-bg: #e6f6f3;
  --account-ok-text: #0f766e;
  --account-free-bg: #fff7ed;
  --account-free-text: #9a3412;
  --account-full-bg: #e8f7ee;
  --account-full-text: #166534;
  --account-limited-bg: #fef3c7; /* the free plan's "Limited access": yellow */
  --account-limited-text: #92400e;

  /* Snackbars: the yellow one (account messages) and the red one for errors. */
  --snackbar-bg: #facc15;
  --snackbar-hover-bg: #fde047;
  --snackbar-text: #1f2937;
  --error-snackbar-bg: #b91c1c;
  --error-snackbar-text: #ffffff;
  --error-snackbar-hover: rgb(255 255 255 / 0.18); /* its close button */
  --error-snackbar-shadow: 0 8px 24px rgb(0 0 0 / 0.25);

  /* Charts: slots 1-4 of the validated reference palette (light surface), gridlines and baseline. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #8a5cd0;
  --grid: #e7eaee;
  --baseline: #b8c0ca;

  /* Polygon cards stay white with a light shape in both themes, like the dice; only the page around them
     (and the arrow between them) follows the theme. */
  --card-bg: #ffffff;
  --card-border: #cbd5e1;
  --card-ref: #4338ca;         /* the left card's border, and the overlapped shape */
  --shape-fill: #eef2ff;
  --shape-stroke: #1e1b4b;
  --arrow: #94a3b8;

  /* The map's legend stays light in both themes, like the map. */
  --map-legend-bg: #fbfaf7;
  --map-legend-border: #e7e5e4;
  --map-legend-text: #374151;
}

/* Dark: the default, unless the header switch chose light (theme.js). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1020;
  --surface: #171b2e;
  --text: #e6e8f2;
  --muted: #a0a8bf;
  --border: #2b3150;
  --accent: #5b5ef0;
  --brand: #a5b4fc;
  --teal: #2dd4bf;
  --teal-bg: #12332f;
  --tint: #232a4d;
  --tint-text: #c7d2fe;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  --backdrop: rgb(0 0 0 / 0.6);
  --tooltip-shadow: 0 4px 16px rgb(0 0 0 / 0.5);
  --correct: #22c55e;
  --wrong: #f87171;
  --ok-text: #4ade80;
  --warn: #fb923c;
  --warn-text: #fdba74;
  --danger-bg: #3a1d24;
  --danger-text: #fca5a5;
  --hero-from: #1a1f3d;
  --hero-to: #10243a;
  --preview-bg: #1d2244;
  --timed-bg: #12301f;
  --timed-text: #4ade80;
  --soon-bg: #3b2f0b;
  --soon-text: #fcd34d;
  --notice-bg: #3b2414;
  --notice-text: #fdba74;
  --account-ok-bg: #12332f;
  --account-ok-text: #5eead4;
  --account-free-bg: #3b2414;
  --account-free-text: #fdba74;
  --account-full-bg: #12301f;
  --account-full-text: #4ade80;
  --account-limited-bg: #3b2f0b;
  --account-limited-text: #fcd34d;
  --error-snackbar-bg: #dc2626;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #9a72e0;
  --grid: #262c47;
  --baseline: #4a5274;
  --arrow: #6b7394;
}

/* Irish colours (data-irish, the ☘️ Irish button): greens in place of the indigo. The light values come
   first and the dark ones after, more specific, so they win in the dark theme; every name set for light
   that the dark theme also sets is set again for dark. The button shows only while theme.js offers them. */
:root:not([data-irish-theme]) #irish-toggle { display: none; }
:root[data-irish="on"] {
  --bg: #f1f7f3;
  --border: #dbe9df;
  --accent: #15803d;
  --brand: #166534;
  --tint: #e5f4ea;
  --tint-text: #14532d;
  --hero-from: #e5f4ea;
  --hero-to: #d9f2e3;
  --preview-bg: #e5f4ea;
  /* The cards stay white in both themes; only their border and shape turn green. */
  --card-ref: #15803d;
  --shape-fill: #e9f7ee;
  --shape-stroke: #14532d;
}

:root[data-irish="on"][data-theme="dark"] {
  --bg: #0a140e;
  --surface: #122019;
  --text: #e5efe8;
  --muted: #9cb3a4;
  --border: #23392c;
  --accent: #15803d;
  --brand: #86efac;
  --tint: #163323;
  --tint-text: #bbf7d0;
  --hero-from: #0f2618;
  --hero-to: #0c2a20;
  --preview-bg: #142e1e;
  --arrow: #5f7a69;
}

/* Visitors who ask their system for less motion: no nudging arrows, turning spinner or sliding bars. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
