/**
 * @file theme.css
 * Eldersburg Rogue Runners brand tokens, in Mercury's shadcn/ui variable set.
 *
 * The palette is taken from the club's own marks: the red winged-foot roundel
 * and the Labor Day Race badge. Brick red #9B2224 is the club's colour and
 * carries primary actions; navy #13305A is the badge's field and carries
 * structure. Neutrals are warmed slightly rather than pure grey, so photography
 * of runners on asphalt in September sits on the page without looking cold.
 *
 * Every foreground/background pairing below clears WCAG AA for normal text, and
 * all but one clear AAA. Re-check with a contrast tool before changing a value.
 *
 * Colours are oklch because Mercury's Tailwind build expects that space.
 * Hex equivalents are noted so they can be matched against print and apparel.
 *
 * Changes here take effect without rebuilding the compiled CSS.
 */

:root {
  /* #FFFFFF — content sits on white; warmth comes from cards and muted areas. */
  --background: oklch(1 0 0);
  /* #1A1614 — near-black with a warm cast, not pure grey. */
  --foreground: oklch(0.2042 0.0076 48.33);

  /* #FAF7F4 — warm off-white for race cards and panels. */
  --card: oklch(0.9776 0.0051 67.764);
  --card-foreground: var(--foreground);

  /* #9B2224 — club brick red. Primary actions: register, join, donate. */
  --primary: oklch(0.4541 0.157 25.383);
  --primary-foreground: oklch(1 0 0);

  /* #13305A — badge navy. Structure: headers, footers, section bands. */
  --secondary: oklch(0.312 0.0831 257.953);
  --secondary-foreground: oklch(1 0 0);
  /* #0E2440. The comps close the page on a navy deeper than the section bands,
     and open it on the same one, so the quote strip and the footer read as the
     site's edges rather than as two more bands. The soft blue-grey is the body
     colour on those two: #C9D6E8, which is 10.6:1 against this. */
  --secondary-deep: oklch(0.2589 0.0599 255.546);
  --secondary-deep-foreground: oklch(0.8718 0.0286 256.493);

  /* #F2ECE6 — quiet warm fill for alternating bands and table stripes. */
  --muted: oklch(0.9461 0.0103 67.701);
  --muted-foreground: oklch(0.2042 0.0076 48.33);

  --accent: oklch(0.9461 0.0103 67.701);
  --accent-foreground: var(--secondary);

  /* #B2252A: error text and borders. 6.1:1 on white, 5.2:1 on --muted. The
     previous 0.6368 measured 3.8:1, which fails AA for text. */
  --destructive: oklch(0.52 0.2078 25.3313);
  --destructive-foreground: oklch(1 0 0);

  /* Registration status. The comps define these as `--ok` and `--warn` and use
     them on three separate components, so they are tokens rather than literals
     repeated in each. Race-day takes the club navy on a pale blue, since it is
     information rather than good or bad news.

     Each pair is a surface and the type that sits on it: #E7F2EB / #1B6B3A,
     #FBF1DC / #8A5A08, #E7EDF6 / navy. All three clear AA. */
  --status-open-surface: oklch(0.9510 0.0149 158.244);
  --status-open: oklch(0.4678 0.1091 152.008);
  --status-soon-surface: oklch(0.9604 0.0297 85.564);
  --status-soon: oklch(0.5081 0.1058 72.321);
  --status-raceday-surface: oklch(0.9442 0.0137 258.346);
  --status-raceday: var(--secondary);

  /* #E3DAD2 — warm border, so rules do not read as cold grey against cream. */
  --border: oklch(0.8933 0.0147 64.325);
  --input: oklch(0.8933 0.0147 64.325);

  /* Oswald sets headings: condensed, the proportions of a race bib.
     Inter sets body copy, which has to stay readable across a wall of results. */
  --font-sans: "Oswald", "Helvetica Neue", Arial, Helvetica, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Arial, Helvetica, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  /* Legacy race results are fixed-width text; the mono stack renders them. */
  --font-mono: "Fira Mono", "Menlo", "Consolas", "Liberation Mono", monospace;

  /* Squarer than Mercury's default. Reads as athletic signage rather than SaaS. */
  --radius: 0.25rem;

  --shadow-x: 0;
  --shadow-y: 1px;
  --shadow-blur: 3px;
  --shadow-spread: 0px;
  --shadow-opacity: 0.1;
  --shadow-color: oklch(0 0 0);
  --shadow-2xs: 0 1px 3px 1px hsl(20 20% 10% / 0.05);
  --shadow-xs: 0 1px 3px 1px hsl(20 20% 10% / 0.05), 0 1px 2px -1px hsl(20 20% 10% / 0.1);
  --shadow-sm: 0 1px 3px 1px hsl(20 20% 10% / 0.1), 0 2px 4px -1px hsl(20 20% 10% / 0.1);
  --shadow: 0 1px 3px 1px hsl(20 20% 10% / 0.1), 0 2px 4px -1px hsl(20 20% 10% / 0.1);
  --shadow-md: 0 1px 3px 1px hsl(20 20% 10% / 0.1), 0 4px 6px -2px hsl(20 20% 10% / 0.1);
  --shadow-lg: 0 1px 3px 1px hsl(20 20% 10% / 0.1), 0 8px 10px -2px hsl(20 20% 10% / 0.1);
  --shadow-xl: 0 1px 3px 1px hsl(20 20% 10% / 0.1), 0 12px 14px -3px hsl(20 20% 10% / 0.1);
  --shadow-2xl: 0 1px 3px 1px hsl(20 20% 10% / 0.1), 0 16px 18px -3px hsl(20 20% 10% / 0.1);

  --tracking-normal: 0em;
  --spacing: 0.25rem;

  /* Set navbar height for hero billboard overlay */
  --navbar-height: calc(var(--spacing) * 15);

  @media (min-width: 768px) {
    --navbar-height: calc(var(--spacing) * 18);
  }
}

