/* =====================================================================
   Upstar — design tokens (ds-1.0.0, FROZEN)
   ---------------------------------------------------------------------
   Dark theme is the default (:root and [data-theme="dark"]).
   Light theme applies on [data-theme="light"] (set on <html>).
   Load order on every page:
     <link rel="stylesheet" href="assets/tokens.css">
     <link rel="stylesheet" href="assets/components.css">
   Accent "rise" is reserved for: rising badges, star gains, sparklines,
   primary CTA, active indicators. Never decorative.
   ===================================================================== */

:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0A0B0D;
  --surface: #111317;
  --raised: #16191E;
  --hover: #1B1F25;          /* row/control hover fill (never changes text color) */
  --border: #23272E;
  --border-strong: #2E333B;

  /* Text */
  --text: #ECEEF1;           /* 17.0:1 on --bg */
  --muted: #9BA3AF;          /* 7.6:1 on --bg  — default secondary text */
  --faint: #6B7280;          /* 4.0:1 on --bg  — non-essential, large only */

  /* Accent: rising */
  --rise: #2BE38A;
  --rise-strong: #4BEB9E;    /* hover state of rise surfaces (brighter, not grayer) */
  --rise-soft: rgba(43, 227, 138, 0.12);
  --rise-line: rgba(43, 227, 138, 0.32);
  --on-rise: #04130B;
  --rise-text: #2BE38A;      /* rise used as text color (≥4.5:1 on all surfaces) */

  /* Status */
  --danger: #F0574B;
  --danger-soft: rgba(240, 87, 75, 0.12);
  --on-danger: #1A0503;
  --warning: #E8B04A;
  --warning-soft: rgba(232, 176, 74, 0.12);
  --info: #5B9DF5;
  --info-soft: rgba(91, 157, 245, 0.12);

  /* Overlays */
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border-strong);
  --skeleton-base: #16191E;
  --skeleton-shine: #1F2329;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #FFFFFF;
  --surface: #F6F7F9;
  --raised: #FFFFFF;
  --hover: #EEF0F3;
  --border: #E3E6EA;
  --border-strong: #CDD2D8;

  --text: #0F1115;           /* 18.9:1 */
  --muted: #5B6370;          /* 6.2:1 on #fff, 5.8:1 on --surface */
  --faint: #7A828E;          /* 3.9:1, non-essential large only */

  --rise: #0E9F5B;
  --rise-strong: #0B8A4E;
  --rise-soft: rgba(14, 159, 91, 0.10);
  --rise-line: rgba(14, 159, 91, 0.35);
  --on-rise: #FFFFFF;
  --rise-text: #0A8048;      /* darker for 4.5:1 text on white/surface */

  --danger: #C8362B;
  --danger-soft: rgba(200, 54, 43, 0.08);
  --on-danger: #FFFFFF;
  --warning: #93620A;
  --warning-soft: rgba(176, 120, 18, 0.10);
  --info: #2763C4;
  --info-soft: rgba(39, 99, 196, 0.08);

  --scrim: rgba(15, 17, 21, 0.4);
  --shadow-pop: 0 8px 24px rgba(15, 17, 21, 0.10), 0 0 0 1px var(--border-strong);
  --skeleton-base: #EEF0F3;
  --skeleton-shine: #F6F7F9;
}

:root {
  /* Fonts */
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Type scale */
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-32: 32px;
  --fs-48: 48px;
  --lh-body: 1.5;
  --lh-tight: 1.15;
  --lh-heading: 1.25;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Spacing (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Radii */
  --r-control: 6px;
  --r-card: 8px;
  --r-chip: 999px;

  /* Motion */
  --dur-fast: 150ms;
  --dur-base: 200ms;
  --dur-slow: 250ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  /* Layout */
  --sidebar-w: 240px;
  --rail-w: 300px;
  --topbar-h: 56px;
  --bottomnav-h: 64px;
  --container: 1200px;
  --container-narrow: 720px;
  --container-wide: 1440px;

  /* Focus */
  --focus-ring: 2px solid var(--rise);
  --focus-offset: 2px;

  /* Z layers */
  --z-sticky: 20;
  --z-nav: 30;
  --z-sheet: 50;
  --z-modal: 60;
  --z-toast: 70;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
  }
}
