/* Design tokens: every colour, size and font the app uses, in one place.
   Components in app.css only use these variables, so changing the look
   (or adding a theme) happens here.

   Themes: the app follows the phone's light/dark setting by default.
   Settings can force one; that sets data-theme="light" or "dark" on <html>. */

@font-face {
  font-family: 'Archivo';
  /* Variable font: one file holds every weight (100–900) and width (62–125%).
     Self-hosted and cached by the service worker, so it works offline. */
  src: url('../fonts/archivo-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  /* Dark theme values (the default). Contrast checked against --bg:
     --text 19:1, --text-2 10:1, --text-3 5.6:1 — all pass WCAG AA. */
  --bg: #0e0e10;
  --surface: #1a1a1e;
  --surface-2: #27272c;
  --line: #36363d;
  --control-line: #77777f; /* outlines of buttons: ≥ 3:1 on --bg, --surface and --surface-2 (WCAG 1.4.11) */
  --control-line-strong: #82828c; /* outlines on --surface / --surface-2: ≥ 3:1 there too */
  --text: #ffffff;
  --text-2: #b9b9c2;
  --text-3: #8f8f99;
  --primary-bg: #ffffff;      /* main action pill */
  --primary-text: #0e0e10;
  --danger: #ff5c5c;
  --on-danger: #0e0e10;
  --focus: #ffd60a;

  /* Alliance colours. White text on them passes AA (red 5.0:1, blue 5.3:1). */
  --red: #d42a36;
  --card-yellow: #f5c400; /* a yellow card, shown in its real colour (dark text on it: 12:1) */
  --blue: #2160e0;
  --neutral-alliance: #3a3a41; /* before an alliance is picked */
  --on-alliance: #ffffff;
  --tab-track: rgb(0 0 0 / 0.22); /* darkens the alliance colour behind the period tabs */
  --scrim: rgb(0 0 0 / 0.6);      /* dims the screen behind the confirm sheet */
  --press: color-mix(in srgb, currentColor 12%, transparent); /* the pressed shade, from the text colour so it works on any surface */
  --qr-light: #ffffff;            /* behind a QR code, in both themes: scanners need dark on light */
  --aim-dim: rgb(0 0 0 / 0.35);   /* darkens the camera picture around the scan square */
  --alliance: var(--neutral-alliance);

  /* Type: one family. Condensed heavy for numbers, normal width for words. */
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs: 0.8125rem;  /* 13 */
  --fs-sm: 0.9375rem;  /* 15 */
  --fs-md: 1.0625rem;  /* 17 */
  --fs-lg: 1.25rem;    /* 20 */
  --fs-xl: 1.5rem;     /* 24 */
  --fs-2xl: 2rem;      /* 32 */
  --fs-num: 2.75rem;   /* 44: counter values */
  --fs-hero: 4rem;     /* 64: team number */
  --fs-display: 5rem;  /* 80: the match or team on Home's "Now scouting" block */
  --fs-display-words: 3.5rem; /* 56: big words there ("Ready to scout") */

  /* Spacing on a 4px grid */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;

  /* The grid: every band of a screen (top bar, cover, content, bottom bar)
     has this much room at the sides, so all text starts on one line. */
  --gutter: 16px;

  /* Touch targets: 56px minimum for anything tapped during a match */
  --tap: 56px;
  --tap-lg: 64px;
  --tap-sm: 48px;      /* small controls outside a match (never under 44px) */

  /* Rows in lists, and the columns they share so things line up */
  --row: 64px;
  --row-sm: 48px;
  --col-code: 4.5rem;  /* a match code: Q18 */
  --col-plate: 4.25rem; /* a station sign: Red 1 */

  /* Lines and shapes */
  --rule: 1px;         /* dividers between rows */
  --border: 2px;       /* the edge of a control */
  --ring: 3px;         /* focus rings and "yours" edges */
  --pill: 999px;
  --radius: 14px;
  --plate-radius: 6px; /* bumpers and station signs: printed, square-ish */
  --radius-sm: 10px;   /* small chips and badges */
  --radius-md: 12px;   /* segments inside a segmented track */
  --radius-lg: 20px;   /* the confirm sheet */
  --shadow-sheet: 0 20px 50px rgb(0 0 0 / 0.45);
  --card-yellow-edge: #7a6200; /* edge of the yellow-card choice: visible on white and black */
  --on-card-yellow: #0e0e10;
  --bumper-shade: rgb(0 0 0 / 0.25); /* the darker lower edge of a bumper */
  --on-alliance-rule: rgb(255 255 255 / 0.4); /* dividers drawn on the alliance colour */

  color-scheme: dark;
}

/* Light theme: for direct sunlight. Used when the phone is in light mode
   (unless Settings forces dark), or when Settings forces light. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #ffffff;
    --surface: #f2f2f5;
    --surface-2: #e4e4ea;
    --line: #d3d3da;
    --control-line: #7e7e88; /* ≥ 3:1 on --surface too, for sunlight */
    --control-line-strong: #6e6e78;
    --text: #0e0e10;
    --text-2: #45454d;
    --text-3: #64646d;
    --primary-bg: #0e0e10;
    --primary-text: #ffffff;
    --danger: #c41d2a;
    --on-danger: #ffffff;
    --focus: #0e0e10;
    --red: #c8202d;
    --blue: #1d56d1;
    --neutral-alliance: #4a4a52;
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #ffffff;
  --surface: #f2f2f5;
  --surface-2: #e4e4ea;
  --line: #d3d3da;
  --control-line: #7e7e88; /* ≥ 3:1 on --surface too, for sunlight */
  --control-line-strong: #6e6e78;
  --text: #0e0e10;
  --text-2: #45454d;
  --text-3: #64646d;
  --primary-bg: #0e0e10;
  --primary-text: #ffffff;
  --danger: #c41d2a;
  --on-danger: #ffffff;
  --focus: #0e0e10;
  --red: #c8202d;
  --blue: #1d56d1;
  --neutral-alliance: #4a4a52;
  color-scheme: light;
}

/* The match screen sets data-alliance, which picks the accent colour. */
[data-alliance='red'] { --alliance: var(--red); }
[data-alliance='blue'] { --alliance: var(--blue); }
