/* ==========================================================================
   THE WATER PROJECT DESIGN SYSTEM 2025 - CORE TOKENS
   ========================================================================== */

/* 
 * Foundation tokens based on colors.md specifications
 * These tokens provide the base layer for all theme implementations
 * and ensure consistency across the design system.
 */

:root {
  /* ========================================
     BRAND FOUNDATION (Immutable)
     ======================================== */
  
  /* Core brand colors - these never change */
  --brand-blue: #2D6484;
  --brand-orange: #D85C27;
  
  /* ========================================
     SPACING SYSTEM
     ======================================== */
  
  /* Consistent spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 40px;
  --space-3xl: 60px;
  --space-4xl: 80px;
  --space-5xl: 96px;
  
  /* Section and container spacing */
  --section-padding-y: 80px;
  --section-padding-y-mobile: 40px; /* Reduced from 60px */
  --container-padding-x: 40px;
  --container-padding-x-mobile: 12px; /* Tighter mobile padding */
  --container-max-width: 1200px;
  
  /* ========================================
     TYPOGRAPHY SYSTEM
     ======================================== */
  
  /* Font weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Font sizes - responsive clamp values */
  --font-size-xs: clamp(12px, 1vw, 13px);
  --font-size-sm: clamp(14px, 1.2vw, 15px);
  --font-size-base: clamp(16px, 1.4vw, 17px);
  --font-size-lg: clamp(18px, 1.6vw, 20px);
  --font-size-xl: clamp(20px, 2vw, 24px);
  --font-size-2xl: clamp(24px, 2.5vw, 28px);
  --font-size-3xl: clamp(28px, 3vw, 36px);
  --font-size-4xl: clamp(36px, 4vw, 48px);
  
  /* Line heights */
  --line-height-tight: 1.2;
  --line-height-snug: 1.3;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;
  --line-height-loose: 1.7;
  
  /* ========================================
     BORDER RADIUS SYSTEM
     ======================================== */
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* ========================================
     SHADOW SYSTEM
     ======================================== */
  
  /* Elevation shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);
  
  /* Colored shadows for interactive elements */
  --shadow-brand: 0 4px 12px rgba(45, 100, 132, 0.25);
  --shadow-orange: 0 4px 12px rgba(216, 92, 39, 0.25);
  --shadow-success: 0 4px 12px rgba(34, 197, 94, 0.25);
  
  /* ========================================
     ANIMATION SYSTEM
     ======================================== */
  
  /* Timing functions */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Duration */
  --duration-fast: 0.15s;
  --duration-normal: 0.3s;
  --duration-slow: 0.4s;
  --duration-slower: 0.6s;
  
  /* ========================================
     LAYOUT BREAKPOINTS
     ======================================== */
  
  /* Breakpoint values for reference (used in @media queries) */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
  
  /* ========================================
     UNIVERSAL GRADIENT SYSTEM
     ======================================== */
  
  /* Solid color gradients for depth without complexity */
  /* These are theme-independent and can be used across all themes */
  
  /* Primary brand gradients */
  --gradient-blue: linear-gradient(135deg, #2D6484 0%, #1e4a5f 100%);
  --gradient-blue-deep: linear-gradient(135deg, #2D6484 0%, #1a4056 100%);
  --gradient-green: linear-gradient(135deg, #2F855A 0%, #216e40 100%);
  --gradient-green-deep: linear-gradient(135deg, #2F855A 0%, #1b5e3f 100%);
  --gradient-orange: linear-gradient(135deg, #D85C27 0%, #c04d1f 100%);
  --gradient-orange-deep: linear-gradient(135deg, #D85C27 0%, #b53e1a 100%);
  
  /* Earth tone gradients */
  --gradient-brown: linear-gradient(135deg, #8B4513 0%, #654321 100%);
  --gradient-sand: linear-gradient(135deg, #E9D8A6 0%, #d4c38e 100%);
  --gradient-warm: linear-gradient(135deg, #E9D8A6 0%, #DCC896 100%);
  
  /* Special purpose gradients */
  --gradient-donate: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  --gradient-success: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  --gradient-info: linear-gradient(135deg, #06B6D4 0%, #0891B2 100%);
  --gradient-warning: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  
  /* Overlay gradients with transparency */
  --gradient-overlay-dark: linear-gradient(135deg, rgba(41, 37, 36, 0.85) 0%, rgba(41, 37, 36, 0.95) 100%);
  --gradient-overlay-light: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.95) 100%);
  --gradient-overlay-brand: linear-gradient(135deg, rgba(45, 100, 132, 0.85) 0%, rgba(45, 100, 132, 0.95) 100%);
  
  /* ========================================
     Z-INDEX SYSTEM
     ======================================== */
  
  /* Layering system for consistent stacking */
  --z-negative: -1;
  --z-base: 0;
  --z-raised: 10;
  --z-floating: 100;
  --z-modal: 1000;
  --z-notification: 1100;
  --z-tooltip: 1200;
  --z-maximum: 9999;
}

/* ========================================
   THEME TOKENS (Default: Ocean Slate)
   ======================================== */

:root {
  /* Default theme inherits Ocean Slate palette */
  --primary: var(--brand-blue);
  --primary-hover: #1a4056;
  --primary-light: #f0f6fa;
  
  --text-primary: #0F172A;      /* Ink - darkest text */
  --text-secondary: #1F2937;    /* Slate - secondary text */
  --text-muted: #6B7280;        /* Lighter text for meta info */
  
  --background: #FFFFFF;        /* Page background */
  --surface: #F8FAFC;          /* Card/section backgrounds */
  --border: #E2E8F0;           /* Borders and dividers */
  --border-strong: #CBD5E1;    /* Emphasized borders */
  
  /* Accent colors for Ocean Slate theme */
  --accent-teal: #0EA5A9;      /* Water science, secondary actions */
  --accent-indigo: #4338CA;    /* Depth, headers, navigation */
  
  /* Feedback colors (consistent across themes) */
  --success: #16A34A;
  --success-light: #DCFCE7;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --error: #DC2626;
  --error-light: #FEE2E2;
  --info: var(--accent-teal);
  --info-light: #CFFAFE;
}

/* ========================================
   SEMANTIC COLOR TOKENS
   ======================================== */

:root {
  /* Button color mappings */
  --btn-primary-bg: var(--primary);
  --btn-primary-color: #FFFFFF;
  --btn-primary-hover-bg: var(--primary-hover);
  --btn-primary-border: var(--primary);
  
  --btn-donate-bg: var(--brand-orange);
  --btn-donate-color: #FFFFFF;
  --btn-donate-hover-bg: #c04d1f;
  --btn-donate-border: var(--brand-orange);
  
  --btn-secondary-bg: transparent;
  --btn-secondary-color: var(--primary);
  --btn-secondary-hover-bg: var(--primary);
  --btn-secondary-hover-color: #FFFFFF;
  --btn-secondary-border: var(--primary);
  
  /* Card color mappings */
  --card-bg: var(--surface);
  --card-border: var(--border);
  --card-shadow: var(--shadow-sm);
  --card-hover-shadow: var(--shadow-lg);
  
  /* Text color mappings */
  --heading-color: var(--text-primary);
  --body-color: var(--text-secondary);
  --muted-color: var(--text-muted);
  --link-color: var(--primary);
  --link-hover-color: var(--primary-hover);
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Apply containment to major layout sections */
.design-system-section {
  contain: layout style paint;
}

/* Optimize transforms for better performance */
.design-system-interactive {
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0.01ms;
    --duration-normal: 0.01ms;
    --duration-slow: 0.01ms;
    --duration-slower: 0.01ms;
  }
  
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