/**
 * Dark theme.
 *
 * The base is the badge navy pushed to near-black rather than neutral grey, so
 * the club's colour still reads. Brick red is lightened to #E4676A because the
 * print red is far too dark to sit on a dark ground; navy is lightened to a
 * steel blue for the same reason. Both clear AA against the dark background.
 *
 * The tokens are written twice, because a media query cannot share a block with
 * a class selector: `.dark` forces the palette on, and the media query follows
 * the visitor's system setting. Keep the two blocks identical.
 */
.dark {
  /* #0D1826 */
  --background: oklch(0.2063 0.0323 254.945);
  /* #F4F0EC */
  --foreground: oklch(0.9571 0.0069 67.743);

  /* #152334 */
  --card: oklch(0.2523 0.0378 253.896);
  --card-foreground: var(--foreground);

  /* #E4676A — lightened club red; the print value fails on a dark ground. */
  --primary: oklch(0.667 0.156 20.812);
  --primary-foreground: oklch(0.2063 0.0323 254.945);

  /* #7FA6D9 */
  --secondary: oklch(0.7161 0.0863 255.376);
  --secondary-foreground: oklch(0.2063 0.0323 254.945);
  /* Darker than the dark page, so the edges still read as edges. */
  --secondary-deep: oklch(0.2093 0.0381 251.480);
  --secondary-deep-foreground: oklch(0.8718 0.0286 256.493);

  /* #1C2C40 */
  --muted: oklch(0.289 0.0427 254.51);
  /* #C3CBD6 */
  --muted-foreground: oklch(0.8392 0.0177 256.291);

  --accent: oklch(0.289 0.0427 254.51);
  --accent-foreground: var(--foreground);

  --destructive: oklch(0.72 0.156 20.812);
  --destructive-foreground: oklch(0.2063 0.0323 254.945);

  /* Inverted: a pale surface would glare on a dark page, so the tint goes dark
     and the type goes light. Same hues, so a chip still reads as the same chip. */
  --status-open-surface: oklch(0.2900 0.0450 155.000);
  --status-open: oklch(0.8400 0.1200 152.008);
  --status-soon-surface: oklch(0.3000 0.0500 80.000);
  --status-soon: oklch(0.8500 0.1100 85.000);
  --status-raceday-surface: oklch(0.3000 0.0450 258.346);
  --status-raceday: oklch(0.8300 0.0600 255.000);

  /* #2A3B52 */
  --border: oklch(0.3483 0.0462 256.149);
  --input: oklch(0.3483 0.0462 256.149);

  --font-sans: "Oswald", "Helvetica Neue", Arial, Helvetica, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Arial, Helvetica, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: "Fira Mono", "Menlo", "Consolas", "Liberation Mono", monospace;

  --radius: 0.25rem;

  --shadow-x: 0;
  --shadow-y: 1px;
  --shadow-blur: 3px;
  --shadow-spread: 0px;
  --shadow-opacity: 0.1;
  --shadow-color: oklch(0 0 0);
  --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
  --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
  --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
  --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 12px 14px -1px hsl(0 0% 0% / 0.1);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* #0D1826 */
    --background: oklch(0.2063 0.0323 254.945);
    /* #F4F0EC */
    --foreground: oklch(0.9571 0.0069 67.743);

    /* #152334 */
    --card: oklch(0.2523 0.0378 253.896);
    --card-foreground: var(--foreground);

    /* #E4676A — lightened club red; the print value fails on a dark ground. */
    --primary: oklch(0.667 0.156 20.812);
    --primary-foreground: oklch(0.2063 0.0323 254.945);

    /* #7FA6D9 */
    --secondary: oklch(0.7161 0.0863 255.376);
    --secondary-foreground: oklch(0.2063 0.0323 254.945);
    /* Darker than the dark page, so the edges still read as edges. */
    --secondary-deep: oklch(0.2093 0.0381 251.480);
    --secondary-deep-foreground: oklch(0.8718 0.0286 256.493);

    /* #1C2C40 */
    --muted: oklch(0.289 0.0427 254.51);
    /* #C3CBD6 */
    --muted-foreground: oklch(0.8392 0.0177 256.291);

    --accent: oklch(0.289 0.0427 254.51);
    --accent-foreground: var(--foreground);

    --destructive: oklch(0.72 0.156 20.812);
    --destructive-foreground: oklch(0.2063 0.0323 254.945);

    /* Inverted: a pale surface would glare on a dark page, so the tint goes dark
       and the type goes light. Same hues, so a chip still reads as the same chip. */
    --status-open-surface: oklch(0.2900 0.0450 155.000);
    --status-open: oklch(0.8400 0.1200 152.008);
    --status-soon-surface: oklch(0.3000 0.0500 80.000);
    --status-soon: oklch(0.8500 0.1100 85.000);
    --status-raceday-surface: oklch(0.3000 0.0450 258.346);
    --status-raceday: oklch(0.8300 0.0600 255.000);

    /* #2A3B52 */
    --border: oklch(0.3483 0.0462 256.149);
    --input: oklch(0.3483 0.0462 256.149);

    --font-sans: "Oswald", "Helvetica Neue", Arial, Helvetica, sans-serif;
    --font-body: "Inter", "Helvetica Neue", Arial, Helvetica, sans-serif;
    --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    --font-mono: "Fira Mono", "Menlo", "Consolas", "Liberation Mono", monospace;

    --radius: 0.25rem;

    --shadow-x: 0;
    --shadow-y: 1px;
    --shadow-blur: 3px;
    --shadow-spread: 0px;
    --shadow-opacity: 0.1;
    --shadow-color: oklch(0 0 0);
    --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
    --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
    --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
    --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
    --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
    --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
    --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
    --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 12px 14px -1px hsl(0 0% 0% / 0.1);
    color-scheme: dark;
  }
}

