/* COLOUR TOKENS: the one copy of the palette. Edit a colour here and every page, and the design system, changes.
   tools/build.py copies this to deploy/css/colour-tokens.css, which every page links (and builds the
   design system's theme blocks from it). tools/palette-audit.py reads this file. Rules: docs/PALETTE.md.
   Page-only colours (perk pill, tiles, scrim, special-event themes) stay in their own page's :root. */
:root{
  /* Grounds */
  --bg:#0F0D1A;
  --surface:#1D1931;
  --surface2:#292442;
  --border:rgba(167,169,219,.14);
  /* Text */
  --ink:#EEEDF6;
  --ink2:#A4A2B7;
  --ink3:#7B7895;
  /* Violets */
  --lav:#ABA7D9;
  --accent:#9B85EB;
  --accent-hover:#8159E5;
  --accent-ink:var(--accent);
  --pill:var(--accent);   /* resolved at :root, so a tile that scopes its own --accent still gets the shared violet button */
  --pill-hover:var(--accent-hover);
  --on-accent:#FFFFFF;   /* ink on a filled accent surface. KNOWN GAP: 3.02:1 on dark --accent, below 4.5:1 (docs/TYPE-RADIUS-FIELDS.md) */
  --accent-rgb:155 133 235;
  --chip:rgba(167,169,219,.10);
  --lav-light:rgba(167,169,219,.10);
  --lav-mid:rgba(167,169,219,.28);
  --picked:var(--lav-mid);   /* fill of a chosen option card, chip or segment (dE 10 from --chip) */
  --on-picked:var(--ink);   /* text on --picked (8.3:1) */
  --chosen:var(--lav-mid);   /* chosen chip / radio card. Dark: the original chosen lavender, translucent so it reads on a sheet and on the page. Light: the handoff's #E6E3F0 (see the light block) */
  --well:color-mix(in srgb,var(--lav-mid) 6%,var(--bg));       /* unchosen chip, switch row, neutral button: the handoff's #F3F2F8 (light lands at about #F3F3F9) */
  --well-page:color-mix(in srgb,var(--lav-mid) 26%,var(--bg));    /* second tone: an unchosen chip, switch row or field straight on the page ground (--bg), where --well is only 1.03:1 */
  --chosen-page:var(--lav-mid);   /* second tone, dark: the original chosen-pill lavender (translucent, about #3A3950 over the page) */
  /* Functional */
  --green:#75C8A2;
  --green-rgb:117 200 162;
  --warn:#EA7770;
  --note:#F1995D;   /* coloured text for what differs from the usual */
  /* Form fields */
  --field-line:#6F6B85;
  --field-fill:var(--bg);   /* dark: recessed, darker than the sheet (--surface) it sits on */
  --field-error-fill:color-mix(in srgb,var(--warn) 18%,var(--bg));   /* dark: the wash behind an invalid field; mixed over the recessed fill so it reads red, not brown */
  /* Zest (live signal only) */
  --zest:#F0FF9A;
  --zest-ring:transparent;
  --zest-rgb:240 255 154;
  --on-zest:var(--zest);   /* ink that reads on a zest wash: zest does not flip between themes, so the ink must */
  /* Shadow scale, by weight: sm a small control, md a resting card or game list, lg a card raised on hover, xl a
     floating mock-up. Dark: md is none (the surface step does the work), lg and xl are black. Light: violet. */
  --lav-rgb:171 167 217;   /* --lav as split channels, for translucent shadows */
  --shadow-sm:0 2px 10px rgb(var(--accent-rgb) / .12);
  --shadow-md:none;
  --shadow-lg:0 20px 48px rgb(0 0 0 / .30);
  --shadow-xl:0 48px 96px rgb(0 0 0 / .55);
  --perk-fill:var(--accent);   /* the perk badge (.game-badge--perk): a solid violet pill. Dark: bright violet, dark ink (5.78:1) */
  --perk-ink:var(--bg);
  --scrim:rgba(8,7,14,.72);   /* the dark overlay behind a sheet (templates/sheet.css) */
  /* Badges: Weekly is a quiet neutral, a wash of the ink with --ink2 text, so it adapts to either theme */
  --badge-weekly-bg:color-mix(in srgb,var(--ink) 10%,transparent);
  --badge-weekly-ink:var(--ink2);
  /* Player card: fixed dark in both themes (like zest, it does not flip). The values are the dark palette's own
     --surface, --ink, --ink2 and --accent, already audited, so no new colour (#1D1931 is L 23, 35% of the chroma ceiling). */
  --card-dark:#1D1931;
  --card-dark-ink:#EEEDF6;
  --card-dark-ink2:#A4A2B7;
  --card-dark-accent:#9B85EB;
  /* Avatar tints: five pastels for a player's initial circle, fixed in both themes (like zest and the card above, so no hue
     drift and no darkening). Fill L 88 and C 0.055 for every hue, ink L 30 and C 0.04 of the same hue, 9.5:1 on its fill.
     Chroma is matched in absolute terms, not as a % of ceiling: at L 88 the ceiling ranges from 0.065 (lilac) to 0.19 (mint),
     so a matched % would make mint neon and lilac grey. Fill pairs are at least 5.5 dE apart, so neighbours in a stack read
     as different. Assign by position in the list, in this order. Not accents: initials circles only. See docs/PALETTE.md. */
  --avatar-lilac:#D9D1F9;  --on-avatar-lilac:#2F2A40;
  --avatar-sky:#B5DEF7;    --on-avatar-sky:#18313F;
  --avatar-mint:#B9E3CB;   --on-avatar-mint:#1B3427;
  --avatar-peach:#F3D0B4;  --on-avatar-peach:#3D2919;
  --avatar-pink:#F6C9D9;   --on-avatar-pink:#3E252F;
}
@media(prefers-color-scheme:light){
  :root{
    /* Grounds */
    --bg:#F6F6FA;
    --surface:#FFFFFF;
    --surface2:#EBEAF2;
    --border:rgba(100,88,160,.13);
    /* Text */
    --ink:#1A172B;
    --ink2:#474363;
    --ink3:#716E8D;
    /* Violets */
    --lav:#6A5DC0;
    --accent:#7D5CE5;
    --accent-hover:#6333CC;
    --accent-ink:var(--accent-hover);
    --on-accent:#FFFFFF;
    --accent-rgb:125 92 229;
    --chip:rgba(107,95,191,.08);
    --lav-light:#EDE9FA;
    --lav-mid:#C9C4E8;
    --field-fill:var(--surface2);   /* light: a step darker than the white sheet, so it reads as recessed too */
    --field-error-fill:color-mix(in srgb,var(--warn) 10%,var(--surface));   /* light: a faint pink */
    --chosen:color-mix(in srgb,var(--lav-mid) 38%,var(--bg));   /* light: the handoff's #E6E3F0 (about #E3E3F3) */
    --chosen-page:color-mix(in srgb,var(--lav-mid) 55%,var(--bg));   /* second tone, light: a chosen chip or card straight on the page (1.26:1) */
    --picked:var(--lav-light);   /* the soft lavender tint (the handoff's #EEE9FD) */
    --on-picked:var(--accent-ink);   /* purple text on it, 6.1:1 */
    /* Functional */
    --green:#357157;
    --green-rgb:53 113 87;
    --warn:#B23837;
    --note:#84411F;
    /* Form fields */
    --field-line:#8C88A3;
    /* Zest (live signal only) */
    --zest:#F0FF9A;
    --zest-ring:#7A6B10;
    --zest-rgb:240 255 154;
    --on-zest:var(--zest-ring);
    --lav-rgb:106 93 192;
    --shadow-md:0 4px 24px rgb(var(--accent-rgb) / .07);
    --shadow-lg:0 20px 48px rgb(var(--lav-rgb) / .14);
    --shadow-xl:0 8px 24px rgb(var(--lav-rgb) / .10),0 32px 64px rgb(var(--lav-rgb) / .12);
    --perk-fill:var(--accent-hover);   /* light flips it: the deep violet with white on top (7.30:1) */
    --perk-ink:var(--on-accent);
    --scrim:rgba(26,23,43,.44);
  }
}
