/*
  Yards Per Second design tokens. The single source of truth for colour, type, space and shape
  across the homepage, trial pages, check-in app and Trial Manager. See DESIGN.md for when to use each one.

  Load the fonts once per page, before this file:
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible+Next:wght@400;500;700;800&family=Atkinson+Hyperlegible+Mono:wght@400;600;700&display=swap">

  Themes: light on :root; dark follows the device (prefers-color-scheme) unless the page sets
  data-theme="light" or data-theme="dark" on <html>. Components use the role tokens, never raw hex.
*/

:root {
  /* ── Brand ── teal is the brand, never a status */
  --teal: #17C2B6;            /* bright teal: fills, charts, progress, logo. Dark text on top (--on-bright) */
  --teal-deep: #0B7A72;       /* teal text, links, primary buttons (white label, --on-deep) */
  --teal-tint: #E2F6F4;       /* soft background: info messages, selected chips, hover */
  --teal-tint-ink: #0A5E58;   /* text on --teal-tint */

  /* ── Accent ── orange means "now / needs attention", nothing else */
  --orange: #F97316;          /* fill: in ring, your next run, live dot, "go now" button. Dark text on top */
  --orange-deep: #C2410C;     /* orange text */
  --orange-tint: #FFEEDF;     /* soft background: warnings, "owes", the row in the ring */
  --orange-tint-ink: #9A3412; /* text on --orange-tint */

  --on-bright: #0F2224;       /* text/icons on --teal and --orange fills */
  --on-deep: #FFFFFF;         /* text/icons on --teal-deep and --st-in-strong buttons */

  /* ── Neutrals ── greys tinted toward teal */
  --bg: #F4F8F8;              /* page background */
  --surface: #FFFFFF;         /* cards, panels, inputs */
  --ink: #0F2224;             /* body text, headings */
  --muted: #526B6A;           /* secondary text, captions, labels */
  --line: #D7E3E2;            /* borders, dividers */
  --grid: rgba(11, 122, 114, .07);  /* graph-paper grid lines (decoration only) */
  --focus: #F97316;           /* keyboard focus ring */

  /* ── Run statuses ── each also gets a symbol; never colour alone */
  --st-not-bg: #EAF1F0;   --st-not-ink: #46605E;                    /* ○ Not checked in */
  --st-in-bg: #E6F4E3;    --st-in-ink: #256B2C;                     /* ✓ Checked in (turf green) */
  --st-in: #4CAF50;       --st-in-strong: #2E7D32;                  /*   green fill / check-in button */
  --st-ring-bg: #F97316;  --st-ring-ink: #1F1206;                   /* ● In ring (orange = now) */
  --st-done-bg: #E4EBEA;  --st-done-ink: #4E6260;                   /* — Done */
  --st-scr-bg: #FDECEA;   --st-scr-ink: #B42318;  --st-scr: #DC2626; /* ✕ Scratched (struck through); also errors */
  --st-con-bg: #E0E7FF;   --st-con-ink: #3730A3;                    /* ⇄ Conflict (indigo) */
  --st-nfc-bg: #FAE8FF;   --st-nfc-ink: #86198F;                    /* ◌ NFC (fuchsia) */

  /* ── Logo colours (light backgrounds) ── */
  --logo-ink: #0F2224;  --logo-p: #0B7A72;  --logo-hand: #F97316;

  /* ── Type ── */
  --font-ui: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Atkinson Hyperlegible Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-display: clamp(2rem, 5vw, 2.75rem);   /* hero headline, 800 */
  --fs-h1: 1.75rem;                          /* page title, 800 */
  --fs-h2: 1.375rem;                         /* section title, 700 */
  --fs-h3: 1.125rem;                         /* card title, dog name, 700 */
  --fs-body: 1rem;                           /* body, buttons, 400 / 700 */
  --fs-small: .875rem;                       /* secondary text, table cells */
  --fs-label: .75rem;                        /* mono uppercase labels, captions */
  --lh-tight: 1.2;  --lh-body: 1.5;
  --tracking-label: .12em;                   /* uppercase mono labels */

  /* ── Space (4 px steps) ── */
  --s1: 4px;  --s2: 8px;  --s3: 12px;  --s4: 16px;  --s5: 24px;  --s6: 32px;  --s7: 48px;
  --gutter: 16px;          /* minimum side padding on every page */
  --tap: 44px;             /* minimum touch target */

  /* ── Shape ── */
  --r-sm: 6px;  --r-md: 10px;  --r-lg: 14px;  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(15, 34, 36, .06), 0 4px 14px rgba(15, 34, 36, .06);

  /* ── Motion ── */
  --dur-fast: 120ms;  --dur: 200ms;  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --teal-deep: #17C2B6; --teal-tint: #0D2C2A; --teal-tint-ink: #5EE0D5;
    --orange: #FB923C; --orange-deep: #FB923C; --orange-tint: #3A2209; --orange-tint-ink: #FDBA74;
    --on-bright: #0B1416; --on-deep: #0B1416;
    --bg: #0B1416; --surface: #111E20; --ink: #E3F1EF; --muted: #94ACA9; --line: #22322F;
    --grid: rgba(23, 194, 182, .07); --focus: #FB923C;
    --st-not-bg: #1C2A2B; --st-not-ink: #B5C7C5;
    --st-in-bg: #16301A; --st-in-ink: #8FDC84; --st-in: #6CCB5F; --st-in-strong: #6CCB5F;
    --st-ring-bg: #FB923C; --st-ring-ink: #1F1206;
    --st-done-bg: #182425; --st-done-ink: #8BA09E;
    --st-scr-bg: #3A1715; --st-scr-ink: #FCA5A5; --st-scr: #F87171;
    --st-con-bg: #1E1B4B; --st-con-ink: #A5B4FC;
    --st-nfc-bg: #3B0D3F; --st-nfc-ink: #F0ABFC;
    --logo-ink: #E3F1EF; --logo-p: #17C2B6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --teal-deep: #17C2B6; --teal-tint: #0D2C2A; --teal-tint-ink: #5EE0D5;
  --orange: #FB923C; --orange-deep: #FB923C; --orange-tint: #3A2209; --orange-tint-ink: #FDBA74;
  --on-bright: #0B1416; --on-deep: #0B1416;
  --bg: #0B1416; --surface: #111E20; --ink: #E3F1EF; --muted: #94ACA9; --line: #22322F;
  --grid: rgba(23, 194, 182, .07); --focus: #FB923C;
  --st-not-bg: #1C2A2B; --st-not-ink: #B5C7C5;
  --st-in-bg: #16301A; --st-in-ink: #8FDC84; --st-in: #6CCB5F; --st-in-strong: #6CCB5F;
  --st-ring-bg: #FB923C; --st-ring-ink: #1F1206;
  --st-done-bg: #182425; --st-done-ink: #8BA09E;
  --st-scr-bg: #3A1715; --st-scr-ink: #FCA5A5; --st-scr: #F87171;
  --st-con-bg: #1E1B4B; --st-con-ink: #A5B4FC;
  --st-nfc-bg: #3B0D3F; --st-nfc-ink: #F0ABFC;
  --logo-ink: #E3F1EF; --logo-p: #17C2B6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* Explicit light choice on a dark device keeps the light values above (no overrides needed). */
:root[data-theme="light"] { color-scheme: light; }

/* Numbers everywhere: times, SCTs, places, counts, money, UKI numbers */
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
