/* ══════════════════════════════════════════════════════════════
   theme.css — the colour palettes every page draws from.

   Linked from every published page (index, app, help, admin, the legal
   pages, 404) and the /make/ product-page template. A page's own <style>
   never writes a colour literal for a UI surface, text tone, line, overlay
   or shadow: it uses one of these. That is what lets a second palette (light
   mode) be one override block here instead of an edit to every page.

   Colours that are used with transparency are stored as bare channels
   (`--teal-rgb:95,208,200`) and written `rgba(var(--teal-rgb),.28)` at the
   use site, so an override changes the solid and every tint of it at once.
   The solid is then derived from the channels, so each value lives once.

   Deliberately NOT here (they are content, not theme):
   - category / product accents (`--sw` on landing cards, catalogue-data.js);
   - filament and swatch colours, the email-preview iframe's white;
   - <meta name="theme-color">, which src/theme.js sets instead.
   An SVG presentation attribute (fill="#…") cannot read a custom property, so
   inline SVG takes its colours as style="fill:var(--…)".

   The light palette below overrides the same names; src/theme.js picks it.
   This file also styles the theme switch, the one component every page shares.

   Served from /src/ (revalidated), not /assets/ (cached immutable).
   ══════════════════════════════════════════════════════════════ */
:root{
  /* ── surfaces, darkest first ─────────────────────────────── */
  --media:#0b0d10;                              /* behind landing video / embeds */
  --well:#0e1013;                               /* behind image thumbnails */
  --field-rgb:18,20,24;    --field:rgb(var(--field-rgb));   /* inputs; glass bars over a canvas */
  --bg-rgb:20,22,26;       --bg:rgb(var(--bg-rgb));         /* graphite, shop-floor dark */
  --checker:#1a1d22;                            /* transparency checkerboard, paired with --bg */
  --panel-rgb:27,30,35;    --panel:rgb(var(--panel-rgb));
  --panel-2:#22262c;
  --panel-3:#272c33;                            /* hovered control */

  /* ── lines ───────────────────────────────────────────────── */
  --line-rgb:44,49,58;     --line:rgb(var(--line-rgb));
  --scroll:#333941;                             /* scrollbar thumb */
  --line-2:#414852;                             /* hovered border */

  /* ── text, brightest first ───────────────────────────────── */
  --ink-hi:#eef2f5;                             /* dialog headings, active steps */
  --ink:#e8e5df;                                /* warm off-white body text */
  --ink-strong:#d6dbe0;                         /* section heads inside a dialog */
  --ink-warm:#c9c6c0;                           /* news-item copy */
  --ink-2:#c3c9d1;                              /* secondary text */
  --ink-label:#b9bec6;                          /* control-row labels */
  --ink-3:#aeb6c0;                              /* admin KPI footnotes */
  --muted-rgb:135,142,152; --muted:rgb(var(--muted-rgb));

  /* ── accent: the blue→teal gradient ──────────────────────── */
  --accent-2-rgb:64,132,238; --accent-2:rgb(var(--accent-2-rgb));  /* blue end */
  --teal-rgb:95,208,200;     --teal:rgb(var(--teal-rgb));          /* teal end; also measurements */
  --glow-rgb:80,178,214;                        /* mid-gradient glow under accent pills */
  --grad:linear-gradient(90deg,var(--accent-2),var(--teal));
  --teal-line:#2b4a47;                          /* border of an ok / loaded badge */
  /* text on accent glass, softest first */
  --accent-ink-soft:#bfe6e0;
  --accent-ink-rgb:214,241,236; --accent-ink:rgb(var(--accent-ink-rgb));
  --accent-ink-2:#dff3f0;
  --accent-ink-hi:#eaf6f3;
  /* text on a solid accent fill */
  --on-accent:#0c1116;                          /* on --grad buttons */
  --on-teal:#06201c;                            /* on the app's teal primary button */

  /* ── status ──────────────────────────────────────────────── */
  --warn-rgb:255,202,95;        --warn:rgb(var(--warn-rgb));
  --warn-line-rgb:74,64,35;     --warn-line:rgb(var(--warn-line-rgb));
  --danger-rgb:255,107,107;     --danger:rgb(var(--danger-rgb));
  --danger-ink:#ff9b8a;                         /* error text, danger-button label */
  --danger-ink-hi:#f6e2e2;                      /* label on a filled danger button */
  --danger-2-rgb:224,110,110;                   /* destructive-selection borders */
  --danger-line-rgb:74,38,38;   --danger-line:rgb(var(--danger-line-rgb));
  --danger-deep-rgb:60,22,26;                   /* filled danger button */

  /* ── overlays ────────────────────────────────────────────── */
  --tint-rgb:255,255,255;                       /* faint wash / inset highlight over a surface */
  --shadow-rgb:0,0,0;
  --scrim-rgb:10,11,14;                         /* modal backdrops */
  --on-scrim:#e8e5df;                           /* text laid on the scrim; light in both themes */
}

