/**
 * XMarks Design Tokens v2.0
 * 
 * Design Philosophy: Calm, confident, premium
 * Inspiration: Linear, Arc Browser, Raycast, Notion
 * Principle: "Remove until it breaks, then add one thing back."
 */

/* ===================================
   DARK MODE (Default)
   =================================== */
:root[data-theme="dark"] {
  /* Backgrounds - subtle layering */
  --bg-base: #09090b;           /* zinc-950 - deepest */
  --bg-surface: #18181b;        /* zinc-900 - cards */
  --bg-elevated: #27272a;       /* zinc-800 - hover, dropdowns */
  --bg-overlay: rgba(0,0,0,0.8); /* modals backdrop */
  
  /* Text - high contrast hierarchy */
  --text-primary: #fafafa;      /* zinc-50 */
  --text-secondary: #a1a1aa;    /* zinc-400 */
  --text-tertiary: #52525b;     /* zinc-600 */
  --text-inverse: #09090b;
  
  /* Borders - barely there */
  --border-subtle: #27272a;     /* zinc-800 */
  --border-default: #3f3f46;    /* zinc-700 */
  --border-emphasis: #52525b;   /* zinc-600 */
  
  /* Accent - warm amber, used sparingly */
  --accent: #f59e0b;            /* amber-500 */
  --accent-hover: #d97706;      /* amber-600 */
  --accent-muted: rgba(245, 158, 11, 0.15);
  --accent-subtle: rgba(245, 158, 11, 0.08);
  
  /* Semantic */
  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.15);
  --warning: #eab308;
  --warning-muted: rgba(234, 179, 8, 0.15);
  --error: #ef4444;
  --error-muted: rgba(239, 68, 68, 0.15);
}

/* ===================================
   LIGHT MODE
   =================================== */
:root[data-theme="light"] {
  /* Backgrounds */
  --bg-base: #ffffff;
  --bg-surface: #fafafa;        /* zinc-50 */
  --bg-elevated: #f4f4f5;       /* zinc-100 */
  --bg-overlay: rgba(255,255,255,0.9);
  
  /* Text */
  --text-primary: #18181b;      /* zinc-900 */
  --text-secondary: #52525b;    /* zinc-600 */
  --text-tertiary: #a1a1aa;     /* zinc-400 */
  --text-inverse: #fafafa;
  
  /* Borders */
  --border-subtle: #f4f4f5;     /* zinc-100 */
  --border-default: #e4e4e7;    /* zinc-200 */
  --border-emphasis: #d4d4d8;   /* zinc-300 */
  
  /* Accent - same amber */
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-muted: rgba(245, 158, 11, 0.12);
  --accent-subtle: rgba(245, 158, 11, 0.06);
  
  /* Semantic */
  --success: #16a34a;
  --success-muted: rgba(22, 163, 74, 0.1);
  --warning: #ca8a04;
  --warning-muted: rgba(202, 138, 4, 0.1);
  --error: #dc2626;
  --error-muted: rgba(220, 38, 38, 0.1);
}

/* ===================================
   TYPOGRAPHY
   =================================== */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  
  /* Sizes */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.8125rem;   /* 13px */
  --text-base: 0.875rem;  /* 14px - body default */
  --text-lg: 1rem;        /* 16px */
  --text-xl: 1.125rem;    /* 18px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 2rem;       /* 32px */
  
  /* Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  
  /* Line heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
}

/* ===================================
   SPACING (4px base unit)
   =================================== */
:root {
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
}

/* ===================================
   LAYOUT
   =================================== */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ===================================
   TRANSITIONS
   =================================== */
:root {
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ===================================
   CATEGORY COLORS
   =================================== */
:root {
  --cat-ai: #8b5cf6;
  --cat-business: #3b82f6;
  --cat-career: #06b6d4;
  --cat-health: #22c55e;
  --cat-personal: #f59e0b;
  --cat-finance: #eab308;
  --cat-creative: #ec4899;
  --cat-other: #6b7280;
}

/* ===================================
   BASE RESET
   =================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
}

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-emphasis);
}

/* Focus visible */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--accent);
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
}

/* Remove button defaults */
button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* Alpine.js cloak - hide elements until Alpine initializes */
[x-cloak] {
  display: none !important;
}
