/* ========================================
   GanttFlow v2 — Base CSS Reset + Tokens
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Light mode (default) ── */
:root, [data-theme="light"] {
  --bg: #F8F8F8;
  --surface: #FFFFFF;
  --surface-hover: #F5F5F5;
  --surface-offset: #F1F1F1;
  --border: #E0E0E0;
  --border-subtle: rgba(0,0,0,0.06);
  --text-primary: #1D1C1D;
  --text-muted: #616061;
  --text-faint: #ABABAD;
  --accent: #4A154B;
  --accent-hover: #611f69;
  --accent-text: #FFFFFF;
  --today-line: #E34D4D;
  --skeleton: #E8E8E8;
  --skeleton-shimmer: #F5F5F5;
  --error: #CF513D;
  --error-bg: #FFF0ED;
  --success: #5DA283;
  --success-bg: #F0FAF5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --overlay: rgba(0,0,0,0.4);
  color-scheme: light;
}

/* ── Dark mode ── */
[data-theme="dark"] {
  --bg: #1A1D21;
  --surface: #222529;
  --surface-hover: #2A2D31;
  --surface-offset: #2C2E33;
  --border: #3D3E42;
  --border-subtle: rgba(255,255,255,0.06);
  --text-primary: #D1D2D3;
  --text-muted: #9A9B9D;
  --text-faint: #6B6C6F;
  --accent: #C78FD0;
  --accent-hover: #D9A8E0;
  --accent-text: #1A1D21;
  --today-line: #E34D4D;
  --skeleton: #2C2E33;
  --skeleton-shimmer: #3D3E42;
  --error: #E06B5A;
  --error-bg: rgba(207,81,61,0.15);
  --success: #6DB896;
  --success-bg: rgba(93,162,131,0.15);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  --overlay: rgba(0,0,0,0.6);
  color-scheme: dark;
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1A1D21;
    --surface: #222529;
    --surface-hover: #2A2D31;
    --surface-offset: #2C2E33;
    --border: #3D3E42;
    --border-subtle: rgba(255,255,255,0.06);
    --text-primary: #D1D2D3;
    --text-muted: #9A9B9D;
    --text-faint: #6B6C6F;
    --accent: #C78FD0;
    --accent-hover: #D9A8E0;
    --accent-text: #1A1D21;
    --today-line: #E34D4D;
    --skeleton: #2C2E33;
    --skeleton-shimmer: #3D3E42;
    --error: #E06B5A;
    --error-bg: rgba(207,81,61,0.15);
    --success: #6DB896;
    --success-bg: rgba(93,162,131,0.15);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --overlay: rgba(0,0,0,0.6);
    color-scheme: dark;
  }
}

/* ── Category Colors ── */
:root {
  --cat-blue: #4573D2;
  --cat-green: #5DA283;
  --cat-orange: #E8873A;
  --cat-pink: #E362A0;
  --cat-teal: #1AA8A8;
  --cat-red: #CF513D;
  --cat-purple: #7C3AED;
}

/* ── Typography ── */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --text-xs: 0.6875rem;   /* 11px */
  --text-sm: 0.75rem;     /* 12px */
  --text-base: 0.8125rem; /* 13px */
  --text-md: 0.875rem;    /* 14px */
  --text-lg: 1rem;        /* 16px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 2rem;       /* 32px */
  --lh-tight: 1.2;
  --lh-base: 1.5;
  --lh-relaxed: 1.65;
}

/* ── Spacing (4px grid) ── */
:root {
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
}

/* ── Radius ── */
:root {
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 999px;
}

/* ── Transitions ── */
:root {
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 180ms;
  --duration-slow: 300ms;
}

/* ── Global Reset ── */
html, body {
  height: 100%;
  overflow: hidden;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: var(--lh-base);
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* ── Scrollbar Styling ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ── Tabular Nums ── */
.tabular {
  font-variant-numeric: tabular-nums lining-nums;
}

/* ── Selection ── */
::selection {
  background: var(--accent);
  color: var(--accent-text);
}

/* ── Skip Link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  background: var(--accent);
  color: var(--accent-text);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  z-index: 9999;
  font-size: var(--text-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--sp-2);
}
