/* RarityStack rebuild - design tokens. Dark-first "deep space" theme with an
   aurora accent ramp (sky -> indigo -> violet); a calm paper light theme. */
:root {
  /* surfaces */
  --bg: #0A0D1A;
  --bg-glow-1: rgba(56, 189, 248, 0.07);
  --bg-glow-2: rgba(192, 132, 252, 0.06);
  --surface: #11162A;          /* cards */
  --surface-2: #161C33;        /* elevated: popovers, dialogs, header */
  --surface-3: #1C2340;        /* pressed / active fills */
  --veil: rgba(17, 22, 42, 0.82);  /* translucent header/nav backdrop */

  /* text */
  --text: #EEF1FA;
  --text-muted: #ACB6D2;
  --text-dim: rgba(238, 241, 250, 0.68);

  /* brand + semantics */
  --accent: #38BDF8;
  --accent-2: #818CF8;
  --accent-3: #C084FC;
  /* text-on-surface variants: identical to the accents in dark, darkened in light for AA contrast */
  --accent-text: var(--accent);
  --gold-text: var(--gold);
  --grad-brand: linear-gradient(135deg, #38BDF8, #818CF8 55%, #C084FC);
  --accent-soft: rgba(56, 189, 248, 0.14);
  --up: #4ADE80;
  --down: #FB7185;
  --warn: #FBBF24;
  --error: #FB7185;
  --gold: #F5C542;

  /* lines + depth */
  --border: rgba(148, 163, 255, 0.11);
  --border-strong: rgba(148, 163, 255, 0.22);
  --shadow-sm: 0 1px 2px rgba(2, 6, 18, 0.4), 0 2px 8px rgba(2, 6, 18, 0.28);
  --shadow: 0 2px 6px rgba(2, 6, 18, 0.42), 0 12px 32px rgba(2, 6, 18, 0.38);
  --elev: inset 0 1px 0 rgba(255, 255, 255, 0.045), var(--shadow-sm);
  --ring: 0 0 0 3px rgba(56, 189, 248, 0.35);

  /* shape */
  --r-ctl: 10px;
  --r-card: 18px;
  --r-pill: 999px;

  /* spacing (4px base) + type scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --fs-xs: 12.5px; --fs-sm: 13.75px; --fs-md: 15px; --fs-lg: 17px;
  --fs-xl: 20px; --fs-2xl: 27px; --fs-hero: clamp(30px, 6vw, 44px);

  /* layout */
  --maxw: 1140px;
  --gap: 14px;
  --header-h: 62px;
  --nav-h: 62px;

  --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', sans-serif;
  --font-display: 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;

  /* milestone category gradients (category identity colors) */
  --ms-ofXPeople-a: #00600F;    --ms-ofXPeople-b: #388E3C;
  --ms-ofXPercent-a: #001970;   --ms-ofXPercent-b: #303F9F;
  --ms-ofValue-a: #9A0007;      --ms-ofValue-b: #D32F2F;
  --ms-inBTC-a: #BB4D00;        --ms-inBTC-b: #F57C00;
  --ms-ofEventValue-a: #827717; --ms-ofEventValue-b: #B4A647;
  --ms-ofNetwork-a: #1C313A;    --ms-ofNetwork-b: #455A64;
  --ms-myPosition-a: #4A0072;   --ms-myPosition-b: #7B1FA2;
  --ms-ofCountry-a: #006978;    --ms-ofCountry-b: #0097A7;
  --ms-custom-a: #880E4F;       --ms-custom-b: #C2185B;
  --ms-target-a: #C25E00;       --ms-target-b: #FFB300;

  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #F6F7FB;
  --bg-glow-1: rgba(56, 189, 248, 0.10);
  --bg-glow-2: rgba(192, 132, 252, 0.08);
  --surface: #FFFFFF;
  --surface-2: #FFFFFF;
  --surface-3: #EEF1F8;
  --veil: rgba(255, 255, 255, 0.85);
  --text: #0D1226;
  --text-muted: #4D5870;
  --text-dim: rgba(13, 18, 38, 0.68);
  --accent: #0284C7;
  --accent-2: #4F46E5;
  --accent-3: #9333EA;
  --accent-text: #0369A1; /* accent as TEXT only: >= 4.5:1 on white; decorative accents keep --accent */
  --gold-text: #8A6210;
  --grad-brand: linear-gradient(135deg, #0284C7, #4F46E5 55%, #9333EA);
  --accent-soft: rgba(2, 132, 199, 0.10);
  --up: #15803D;
  --down: #BE123C;
  --gold: #B4841B;
  --border: rgba(13, 18, 38, 0.10);
  --border-strong: rgba(13, 18, 38, 0.22);
  --shadow-sm: 0 1px 2px rgba(13, 18, 38, 0.06), 0 2px 10px rgba(13, 18, 38, 0.06);
  --shadow: 0 2px 8px rgba(13, 18, 38, 0.08), 0 14px 36px rgba(13, 18, 38, 0.10);
  --elev: var(--shadow-sm);
  --ring: 0 0 0 3px rgba(2, 132, 199, 0.28);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--fs-md);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* fixed aurora glow behind everything (pure CSS, zero requests) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(52rem 34rem at 12% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(46rem 30rem at 105% 12%, var(--bg-glow-2), transparent 62%);
}
a { color: inherit; }
button { font-family: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-ctl); }

.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.mono { font-variant-numeric: tabular-nums; }
.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
