/* ==========================================================================
   Design system tokens  (prefix: --ds-)
   Loaded BEFORE each layout's own <style>, so legacy rules keep working while
   pages migrate. Brand colours still come from the database via the layout's
   --brand-green / --brand-blue; nothing here hardcodes a brand colour.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Type */
  --ds-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ds-font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --ds-text-xs: .75rem;  --ds-text-sm: .8125rem; --ds-text-base: .9375rem;
  --ds-text-lg: 1.0625rem; --ds-text-xl: 1.25rem; --ds-text-2xl: 1.625rem;
  --ds-leading: 1.5;

  /* Spacing (4px grid) */
  --ds-space-1: .25rem; --ds-space-2: .5rem;  --ds-space-3: .75rem;
  --ds-space-4: 1rem;   --ds-space-5: 1.5rem; --ds-space-6: 2rem; --ds-space-7: 3rem;

  /* Shape + elevation */
  --ds-radius-sm: 6px; --ds-radius: 10px; --ds-radius-lg: 14px;
  --ds-shadow-1: 0 1px 2px rgba(15, 23, 42, .06);
  --ds-shadow-2: 0 4px 14px rgba(15, 23, 42, .10);

  /* Neutrals + semantics (light) */
  --ds-surface:   #ffffff;
  --ds-surface-2: #f8fafc;
  --ds-border:    #e2e8f0;
  --ds-text:      #0f172a;
  --ds-text-2:    #475569;
  --ds-text-3:    #64748b;           /* 4.76:1 on white: ok for secondary text */
  --ds-success: #15803d; --ds-success-bg: #dcfce7;
  --ds-warning: #b45309; --ds-warning-bg: #fef3c7;
  --ds-danger:  #b91c1c; --ds-danger-bg:  #fee2e2;
  --ds-info:    #1d4ed8; --ds-info-bg:    #dbeafe;
  --ds-focus: #2563eb;

  /* Motion */
  --ds-dur-fast: 150ms; --ds-dur: 220ms;
  --ds-ease: cubic-bezier(.2, .7, .2, 1);

  /* Touch */
  --ds-tap: 44px;
}

[data-bs-theme="dark"], html[data-theme="dark"] {
  --ds-surface:   #1e293b;
  --ds-surface-2: #0f172a;
  --ds-border:    #334155;
  --ds-text:      #e2e8f0;
  --ds-text-2:    #cbd5e1;
  --ds-text-3:    #94a3b8;
  --ds-success: #4ade80; --ds-success-bg: rgba(74, 222, 128, .14);
  --ds-warning: #fbbf24; --ds-warning-bg: rgba(251, 191, 36, .14);
  --ds-danger:  #f87171; --ds-danger-bg:  rgba(248, 113, 113, .14);
  --ds-info:    #60a5fa; --ds-info-bg:    rgba(96, 165, 250, .14);
  --ds-focus: #93c5fd;
  --ds-shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --ds-shadow-2: 0 4px 14px rgba(0, 0, 0, .5);
}

/* Global base: font, numerals, focus, motion ------------------------------ */
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--ds-font); line-height: var(--ds-leading); font-feature-settings: "cv11", "ss01"; }
.ds-num, .stat-value, table td, table th, .vote-count { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline-offset: 0; }

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