/* ============================================
   Modern UI Base Styles & Design Tokens
   Reset + CSS Variables + Typography + Dark Mode
   ============================================ */

/* --- CSS Variables (Design Tokens) --- */
:root {
  /* HSL Base for primary color (e.g. vibrant blue/purple) */
  --primary-h: 250;
  --primary-s: 85%;
  --primary-l: 55%;

  /* Primary Colors */
  --color-primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
  --color-primary-hover: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) - 5%));
  --color-primary-active: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) - 10%));
  --color-primary-disabled: hsl(var(--primary-h), 20%, 80%);
  --color-primary-lighter: hsl(var(--primary-h), var(--primary-s), 90%);
  --color-primary-bg: hsl(var(--primary-h), var(--primary-s), 96%);

  /* Neutral Colors (Light Mode) */
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F1F5F9;
  --color-border: #E2E8F0;
  
  --color-text: #0F172A;
  --color-text-secondary: #475569;
  --color-text-light: #94A3B8;

  /* Status Colors */
  --color-success: #10B981;
  --color-error: #EF4444;
  --color-warning: #F59E0B;
  --color-info: #3B82F6;

  /* Elevation & Shadows (Light) */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Spacing Scale (rem) */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* Transition (Spring-like/Smooth) */
  --transition-fast: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-base: 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-spring: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Layout */
  --nav-height: 72px;
  --container-max: 1280px;
  --container-padding: clamp(1rem, 5vw, 2rem);

  /* Z-index scale */
  --z-dropdown: 50;
  --z-mobile-nav: 99;
  --z-navbar: 100;
  --z-modal: 1000;
  --z-lightbox: 1100;
}

/* --- Dark Mode Tokens --- */
@media (prefers-color-scheme: dark) {
  :root {
    /* Neutral Colors (Dark Mode) */
    --color-bg: #0F172A;
    --color-surface: #1E293B; /* Elevation 1 */
    --color-surface-hover: #334155;
    --color-border: #334155;
    
    --color-text: #F8FAFC;
    --color-text-secondary: #CBD5E1;
    --color-text-light: #64748B;

    --color-primary-lighter: hsl(var(--primary-h), var(--primary-s), 25%);
    --color-primary-bg: hsl(var(--primary-h), var(--primary-s), 15%);

    /* Elevation Shadows for dark mode (using slight brightness rather than heavy black shadow) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  }
}

/* User toggle for dark mode if implemented via class on html/body */
html.dark-mode {
    --color-bg: #0F172A;
    --color-surface: #1E293B;
    --color-surface-hover: #334155;
    --color-border: #334155;
    --color-text: #F8FAFC;
    --color-text-secondary: #CBD5E1;
    --color-text-light: #64748B;
    --color-primary-lighter: hsl(var(--primary-h), var(--primary-s), 25%);
    --color-primary-bg: hsl(var(--primary-h), var(--primary-s), 15%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* --- 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;
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

/* --- Focus States (a11y) --- */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

/* Clamp functions for responsive typography */
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: 1.125rem; }

p {
  margin-bottom: var(--space-md);
  color: var(--color-text-secondary);
}

p:last-child {
  margin-bottom: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Section */
.section {
  padding: var(--space-2xl) 0;
}
