/**
 * Design System Tokens
 * OKLCH color space for better perceptual consistency
 */

:root {
  /* ── Typography ── */
  --font-display: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'Courier New', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: clamp(2rem, 4vw, 3.5rem);
  --text-4xl: clamp(2.8rem, 6.5vw, 5.5rem);

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.1;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.7;

  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: -0.01em;
  --letter-spacing-wide: 0.05em;

  /* ── Color Palette (Light Mode) ── */
  --color-bg: #FAF8F5;
  --color-surface: rgba(255, 255, 255, 0.6);
  --color-surface-hover: rgba(255, 255, 255, 0.8);
  --color-surface-alt: rgba(250, 248, 245, 0.5);

  --color-text: #1A1918;
  --color-text-secondary: #6B6966;
  --color-text-muted: #9B9894;

  --color-accent: #009EFF;
  --color-accent-light: #33B8FF;
  --color-accent-dark: #007ACC;

  --color-border: rgba(0, 0, 0, 0.06);
  --color-border-hover: rgba(0, 0, 0, 0.1);

  /* ── Spacing Scale ── */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ── Section Padding ── */
  --section-pad-inline: 1.5rem;
  --section-pad-block: clamp(4rem, 10vw, 8rem);
  --section-max-width: 1100px;

  /* ── Border Radius ── */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.5rem;
  --radius-full: 100px;

  /* ── Easing & Animation ── */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast: 160ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-hero: 900ms;

  /* ── Shadows ── */
  --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 12px 32px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.12);

  /* ── Z-index Scale ── */
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal-backdrop: 40;
  --z-modal: 50;
  --z-toast: 60;
  --z-tooltip: 70;
}

/* ── Dark Mode ── */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --color-bg: #0C0C0E;
    --color-surface: rgba(22, 22, 26, 0.7);
    --color-surface-hover: rgba(30, 30, 36, 0.8);
    --color-surface-alt: rgba(12, 12, 14, 0.5);

    --color-text: #F5F4F2;
    --color-text-secondary: #8B8986;
    --color-text-muted: #6B6966;

    --color-accent: #009EFF;
    --color-accent-light: #33B8FF;
    --color-accent-dark: #007ACC;

    --color-border: rgba(255, 255, 255, 0.06);
    --color-border-hover: rgba(255, 255, 255, 0.1);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.4);
  }
}

/* ── Dark Mode (Explicit Class) ── */
html.dark {
  --color-bg: #0C0C0E;
  --color-surface: rgba(22, 22, 26, 0.7);
  --color-surface-hover: rgba(30, 30, 36, 0.8);
  --color-surface-alt: rgba(12, 12, 14, 0.5);

  --color-text: #F5F4F2;
  --color-text-secondary: #8B8986;
  --color-text-muted: #6B6966;

  --color-accent: #009EFF;
  --color-accent-light: #33B8FF;
  --color-accent-dark: #007ACC;

  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-hover: rgba(255, 255, 255, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.4);
}

html.light {
  --color-bg: #FAF8F5;
  --color-surface: rgba(255, 255, 255, 0.6);
  --color-surface-hover: rgba(255, 255, 255, 0.8);
  --color-surface-alt: rgba(250, 248, 245, 0.5);

  --color-text: #1A1918;
  --color-text-secondary: #6B6966;
  --color-text-muted: #9B9894;

  --color-accent: #009EFF;
  --color-accent-light: #33B8FF;
  --color-accent-dark: #007ACC;

  --color-border: rgba(0, 0, 0, 0.06);
  --color-border-hover: rgba(0, 0, 0, 0.1);
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-normal: 0ms;
    --duration-slow: 0ms;
    --duration-hero: 0ms;
  }
}
