/* ==========================================================================
   Digital Earth - CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
  /* ========================================
     Colors
     ======================================== */

  /* Primary Brand - Deep Teal (technology + nature) */
  --color-primary: #0F766E;
  --color-primary-light: #14B8A6;
  --color-primary-dark: #0D5D56;
  --color-primary-50: #F0FDFA;
  --color-primary-100: #CCFBF1;
  --color-primary-200: #99F6E4;
  --color-primary-300: #5EEAD4;
  --color-primary-400: #2DD4BF;
  --color-primary-500: #14B8A6;
  --color-primary-600: #0D9488;
  --color-primary-700: #0F766E;
  --color-primary-800: #115E59;
  --color-primary-900: #134E4A;

  /* Secondary - Sage Green (accent, call-outs) */
  --color-secondary: #9DC88D;
  --color-secondary-light: #B8D9AC;
  --color-secondary-dark: #7AB368;

  /* Accent Cool - Sky Blue (links, interactive) */
  --color-accent-cool: #7DD3FC;
  --color-accent-cool-light: #BAE6FD;
  --color-accent-cool-dark: #38BDF8;

  /* Accent Warm - Warm Sand (highlights, warmth) */
  --color-accent-warm: #E8C5A5;
  --color-accent-warm-light: #F3DCC7;
  --color-accent-warm-dark: #D4A574;

  /* Neutrals */
  --color-slate: #475569;
  --color-slate-light: #64748B;
  --color-slate-dark: #334155;
  --color-stone: #78716C;
  --color-stone-light: #A8A29E;
  --color-stone-dark: #57534E;
  --color-warm-white: #FAFAF9;
  --color-brown: #57534E;

  /* State Colors */
  --color-success: #16A34A;
  --color-success-light: #22C55E;
  --color-success-bg: #F0FDF4;
  --color-warning: #F59E0B;
  --color-warning-light: #FBBF24;
  --color-warning-bg: #FFFBEB;
  --color-error: #DC2626;
  --color-error-light: #EF4444;
  --color-error-bg: #FEF2F2;
  --color-info: #0EA5E9;
  --color-info-light: #38BDF8;
  --color-info-bg: #F0F9FF;

  /* Background & Surface */
  --color-bg: #FAFAF9;
  --color-bg-alt: #F5F5F4;
  --color-surface: #FFFFFF;
  --color-surface-elevated: #FFFFFF;
  --color-border: #E7E5E4;
  --color-border-light: #F5F5F4;

  /* Text Colors */
  --color-text: #1C1917;
  --color-text-secondary: #57534E;
  --color-text-muted: #78716C;
  --color-text-inverse: #FAFAF9;

  /* ========================================
     Typography
     ======================================== */

  /* Font Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, 'Courier New', monospace;

  /* Font Sizes - Fluid Typography */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);      /* 12-13px */
  --text-sm: clamp(0.8125rem, 0.775rem + 0.1875vw, 0.875rem); /* 13-14px */
  --text-base: clamp(0.9375rem, 0.9rem + 0.1875vw, 1rem);     /* 15-16px */
  --text-lg: clamp(1.0625rem, 1rem + 0.3125vw, 1.125rem);     /* 17-18px */
  --text-xl: clamp(1.1875rem, 1.1rem + 0.4375vw, 1.25rem);    /* 19-20px */
  --text-2xl: clamp(1.375rem, 1.25rem + 0.625vw, 1.5rem);     /* 22-24px */
  --text-3xl: clamp(1.625rem, 1.45rem + 0.875vw, 1.875rem);   /* 26-30px */
  --text-4xl: clamp(1.875rem, 1.6rem + 1.375vw, 2.25rem);     /* 30-36px */
  --text-5xl: clamp(2.25rem, 1.85rem + 2vw, 3rem);            /* 36-48px */
  --text-6xl: clamp(2.75rem, 2.2rem + 2.75vw, 3.75rem);       /* 44-60px */

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* ========================================
     Spacing (8px base grid)
     ======================================== */

  --space-0: 0;
  --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 */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */
  --space-32: 8rem;     /* 128px */

  /* ========================================
     Layout
     ======================================== */

  /* Container Max Widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1440px;

  /* Container Padding */
  --container-padding: clamp(1rem, 5vw, 2rem);

  /* Content Max Width (for readable text) */
  --content-width: 75ch;

  /* ========================================
     Borders & Radius
     ======================================== */

  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  --border-width: 1px;
  --border-width-2: 2px;

  /* ========================================
     Shadows
     ======================================== */

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

  /* Colored Shadows for Primary */
  --shadow-primary: 0 4px 14px 0 rgb(15 118 110 / 0.25);
  --shadow-primary-lg: 0 10px 25px -3px rgb(15 118 110 / 0.3);

  /* ========================================
     Transitions & Animation
     ======================================== */

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-slower: 500ms ease;

  /* Easing Functions */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* ========================================
     Z-Index Scale
     ======================================== */

  --z-behind: -1;
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;
  --z-max: 9999;

  /* ========================================
     Focus Styles
     ======================================== */

  --focus-ring-width: 3px;
  --focus-ring-color: var(--color-accent-cool);
  --focus-ring-offset: 2px;
  --focus-ring: 0 0 0 var(--focus-ring-offset) var(--color-bg),
                0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--focus-ring-color);

  /* ========================================
     Breakpoints (for reference in JS)
     ======================================== */

  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1440px;
}

/* ==========================================================================
   Dark Mode
   ========================================================================== */

[data-theme="dark"],
.dark {
  /* Background & Surface */
  --color-bg: #171717;
  --color-bg-alt: #1C1C1C;
  --color-surface: #262626;
  --color-surface-elevated: #2E2E2E;
  --color-border: #404040;
  --color-border-light: #333333;

  /* Text Colors */
  --color-text: #FAFAF9;
  --color-text-secondary: #A8A29E;
  --color-text-muted: #78716C;
  --color-text-inverse: #1C1917;

  /* Adjust primary for dark mode */
  --color-primary: #14B8A6;
  --color-primary-light: #2DD4BF;
  --color-primary-dark: #0D9488;

  /* Shadows (lighter for dark mode) */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.35), 0 4px 6px -4px rgb(0 0 0 / 0.25);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);

  /* Focus ring for dark mode */
  --focus-ring: 0 0 0 var(--focus-ring-offset) var(--color-bg),
                0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--color-accent-cool-light);
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0.01ms;
    --transition-base: 0.01ms;
    --transition-slow: 0.01ms;
    --transition-slower: 0.01ms;
  }
}
