/* Atlas colour schemes.
 *
 * Three considered schemes, not a picker: a free colour chooser produces
 * unreadable combinations and support tickets, while three fixed schemes can
 * each be contrast-checked once and then trusted.
 *
 * Every scheme redefines the palette tokens that atlas-rebuild.css already
 * declares on :root, so anything drawn through var() follows automatically.
 * All three still stay in the same light family, but for a smaller reason than
 * before: 448 of the desktop document's hard-coded colours moved onto the token
 * layer in August 2026, and perturbing the palette now moves 66 of the 305
 * elements HQ renders rather than 31. What is left is the long tail — one-off
 * accents outside every token's radius — plus mobile.html and pma.html, which
 * are separate documents that do not carry this token layer at all.
 *
 * So a dark scheme is now a question of finishing those two documents and
 * deciding what --ink-faint and --ink-fainter mean when the surfaces invert,
 * rather than of a thousand literals. Changing hue and contrast within a light
 * family still degrades gracefully against a colour that has not been migrated
 * — inverting the app does not, and there are still colours to migrate.
 *
 * Loaded render-blocking from index.html and selected by a data attribute the
 * inline head script sets before first paint, so no module can cause a flash
 * of the wrong scheme.
 */

/* Slate — cooler and greyer. For long office days on a bright monitor. */
:root[data-atlas-theme="slate"]{
  --skeleton-base:#cdc6bd;
  --skeleton-sheen:#fffdf8;
  --accent-on-dark:#82b5e6;
  --navy:#37322c;
  --navy2:#464038;
  --green:#61a14e;
  --green-ink:#51674b;
  --bg:#f4f2ef;
  --card:#ffffff;
  --surface-1:#f9f9f8;
  --surface-2:#f4f3f1;
  --surface-3:#eae9e8;
  --surface-deep:#1c1915;
  --surface-deepest:#120f0b;
  --text:#282420;
  --muted:#6f6862;
  --ink-mid:#3e3a34;
  --ink-soft:#4d4943;
  --ink-steel:#67635e;
  --ink-muted:#615e5b;
  --ink-faint:#787571;
  --ink-fainter:#837f7b;
  --ink-on-dark:#f8f6f4;
  --ink-on-dark-soft:#b3afab;
  --border:#ddd8d2;
  --line-strong:#d4d1ce;
  --line-soft:#edeceb;
  --danger:#a83b3b;
  --warning:#96690f;
  --blue:#2c6ea8;
  --blue-deep:#3b6892;
  --blue-ink:#33597c;
  --blue-fill:#2a6ca6;
  --blue-deep-fill:#3b6892;
  --wash-blue:#e5ecf4;
  --wash-success:#eaf2e7;
  --chrome-navy:#37322c;
  --hero-top:#326ca0;
  --hero-bottom:#326594;
  --shadow:0 8px 24px rgba(55,50,44,.10);
  --chrome-emboss:linear-gradient(180deg,#736e68 0%,#322d27 42%,#231e19 58%,#736e68 100%);
}

/* Contrast — heavier text and borders for sunlight, older eyes, and cheap
 * monitors. Text and background here are well clear of WCAG AA at body size. */
:root[data-atlas-theme="contrast"]{
  --skeleton-base:#a8a8a8;
  --skeleton-sheen:#f4f4f4;
  --accent-on-dark:#78aded;
  --navy:#141414;
  --navy2:#1e1e1e;
  --green:#3f7a1f;
  --on-green:#ffffff;
  --green-ink:#26391e;
  --bg:#ffffff;
  --card:#ffffff;
  --surface-1:#fbfbfb;
  --surface-2:#f7f7f7;
  --surface-3:#cacaca;
  --surface-deep:#000000;
  --surface-deepest:#000000;
  --text:#000000;
  --muted:#3a3a3a;
  --ink-mid:#191919;
  --ink-soft:#242424;
  --ink-steel:#363636;
  --ink-muted:#333333;
  --ink-faint:#404040;
  --ink-fainter:#454545;
  --ink-on-dark:#f6f6f6;
  --ink-on-dark-soft:#b0b0b0;
  --border:#6e6e6e;
  --line-strong:#6b6b6b;
  --line-soft:#dadada;
  --danger:#8f2020;
  --warning:#6a4700;
  --blue:#00509a;
  --blue-deep:#03366a;
  --blue-ink:#032c57;
  --blue-fill:#00367e;
  --blue-deep-fill:#03366a;
  --wash-blue:#cfd7e0;
  --wash-success:#e6eee3;
  --chrome-navy:#141414;
  --hero-top:#003777;
  --hero-bottom:#00336d;
  --shadow:0 8px 24px rgba(20,20,20,.10);
  --chrome-emboss:linear-gradient(180deg,#4b4b4b 0%,#101010 42%,#050505 58%,#4b4b4b 100%);
}
:root[data-atlas-theme="contrast"] .card,
:root[data-atlas-theme="contrast"] .metric,
:root[data-atlas-theme="contrast"] .dash-card{
  border-width:2px;
}
/* Dark — for night dispatch and for phones in a cab after sundown.
 *
 * This is the scheme the token migration was for, and it is the first one that
 * cannot be written by nudging hues. Three things have to be said explicitly:
 *
 * 1. Chrome does not invert. The sidebar, topbar and auth screen were already
 *    dark, so --chrome-navy and --surface-deep go slightly deeper rather than
 *    flipping. --navy is the same colour as --chrome-navy in the light schemes
 *    but is spent as heading ink, so it goes the other way entirely. They were
 *    one token until this scheme needed them to disagree.
 * 2. --shadow is a navy at 8% alpha, which is invisible on a dark surface. On
 *    dark, depth has to come from black at a much higher alpha.
 * 3. --chrome-emboss is the dark gradient the page headings are painted with
 *    through background-clip:text. Left alone it renders dark text on a dark
 *    page — a heading that is simply not there, with nothing to report it.
 *
 * Every ink token clears WCAG AA on --card here, including --ink-faint and
 * --ink-fainter, which do not clear it in the light schemes. Dark surfaces are
 * more forgiving of light text than white surfaces are of grey.
 */
:root[data-atlas-theme="dark"]{
  --skeleton-base:#1e2c36;
  --skeleton-sheen:#4a6880;
  --accent-on-dark:#8bd1fb;
  --bg:#0d1720;
  --card:#16232e;
  --surface-1:#1b2934;
  --surface-2:#1d303e;
  --surface-3:#111d26;
  --chrome-navy:#0a1a27;
  --surface-deep:#060f18;
  --surface-deepest:#010a11;
  --navy2:#1b3a52;

  --text:#dfe7ee;
  --navy:#eaf1f8;
  --ink-mid:#cfdbe5;
  --ink-soft:#b9c8d4;
  --ink-steel:#a3b4c2;
  --ink-muted:#9dabb8;
  --muted:#94a3b1;
  --ink-faint:#8b9aa8;
  --ink-fainter:#8495a4;
  --green-ink:#9ccc6a;
  --blue-ink:#7fb6e8;

  --border:#2a3a47;
  --line-strong:#354856;
  --line-soft:#223039;

  --wash-blue:#14293c;
  --wash-danger:#351a17;
  --wash-warning:#382d16;
  --wash-success:#1e2f1a;

  /* Ink versions lighten so they can be read on a panel. The matching -fill
     tokens do not: white text still sits on them. */
  --blue:#4aa9ee;
  --blue-deep:#4fa8d6;
  --danger:#e46f68;
  --warning:#d9a441;

  --hero-top:#12405f;
  --hero-bottom:#0d2f47;

  --shadow:0 10px 30px rgba(0,0,0,.5);
  --chrome-emboss:linear-gradient(180deg,#f4f8fc 0%,#c8d6e2 42%,#aebecd 58%,#f4f8fc 100%);
}

:root[data-atlas-theme="contrast"] .eyebrow,
:root[data-atlas-theme="contrast"] .metric-note,
:root[data-atlas-theme="contrast"] small{
  color:var(--muted);
}

/* Meadow — a fresher, greener light scheme. Added 2026-08-20.
 *
 * Meadow and Orchid below had been accepted by the database since
 * 20260817003938_add_meadow_and_orchid_ui_themes: employee_records.ui_theme
 * takes them and the save RPC validates them. Neither existed in this file or
 * in atlas-theme-preference.js, so both were storable and unselectable, and
 * nothing would have rendered them if a row had somehow carried one. The schema
 * moved and the interface never followed.
 *
 * Both stay in the light family for the reason the header gives: a scheme that
 * shifts hue and contrast degrades gracefully against a colour that has not
 * been migrated onto the token layer, and a scheme that inverts the surfaces
 * does not. Dark needs 35 tokens to hold that inversion together; these need
 * the same 11 Slate does.
 *
 * Measured against WCAG AA at body size, worst pair 4.83:1 (muted on bg):
 * text on bg 13.51, text on card 14.90, muted on card 5.33, navy on card 12.44,
 * danger 6.26, warning 5.37, blue 5.38.
 */
:root[data-atlas-theme="meadow"]{
  --skeleton-base:#c2d3c1;
  --skeleton-sheen:#fbfffa;
  --accent-on-dark:#7fbeb1;
  --navy:#1c3a2a;
  --navy2:#224b36;
  --green:#7cb342;
  --green-ink:#546744;
  --bg:#f1f5ef;
  --card:#ffffff;
  --surface-1:#f8faf9;
  --surface-2:#eff6f2;
  --surface-3:#e7ede9;
  --surface-deep:#0c2015;
  --surface-deepest:#03150b;
  --text:#1e2a22;
  --muted:#5f6f63;
  --ink-mid:#254232;
  --ink-soft:#385042;
  --ink-steel:#546a5d;
  --ink-muted:#56635b;
  --ink-faint:#6a7b71;
  --ink-fainter:#74877b;
  --ink-on-dark:#f0f9f3;
  --ink-on-dark-soft:#a3b5aa;
  --border:#d5e0d6;
  --line-strong:#cbd9d1;
  --line-soft:#ebefed;
  --danger:#a83b3b;
  --warning:#8a6410;
  --blue:#1f7a6b;
  --blue-deep:#377166;
  --blue-ink:#306057;
  --blue-fill:#1d796a;
  --blue-deep-fill:#377166;
  --wash-blue:#e7f0ed;
  --wash-success:#ecf3e6;
  --chrome-navy:#1c3a2a;
  --hero-top:#2b776a;
  --hero-bottom:#2c6f63;
  --shadow:0 8px 24px rgba(28,58,42,.10);
  --chrome-emboss:linear-gradient(180deg,#5a7666 0%,#173525 42%,#072617 58%,#5a7666 100%);
}

/* Orchid — a quieter purple light scheme.
 *
 * Measured against WCAG AA at body size, worst pair 5.37:1 (warning on card):
 * text on bg 14.65, text on card 16.35, muted on card 6.46, navy on card 13.57,
 * danger 6.26, blue 6.97.
 */
:root[data-atlas-theme="orchid"]{
  --skeleton-base:#d9c3cb;
  --skeleton-sheen:#fff8fa;
  --accent-on-dark:#e48c9e;
  --navy:#40222c;
  --navy2:#532c39;
  --green:#3f6f2c;
  --on-green:#ffffff;
  --green-ink:#4c5d46;
  --bg:#faf1f3;
  --card:#ffffff;
  --surface-1:#fcf9f9;
  --surface-2:#faf2f4;
  --surface-3:#f0e9eb;
  --surface-deep:#241117;
  --surface-deepest:#19070d;
  --text:#2b1e23;
  --muted:#6f5a60;
  --ink-mid:#472a33;
  --ink-soft:#533941;
  --ink-steel:#6c535a;
  --ink-muted:#615256;
  --ink-faint:#7b676d;
  --ink-fainter:#897279;
  --ink-on-dark:#fef3f6;
  --ink-on-dark-soft:#c0a9af;
  --border:#e6d6da;
  --line-strong:#dfced2;
  --line-soft:#f1eced;
  --danger:#a83b3b;
  --warning:#8a6410;
  --blue:#9c3652;
  --blue-deep:#8a4052;
  --blue-ink:#753745;
  --blue-fill:#9c3652;
  --blue-deep-fill:#8a4052;
  --wash-blue:#f7e9eb;
  --wash-success:#ecf3ea;
  --chrome-navy:#40222c;
  --hero-top:#973c53;
  --hero-bottom:#8c394e;
  --shadow:0 8px 24px rgba(64,34,44,.10);
  --chrome-emboss:linear-gradient(180deg,#7d5d67 0%,#3b1d27 42%,#2b0f19 58%,#7d5d67 100%);
}
