/* Track Up — design tokens + base styles.
   Palette: Slate + Steel Blue. Typography: Inter throughout.
   Compact, structured, data-forward. */

:root {
  /* ---- Slate ramp (neutrals) ---- */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* ---- Steel blue (accent) ---- */
  --steel-50:  #eff6ff;
  --steel-100: #dbeafe;
  --steel-200: #bfdbfe;
  --steel-300: #93c5fd;
  --steel-400: #60a5fa;
  --steel-500: #3b82f6;
  --steel-600: #2563eb;
  --steel-700: #1d4ed8;
  --steel-800: #1e40af;
  --steel-900: #1e3a8a;

  /* ---- Semantic colors ---- */
  --bg:          var(--slate-50);
  --bg-elevated: #ffffff;
  --bg-subtle:   var(--slate-100);
  --bg-inset:    var(--slate-200);
  --surface:     #ffffff;
  --surface-hover: var(--slate-50);
  --border:      var(--slate-200);
  --border-strong: var(--slate-300);
  --text:        var(--slate-900);
  --text-muted:  var(--slate-500);
  --text-subtle: var(--slate-400);
  --text-inverse: #ffffff;
  --accent:      var(--steel-600);
  --accent-hover: var(--steel-700);
  --accent-soft: var(--steel-50);
  --accent-border: var(--steel-200);

  /* Status */
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger:  #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --info:    var(--steel-600);
  --info-soft: var(--steel-50);

  /* ---- Typography ---- */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Type scale */
  --text-xs:   0.75rem;    /* 12 */
  --text-sm:   0.8125rem;  /* 13 */
  --text-base: 0.9375rem;  /* 15 */
  --text-lg:   1.0625rem;  /* 17 */
  --text-xl:   1.25rem;    /* 20 */
  --text-2xl:  1.5rem;     /* 24 */
  --text-3xl:  1.875rem;   /* 30 */
  --text-4xl:  2.25rem;    /* 36 */

  /* Line heights */
  --leading-tight: 1.15;
  --leading-snug:  1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* ---- Spacing scale ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* ---- Radii ---- */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* ---- Shadows (soft, layered) ---- */
  --shadow-xs: 0 1px 2px 0 rgb(15 23 42 / 0.025);
  --shadow-sm: 0 1px 3px 0 rgb(15 23 42 / 0.045);
  --shadow:    0 3px 8px -3px rgb(15 23 42 / 0.08);
  --shadow-md: 0 8px 20px -10px rgb(15 23 42 / 0.18);
  --shadow-lg: 0 14px 32px -14px rgb(15 23 42 / 0.22);
  --shadow-xl: 0 24px 56px -22px rgb(15 23 42 / 0.28);
  --shadow-focus: 0 0 0 3px rgb(37 99 235 / 0.18);

  /* ---- Motion ---- */
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.65, 0, 0.35, 1);
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:  140ms;
  --dur:       220ms;
  --dur-slow:  360ms;

  /* ---- Layout ---- */
  --sidebar-w: 208px;
  --topbar-h: 50px;
  --content-max: 1440px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ---- Typography utilities ---- */
.font-display { font-family: var(--font-display); font-feature-settings: 'liga', 'kern'; }
.font-mono { font-family: var(--font-mono); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: var(--radius-full); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

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

/* ---- Dark theme ----
   Applied via [data-theme="dark"] on <html>. The JS reads the user's
   theme_pref (system|light|dark) and resolves system against prefers-color-scheme. */
[data-theme="dark"] {
  --bg:          var(--slate-950);
  --bg-elevated: var(--slate-900);
  --bg-subtle:   var(--slate-900);
  --bg-inset:    var(--slate-800);
  --surface:     var(--slate-900);
  --surface-hover: var(--slate-800);
  --border:      var(--slate-800);
  --border-strong: var(--slate-700);
  --text:        var(--slate-100);
  --text-muted:  var(--slate-400);
  --text-subtle: var(--slate-500);
  --text-inverse: var(--slate-900);
  --accent:      var(--steel-400);
  --accent-hover: var(--steel-300);
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-border: var(--slate-700);
  --accent-strong: var(--steel-300);

  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);
  --danger:  #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);
  --info:    var(--steel-400);
  --info-soft: rgba(59, 130, 246, 0.12);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.6);
  --shadow-xl: 0 24px 64px rgba(0,0,0,0.7);
}

[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .card { background: var(--bg-elevated); border-color: var(--border); }
[data-theme="dark"] .input, [data-theme="dark"] .textarea, [data-theme="dark"] .select { background: var(--slate-800); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .sidebar { background: var(--slate-950); border-color: var(--slate-800); }
[data-theme="dark"] .topbar { background: var(--bg-elevated); border-color: var(--border); }
[data-theme="dark"] .table th { background: var(--bg-subtle); border-color: var(--border); }
[data-theme="dark"] .table td { border-color: var(--border); }
[data-theme="dark"] .badge { background: var(--slate-800); }
[data-theme="dark"] .btn-ghost { color: var(--text); }
[data-theme="dark"] .btn-ghost:hover { background: var(--slate-800); }
[data-theme="dark"] .modal { background: var(--bg-elevated); }
[data-theme="dark"] .comment-item.is-pinned { background: var(--warning-soft); }
