/* Hyrgo colour tokens (HYRA-19). The only file in the site that names a colour.
   Light is the default on :root; [data-theme="dark"] overrides the same set. The theme is resolved before first
   paint by the inline script in src/layouts/Base.astro (and the admin page), from localStorage or
   prefers-color-scheme. Pages built by Astro and pages rendered by Functions (admin, error pages) both link this
   file, so every surface uses one palette.

   Pairs: every fill token has an "on-" token for the text drawn on it. --ink is the text colour AND the strong
   fill (buttons, table heads, the active filter); text on that fill is --on-ink, never a literal white. */

:root {
  color-scheme: light;

  /* Grounds and surfaces */
  --ground: #eef1f3;
  --panel: #ffffff;
  --soft: #f6f8f9;
  --cool: #e3eaf0;

  /* Text */
  --ink: #0e1a24;
  --ink-2: #3d4c58;
  --muted: #5b6a76;
  --on-ink: #ffffff;        /* text on an --ink fill */
  --ink-hover: #1c2c38;     /* an --ink fill, hovered */
  --head: #0e1a24;          /* table header rows */
  --on-head: #ffffff;

  /* Lines */
  --line: #c9d1d8;
  --line-soft: #dce2e7;
  --line-faint: #e1e6ea;
  --line-hover: #aeb9c2;
  --field: #7d8b96;         /* form control borders: 3.6:1 on --panel */

  /* Accent (signal orange) */
  --accent: #e4572e;        /* fills, icons, rules, large text only */
  --accent-text: #c2410c;   /* text on light grounds: 4.56:1 on --ground */
  --accent-deep: #9a3412;   /* hover, and text on --tint */
  --accent-fill: #c2410c;   /* button fill */
  --accent-fill-hover: #9a3412;
  --on-accent: #ffffff;     /* text on --accent-fill: 5.18:1 */
  --tint: #fde7df;
  --focus: #c2410c;         /* focus rings */
  --selection: #c2410c;    /* selected text: white on it is 5.18:1 (white on #E4572E was 3.68:1) */
  --on-selection: #ffffff;

  /* Status */
  --ok: #1e6b3a;
  --err: #a4161a;
  --err-line: #e7b9ba;

  /* The dark band (.dark sections, the floating dark card) */
  --dark: #0e1a24;
  --dark-panel: #132330;
  --dark-line: #24343f;
  --dark-chip: #3a4b57;
  --dark-grid: rgba(255, 255, 255, .045);
  --on-dark: #b4c0c9;
  --on-dark-strong: #eef1f3;
  --on-dark-bright: #ffffff;
  --on-dark-accent: #f4a58a;

  /* The orange closing band. Same in both themes: it is the brand moment. */
  --close: #e4572e;
  --close-grid: rgba(255, 255, 255, .12);
  --on-close: #ffffff;      /* the headline (large text, 3.68:1) and the runners */
  --close-ink: #0e1a24;     /* outline button text and border: 4.78:1 */
  --close-btn: #0e1a24;     /* the filled button */
  --on-close-btn: #ffffff;

  /* Shadows: one colour, alpha per use */
  --shade: 14 26 36;
  --shadow-hero: 0 1px 2px rgb(var(--shade) / .06), 0 12px 24px -8px rgb(var(--shade) / .12), 0 40px 80px -24px rgb(var(--shade) / .28);
  --shadow-lift: 0 2px 4px rgb(var(--shade) / .06), 0 24px 48px -16px rgb(var(--shade) / .28);
  --shadow-soft: 0 1px 2px rgb(var(--shade) / .05);
  --shadow-table: 0 1px 2px rgb(var(--shade) / .05), 0 24px 48px -28px rgb(var(--shade) / .25);
}

/* Dark: a deep blue-black ground (not pure black), panels a step lighter so cards still lift.
   Accent: #E4572E is 4.6:1 on the dark panel, too close to the line for small text and focus rings, so text and
   rings use #FF8A5C (7.29:1 on --panel, 8.0:1 on --ground) and fills use #FF7A47 (6.55:1 on --panel as an icon;
   the button puts near-black text on it at 7.19:1). */
[data-theme="dark"] {
  color-scheme: dark;

  --ground: #0b141b;
  --panel: #111e28;
  --soft: #0e1922;
  --cool: #1b2a36;

  --ink: #e6ecf0;           /* 15.6:1 on --ground */
  --ink-2: #b3c0ca;         /* 9.1:1 on --panel */
  --muted: #8d9daa;         /* 6.1:1 on --panel, 5.4:1 on --line-faint */
  --on-ink: #0b141b;
  --ink-hover: #c9d3da;
  --head: #1b2a36;          /* a quiet raised row, not a bright bar */
  --on-head: #e6ecf0;

  --line: #2c3c49;
  --line-soft: #213140;
  --line-faint: #1a2833;
  --line-hover: #46596a;
  --field: #6b7d8b;         /* 3.98:1 on --panel */

  --accent: #ff7a47;
  --accent-text: #ff8a5c;
  --accent-deep: #ffb59a;
  --accent-fill: #ff7a47;
  --accent-fill-hover: #ff9a73;
  --on-accent: #0b141b;
  --tint: #3a1d13;
  --focus: #ff8a5c;
  --selection: #ff8a5c;
  --on-selection: #0b141b;

  --ok: #5fd08a;
  --err: #ff8a8f;
  --err-line: #6b2a2e;

  /* The dark band sits below the ground, with its own edge lines, so it still reads as a band. */
  --dark: #060d12;
  --dark-panel: #0f1c26;
  --dark-line: #22323e;
  --dark-chip: #3a4b57;

  --shade: 0 0 0;
  --shadow-hero: 0 1px 2px rgb(var(--shade) / .4), 0 12px 24px -8px rgb(var(--shade) / .35), 0 40px 80px -24px rgb(var(--shade) / .6);
  --shadow-lift: 0 2px 4px rgb(var(--shade) / .4), 0 24px 48px -16px rgb(var(--shade) / .6);
  --shadow-soft: 0 1px 2px rgb(var(--shade) / .35);
  --shadow-table: 0 1px 2px rgb(var(--shade) / .35), 0 24px 48px -28px rgb(var(--shade) / .55);
}

/* The theme switch repaints every colour at once: public/theme.js adds this class for two frames. */
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }
