/* ==========================================================================
   RideUS Web -- Design tokens
   Translated 1:1 from the iOS app's RideUS/Shared/Theme/Theme.swift so the
   web app and the iOS app are visibly the same product. Do not hand-pick
   new colors here -- if Theme.swift changes, update this file to match.
   ========================================================================== */

:root {
  color-scheme: dark light;

  /* --- Brand accents (identical in both appearances, per Theme.swift) ---
     Slightly deepened from the original #2e8fff during the Sept 2026 audit:
     white text on #2e8fff (used on every .btn-primary) only hit a 3.24:1
     contrast ratio against WCAG AA's 4.5:1 minimum for normal-size text.
     #1670c9 clears it (5.0:1) while staying clearly the same brand blue.
     This exact value should be mirrored into the iOS app's PrimaryBlue
     asset so both platforms keep matching, per this file's own header. */
  --color-primary: #1670c9;         /* PrimaryBlue asset catalog color */
  --color-primary-rgb: 22, 112, 201;
  --color-secondary: #e63262;       /* crimson/pink -- badges, unread dots, ratings */
  --color-secondary-rgb: 230, 50, 98;

  /* --- Spacing scale (Theme.Spacing, px == pt) --- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  /* --- Corner radius scale (Theme.Radius) --- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;

  /* --- Type (Theme.Font: rounded display face + default body face) ---
     ui-rounded renders true SF Pro Rounded on Apple devices/Safari, exactly
     matching the iOS app; Poppins is the closest widely-available rounded
     geometric sans as a fallback everywhere else. */
  --font-display: ui-rounded, "SF Pro Rounded", "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --- Light (white) is the default appearance. Dark is used only when the
   OS/browser explicitly prefers dark, or -- see js/theme.js, which runs
   inline in <head> before first paint -- when it's night time on the
   visitor's own clock (20:00-06:00). js/theme.js sets data-theme="dark" or
   data-theme="light" on <html> as soon as the page loads; the bare :root
   and prefers-color-scheme rules below are just the no-JS fallback. --- */
/* danger/warning/success used to be single global values in :root, reused
   as-is against both a white surface (light) and a near-black one (dark).
   The same hex can't read well against opposite ends of the lightness
   scale, which is why an accessibility pass found --color-warning failing
   WCAG AA in light mode and --color-danger/--color-success both failing in
   dark mode. They're theme-scoped here now, same as the surface/text
   tokens below, each tuned to stay >=4.5:1 against its own theme's surface.
   --color-text-tertiary (the ubiquitous `.tiny` class -- trip meta,
   timestamps, badge sub-text) was also failing AA in both themes and is
   adjusted the same way. */
:root,
:root[data-theme="light"] {
  --color-bg: #f2f2f6;
  --color-surface: #ffffff;
  --color-surface-raised: #f8f8f9;
  --color-border: #d8d8dc;
  --color-text-primary: #14171f;
  --color-text-secondary: #5b6270;
  --color-text-tertiary: #6b7280;
  --color-danger: #c0392b;
  --color-warning: #8a6608;
  --color-success: #1a7f37;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0b0c10;
    --color-surface: #18191d;
    --color-surface-raised: #232429;
    --color-border: #32333a;
    --color-text-primary: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.6);
    --color-text-tertiary: rgba(255, 255, 255, 0.5);
    --color-danger: #eb5b4e;
    --color-warning: #b8860b;
    --color-success: #34b25c;
    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --color-bg: #0b0c10;
  --color-surface: #18191d;
  --color-surface-raised: #232429;
  --color-border: #32333a;
  --color-text-primary: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.6);
  --color-text-tertiary: rgba(255, 255, 255, 0.5);
  --color-danger: #eb5b4e;
  --color-warning: #b8860b;
  --color-success: #34b25c;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
}