/* ── light palette ───────────────────────────────────────────────
   Applied when <html data-theme="light">, which src/theme.js sets from the
   visitor's choice (Auto follows the device). Same names, same roles; only
   values change. Accents are darkened so they still read as text on white,
   which is also why text on a solid accent fill turns white. */
:root[data-theme="light"]{
  --media:#e9edf1;
  --well:#e9ecef;
  --field-rgb:255,255,255;
  --bg-rgb:236,238,241;
  --checker:#e3e6ea;
  --panel-rgb:255,255,255;
  --panel-2:#f0f2f5;
  --panel-3:#e6e9ee;

  --line-rgb:214,219,226;
  --scroll:#c3c9d2;
  --line-2:#aeb6c1;

  --ink-hi:#0b0e12;
  --ink:#1c2026;
  --ink-strong:#23282f;
  --ink-warm:#3b3833;
  --ink-2:#3c434d;
  --ink-label:#454c56;
  --ink-3:#545c67;
  --muted-rgb:96,104,115;

  --accent-2-rgb:36,99,214;
  --teal-rgb:8,118,110;
  --glow-rgb:40,140,190;
  --teal-line:#a6d8d2;
  --accent-ink-soft:#24524d;
  --accent-ink-rgb:12,74,68;
  --accent-ink-2:#0b4741;
  --accent-ink-hi:#083d38;
  --on-accent:#ffffff;
  --on-teal:#ffffff;

  --warn-rgb:150,94,0;
  --warn-line-rgb:228,200,140;
  --danger-rgb:200,40,40;
  --danger-ink:#b8322a;
  --danger-ink-hi:#ffffff;
  --danger-2-rgb:200,60,60;
  --danger-line-rgb:238,192,192;
  --danger-deep-rgb:196,44,44;

  --tint-rgb:0,0,0;
  --shadow-rgb:100,110,125;                     /* same alphas as dark, so a softer grey */
  --scrim-rgb:20,26,34;
}

/* ── the theme switch (built by src/theme.js from [data-theme-switch]) ── */
.theme-switch{display:inline-flex;gap:2px;padding:2px;border:1px solid var(--line);
  border-radius:999px;background:var(--panel);vertical-align:middle}
.theme-switch button{display:inline-flex;align-items:center;gap:5px;margin:0;padding:4px 10px;
  border:0;border-radius:999px;background:transparent;color:var(--muted);
  font:inherit;font-size:12.5px;line-height:1.2;cursor:pointer}
.theme-switch button:hover{color:var(--ink)}
.theme-switch button[aria-checked="true"]{background:var(--panel-2);color:var(--ink);
  box-shadow:inset 0 0 0 1px var(--line)}
.theme-cycle{display:inline-grid;place-items:center;width:24px;height:24px;margin:0;padding:0;
  border:1px solid var(--line);border-radius:999px;background:transparent;color:var(--muted);cursor:pointer}
.theme-cycle:hover{color:var(--ink);border-color:var(--line-2)}
.theme-switch button:focus-visible,.theme-cycle:focus-visible{outline:2px solid var(--teal);outline-offset:1px}
