/* Iosevka Aile (Iosevka's proportional sibling, Latin subset) is the site font; OpenDyslexic is what "texto para dislexia" switches to.
   OpenDyslexic is drawn about 10% larger than Iosevka Aile at the same size (x-height 7%, capitals 15%), so size-adjust shrinks it to match: the same font size now reads as the same size. Both are self-hosted (the CSP only allows our own origin). SIL OFL: fonts/Iosevka-OFL.txt, fonts/OpenDyslexic-license.txt */
@font-face { font-family: "Iosevka Aile"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/iosevka-aile-400.woff2") format("woff2"); }
@font-face { font-family: "Iosevka Aile"; font-weight: 600 700; font-style: normal; font-display: swap; src: url("../fonts/iosevka-aile-700.woff2") format("woff2"); }
@font-face { font-family: "OpenDyslexic"; font-weight: 400; font-style: normal; font-display: swap; size-adjust: 90%; src: url("../fonts/opendyslexic-400.woff2") format("woff2"); }
@font-face { font-family: "OpenDyslexic"; font-weight: 600 700; font-style: normal; font-display: swap; size-adjust: 90%; src: url("../fonts/opendyslexic-700.woff2") format("woff2"); }

:root, [data-accent="green"] {
  /* The brand colour. Preferences can swap the whole set (data-accent on <html>); everything green in the
     interface comes from these. --brand: main colour; -deep / -soft: darker and lighter shades;
     -bright: the colour used on dark backgrounds; -night / -night2: the header in dark mode; -ink: text on -bright. */
  --brand: #0f6b3d; --brand-deep: #0a4a2a; --brand-soft: #1f9d5c; --brand-bright: #4cc98a;
  --brand-night: #0b3a24; --brand-night2: #13573a; --brand-ink: #07120c;
}
[data-accent="blue"] { --brand: #1d5fbf; --brand-deep: #14428a; --brand-soft: #3d82e0; --brand-bright: #6aa8ff; --brand-night: #0f2a52; --brand-night2: #1a3f78; --brand-ink: #07101f; }
[data-accent="purple"] { --brand: #6b3fb5; --brand-deep: #4b2a82; --brand-soft: #8a5fd6; --brand-bright: #b794f4; --brand-night: #2b1850; --brand-night2: #43267a; --brand-ink: #120a22; }
[data-accent="pink"] { --brand: #b0306a; --brand-deep: #7e2049; --brand-soft: #d4558e; --brand-bright: #ff8ab8; --brand-night: #4a1230; --brand-night2: #6e1c47; --brand-ink: #240812; }
[data-accent="orange"] { --brand: #b8570f; --brand-deep: #823d0a; --brand-soft: #d97a2b; --brand-bright: #ffa45c; --brand-night: #4a2305; --brand-night2: #6e3409; --brand-ink: #1f0f02; }
[data-accent="teal"] { --brand: #0e7c86; --brand-deep: #0a5860; --brand-soft: #25a3ad; --brand-bright: #4fd1da; --brand-night: #07343a; --brand-night2: #0d4e56; --brand-ink: #031a1d; }
[data-accent="graphite"] { --brand: #374151; --brand-deep: #1f2937; --brand-soft: #5b6677; --brand-bright: #cbd5e1; --brand-night: #111827; --brand-night2: #1f2937; --brand-ink: #0b0f17; }

/* Design tokens. Every other stylesheet refers to these, so a theme or an accessibility setting
   is just a different set of values here.

   <html> carries the user's choices as attributes (see js/lib/prefs.js):
     data-theme="light|dark"   data-cb="none|protanopia|deuteranopia|tritanopia"
     data-dyslexia="true|false"   and --font-size in px.

   The look: green and white (and a dark mode), square corners, no shadows. Green is the brand
   colour; right/wrong and warnings stay distinct and always come with a symbol or word. */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);      /* quick start, long soft landing */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* a small overshoot, for things that pop */
  --radius: 7px;     /* panels, cards, dialogs, fields, buttons */
  --radius-sm: 4px;  /* small things: chips, badges, bars */
  --radius-lg: 10px; /* the exam screen's question buttons, answers and bar buttons */
  --radius-round: 50%; /* dots: only on square things (avatars, radio dots), or it turns into an oval */
  --font-size: 16px;
  --font-body: "Iosevka Aile", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --letter-spacing: normal;
  --word-spacing: normal;
  --line-height: 1.55;

  --gap: 1.25rem;
  --max-width: 68rem;

  --bg: #ffffff;
  --surface-2: color-mix(in srgb, var(--brand) 6%, #ffffff);
  --border: color-mix(in srgb, var(--brand) 16%, #ffffff);          /* decoration: card edges, table rules */
  --border-strong: var(--brand);   /* anything you can interact with */
  --text: #111111;
  --text-muted: #6b6b6b;
  --accent: var(--brand);          /* primary buttons, current item */
  --accent-contrast: #ffffff;
  --good: #0a7a33;
  --bad: #c0262d;
  --warn: #8a5a00;
  --focus: #1a56ff;
  --meter: var(--brand);
}

[data-theme="dark"] {
  --bg: color-mix(in srgb, var(--brand-night) 16%, #0b0b0c);
  --surface-2: color-mix(in srgb, var(--brand-bright) 8%, #0b0b0c);
  --border: color-mix(in srgb, var(--brand-bright) 18%, #0b0b0c);
  --border-strong: var(--brand-bright);
  --text: #f2f2f2;
  --text-muted: color-mix(in srgb, var(--brand-bright) 10%, #a4a4a8);
  --accent: var(--brand-bright);
  --accent-contrast: var(--brand-ink);
  --good: #4cc26a;
  --bad: #ff7b72;
  --warn: #e3b341;
  --focus: #6ea0ff;
  --meter: var(--brand-bright);
}

/* Colour-blind friendly palettes: never rely on red versus green. Good = blue, bad = orange.
   The UI also puts a symbol (check / cross) next to every colour-coded state. */
[data-cb="protanopia"], [data-cb="deuteranopia"] { --accent: #0b5cad; --border-strong: #0b5cad; --meter: #0b5cad; --good: #0072b2; --bad: #d55e00; --warn: #8a6d00; }
[data-cb="tritanopia"] { --good: #00796b; --bad: #c2185b; --warn: #6d4c41; }
[data-theme="dark"][data-cb="protanopia"], [data-theme="dark"][data-cb="deuteranopia"] { --good: #56b4e9; --bad: #ff9a3c; --warn: #f0e442; }
[data-theme="dark"][data-cb="tritanopia"] { --good: #4dd0c4; --bad: #ff80ab; --warn: #ffcc80; }

/* Dyslexia-friendly text: looser spacing and a rounder, more open font stack. */
[data-dyslexia="true"] {
  --font-body: "OpenDyslexic", "Comic Sans MS", "Trebuchet MS", sans-serif;
  --letter-spacing: 0.05em;
  --word-spacing: 0.16em;
  --line-height: 1.8;
}
[data-theme="dark"][data-cb="protanopia"], [data-theme="dark"][data-cb="deuteranopia"] { --accent: #56b4e9; --border-strong: #56b4e9; --meter: #56b4e9; }