/**
 * Bands that keep their ground in dark mode.
 *
 * `--secondary-foreground` is dark in the dark palette, because it sits on the
 * lightened steel-blue `--secondary`. The navy edges (`--secondary-deep`) stay
 * dark, so anything on them that asks for the secondary foreground would be
 * dark on dark. Redefining the token for descendants of those bands, rather than
 * editing every component on them, puts it back to the page's light text.
 * The steel-blue band gets the opposite: its soft-blue text becomes the dark
 * foreground, which is what a light ground needs.
 *
 * Both rules are written for the media query and for the `.dark` class.
 */
@media (prefers-color-scheme: dark) {
  .bg-secondary-deep,
  footer {
    --secondary-foreground: var(--foreground);
  }

  .bg-secondary,
  .results-runner {
    --secondary-deep-foreground: var(--secondary-foreground);
  }

  /* A panel tinted with the deep navy on the steel-blue band comes out a
     mid-tone that neither text colour clears; on the band itself it does. */
  .results-runner__note {
    background-color: transparent !important;
  }
}

.dark .bg-secondary-deep,
.dark footer {
  --secondary-foreground: var(--foreground);
}

.dark .bg-secondary,
.dark .results-runner {
  --secondary-deep-foreground: var(--secondary-foreground);
}

.dark .results-runner__note {
  background-color: transparent !important;
}
