/*
PD Triglav Design System
Alpine Elegance - Mountain-inspired web design
*/

:root {
  /* === CORE TYPOGRAPHY (ALWAYS AVAILABLE) === */
  --pd-font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --pd-font-family-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --pd-font-family-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

  /* Font Sizes - Modular Scale (1.250 - Major Third) */
  --pd-text-xs: 0.75rem;    /* 12px */
  --pd-text-sm: 0.875rem;   /* 14px */
  --pd-text-base: 1rem;     /* 16px */
  --pd-text-lg: 1.125rem;   /* 18px */
  --pd-text-xl: 1.25rem;    /* 20px */
  --pd-text-2xl: 1.563rem;  /* 25px */
  --pd-text-3xl: 1.953rem;  /* 31px */
  --pd-text-4xl: 2.441rem;  /* 39px */

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

  /* Line Heights */
  --pd-leading-tight: 1.25;
  --pd-leading-normal: 1.5;
  --pd-leading-relaxed: 1.75;

  /* Spacing Scale */
  --pd-space-1: 0.25rem;   /* 4px */
  --pd-space-2: 0.5rem;    /* 8px */
  --pd-space-3: 0.75rem;   /* 12px */
  --pd-space-4: 1rem;      /* 16px */
  --pd-space-5: 1.25rem;   /* 20px */
  --pd-space-6: 1.5rem;    /* 24px */
  --pd-space-8: 2rem;      /* 32px */
  --pd-space-10: 2.5rem;   /* 40px */
  --pd-space-12: 3rem;     /* 48px */
  --pd-space-16: 4rem;     /* 64px */
  --pd-space-20: 5rem;     /* 80px */

  /* Border Radius */
  --pd-radius-none: 0;
  --pd-radius-sm: 0.25rem;   /* 4px */
  --pd-radius: 0.375rem;     /* 6px */
  --pd-radius-md: 0.5rem;    /* 8px */
  --pd-radius-lg: 0.75rem;   /* 12px */
  --pd-radius-xl: 1rem;      /* 16px */
  --pd-radius-2xl: 1.5rem;   /* 24px */
  --pd-radius-full: 9999px;

  /* Transitions */
  --pd-transition-fast: 150ms ease-out;
  --pd-transition-normal: 200ms ease-out;
  --pd-transition-slow: 300ms ease-out;

  /* Easing curves inspired by natural motion */
  --pd-ease-mountain: cubic-bezier(0.4, 0, 0.2, 1);     /* Like a gentle slope */
  --pd-ease-valley: cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Like flowing water */
  --pd-ease-peak: cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Like reaching a summit */

  /* === LIGHT THEME (DEFAULT) === */
  
  /* Primary - Dark Gray (Professional) */
  --pd-primary: #2B2B2B;        /* Dark charcoal */
  --pd-primary-light: #424242;  /* Medium gray */
  --pd-primary-dark: #1A1A1A;   /* Very dark gray */
  --pd-primary-subtle: #F5F5F5; /* Light gray tint */
  
  /* Secondary - Alpine Stone */
  --pd-secondary: #6c757d;       /* Mountain stone */
  --pd-secondary-light: #adb5bd; /* Light granite */
  --pd-secondary-dark: #495057;  /* Dark slate */
  --pd-secondary-subtle: #f8f9fa; /* Snow white */
  
  /* Triglav Red Accent - Brand Colors */
  --pd-accent-red: #E31E24;      /* Triglav red */
  --pd-accent-red-light: #FF4444; /* Lighter red */
  --pd-accent-red-dark: #B71C1C; /* Darker red */
  --pd-accent-red-subtle: #FFEBEE; /* Light red tint */
  
  /* Other Accents - Sophisticated & Desaturated */
  --pd-accent-orange: #e55a32;   /* Muted sunrise peak */
  --pd-accent-blue: #4191d9;     /* Softer alpine sky */
  --pd-accent-yellow: #e6c547;   /* Warm golden hour */
  
  /* Semantic Colors - Light Theme */
  --pd-success: #48b85c;         /* Mature spring green */
  --pd-warning: #e6c547;         /* Warm caution */
  --pd-danger: #e55a5a;          /* Muted alert red */
  --pd-info: #6bb3e8;            /* Soft ice blue */
  
  /* Surface System - Enhanced Light */
  --pd-surface-primary: #f7f5f1;   /* Warm cream */
  --pd-surface-secondary: #f0ede8; /* Soft stone */
  --pd-surface-tertiary: #ebe7e0;  /* Deeper warm surface */
  --pd-surface-elevated: #ffffff;  /* Pure white for cards */
  
  /* Text Colors - Light Theme */
  --pd-text-primary: #1a1a1b;     /* Almost black */
  --pd-text-secondary: #495057;    /* Dark gray */
  --pd-text-muted: #6c757d;       /* Medium gray */
  --pd-text-inverse: #ffffff;     /* White text */
  
  /* Border & Utility */
  --pd-border-color: #dee2e6;
  --pd-border-color-light: #e9ecef;
  --pd-border-color-dark: #adb5bd;
  
  /* Neutral Palette - Light Theme */
  --pd-white: #ffffff;
  --pd-gray-50: #f8f9fa;
  --pd-gray-100: #f1f3f4;
  --pd-gray-200: #e9ecef;
  --pd-gray-300: #dee2e6;
  --pd-gray-400: #ced4da;
  --pd-gray-500: #adb5bd;
  --pd-gray-600: #6c757d;
  --pd-gray-700: #495057;
  --pd-gray-800: #343a40;
  --pd-gray-900: #212529;
}

html[data-theme="dark"] {
  /* Primary - Adjusted for dark backgrounds */
  --pd-primary: #424242;        /* Medium gray for dark mode */
  --pd-primary-light: #616161;  /* Lighter gray */
  --pd-primary-dark: #212121;   /* Very dark gray */
  --pd-primary-subtle: #1E1E1E;  /* Dark surface */
  
  /* Secondary - Dark theme stone */
  --pd-secondary: #8e9297;       /* Lighter stone */
  --pd-secondary-light: #b1b5bb; /* Light granite */
  --pd-secondary-dark: #4e5255;  /* Very dark slate */
  --pd-secondary-subtle: #3a3b3c; /* Dark surface */
  
  /* Accent - Dark theme appropriate */
  --pd-accent-orange: #ff7849;   /* Brighter sunrise */
  --pd-accent-blue: #58a6ff;     /* Bright alpine sky */
  --pd-accent-yellow: #ffd93d;   /* Bright golden hour */
  
  /* Semantic Colors - Dark Theme */
  --pd-success: #56d364;         /* Bright spring green */
  --pd-warning: #f0ca4c;         /* Bright caution */
  --pd-danger: #f85149;          /* Bright alert red */
  --pd-info: #79c0ff;            /* Bright ice blue */
  
  /* Surface System - Facebook Dark Style */
  --pd-surface-primary: #18191a;   /* Very dark background */
  --pd-surface-secondary: #242526; /* Dark surface */
  --pd-surface-tertiary: #3a3b3c;  /* Medium dark surface */
  --pd-surface-elevated: #242526;  /* Card background */
  
  /* Text Colors - Dark Theme */
  --pd-text-primary: #e4e6ea;     /* Warm white */
  --pd-text-secondary: #b0b3b8;   /* Light gray */
  --pd-text-muted: #8a8d91;       /* Medium gray */
  --pd-text-inverse: #18191a;     /* Dark text on light */
  
  /* Border & Utility - Dark Theme */
  --pd-border-color: #3e4042;
  --pd-border-color-light: #2f3031;
  --pd-border-color-dark: #5e6163;
  
  /* Neutral Palette - Dark Theme */
  --pd-white: #e4e6ea;
  --pd-gray-50: #3a3b3c;
  --pd-gray-100: #2f3031;
  --pd-gray-200: #3e4042;
  --pd-gray-300: #5e6163;
  --pd-gray-400: #8a8d91;
  --pd-gray-500: #b0b3b8;
  --pd-gray-600: #b0b3b8;
  --pd-gray-700: #e4e6ea;
  --pd-gray-800: #f0f2f5;
  --pd-gray-900: #ffffff;
}
  
  /* === LAYOUT === */
  --pd-container-sm: 640px;
  --pd-container-md: 768px;
  --pd-container-lg: 1024px;
  --pd-container-xl: 1280px;
  --pd-container-2xl: 1536px;
  
  /* === ELEVATION & DEPTH === */
  --pd-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --pd-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --pd-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --pd-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --pd-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Mountain-inspired elevation */
  --pd-shadow-mountain: 0 8px 32px rgba(43, 43, 43, 0.12), 0 2px 8px rgba(43, 43, 43, 0.08);
  --pd-shadow-valley: inset 0 2px 4px rgba(43, 43, 43, 0.06);
  
  /* === BORDERS === */
  --pd-border-width: 1px;
  --pd-border-width-2: 2px;
  --pd-border-width-4: 4px;
  
  --pd-border-color: var(--pd-gray-200);
  --pd-border-color-light: var(--pd-gray-100);
  --pd-border-color-dark: var(--pd-gray-300);
  
  /* === BORDER RADIUS === */
  --pd-radius-none: 0;
  --pd-radius-sm: 0.25rem;   /* 4px */
  --pd-radius: 0.375rem;     /* 6px */
  --pd-radius-md: 0.5rem;    /* 8px */
  --pd-radius-lg: 0.75rem;   /* 12px */
  --pd-radius-xl: 1rem;      /* 16px */
  --pd-radius-2xl: 1.5rem;   /* 24px */
  --pd-radius-full: 9999px;
  
  /* === TRANSITIONS === */
  --pd-transition-fast: 150ms ease-out;
  --pd-transition-normal: 200ms ease-out;
  --pd-transition-slow: 300ms ease-out;
  
  /* Easing curves inspired by natural motion */
  --pd-ease-mountain: cubic-bezier(0.4, 0, 0.2, 1);     /* Like a gentle slope */
  --pd-ease-valley: cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Like flowing water */
  --pd-ease-peak: cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Like reaching a summit */

  /* === GRADIENTS === */
  /* Subtle background gradients for depth */
  --pd-gradient-surface: linear-gradient(135deg, var(--pd-surface-primary) 0%, var(--pd-surface-secondary) 100%);
  --pd-gradient-mist: linear-gradient(180deg, var(--pd-surface-primary) 0%, var(--pd-surface-tertiary) 100%);
  --pd-gradient-dawn: linear-gradient(135deg, var(--pd-surface-secondary) 0%, var(--pd-primary-subtle) 100%);
  
  /* Header and hero gradients */
  --pd-gradient-mountain: linear-gradient(135deg, var(--pd-primary) 0%, var(--pd-primary-dark) 100%);
  --pd-gradient-sky: linear-gradient(180deg, var(--pd-accent-blue) 0%, var(--pd-primary) 100%);
  
  /* === ENHANCED SHADOWS === */
  /* Layered shadows for sophisticated elevation */
  --pd-shadow-xs: 0 1px 2px rgba(43, 43, 43, 0.04);
  --pd-shadow-sm: 0 1px 3px rgba(43, 43, 43, 0.06), 0 1px 2px rgba(43, 43, 43, 0.04);
  --pd-shadow: 0 4px 6px rgba(43, 43, 43, 0.07), 0 2px 4px rgba(43, 43, 43, 0.06);
  --pd-shadow-md: 0 10px 15px rgba(43, 43, 43, 0.08), 0 4px 6px rgba(43, 43, 43, 0.06);
  --pd-shadow-lg: 0 20px 25px rgba(43, 43, 43, 0.1), 0 10px 10px rgba(43, 43, 43, 0.06);
  --pd-shadow-xl: 0 25px 50px rgba(43, 43, 43, 0.12), 0 12px 20px rgba(43, 43, 43, 0.08);
  --pd-shadow-mountain: 0 35px 60px rgba(43, 43, 43, 0.15), 0 15px 25px rgba(43, 43, 43, 0.1);
  
  /* === Z-INDEX SCALE === */
  --pd-z-dropdown: 1000;
  --pd-z-sticky: 1020;
  --pd-z-fixed: 1030;
  --pd-z-modal-backdrop: 1040;
  --pd-z-modal: 1050;
  --pd-z-popover: 1060;
  --pd-z-tooltip: 1070;
  --pd-z-toast: 1080;
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
  :root {
    --pd-primary-subtle: #1a3d1f;
    --pd-secondary-subtle: #212529;
    --pd-white: #121212;
    --pd-gray-50: #1f1f1f;
    --pd-gray-100: #2d2d2d;
    --pd-gray-900: #f8f9fa;
  }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  :root {
    --pd-transition-fast: 0ms;
    --pd-transition-normal: 0ms;
    --pd-transition-slow: 0ms;
  }
  
  *,
  ::before,
  ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* === UTILITY CLASSES === */

/* Spacing Utilities */
.pd-space-y-1 > * + * { margin-top: var(--pd-space-1); }
.pd-space-y-2 > * + * { margin-top: var(--pd-space-2); }
.pd-space-y-3 > * + * { margin-top: var(--pd-space-3); }
.pd-space-y-4 > * + * { margin-top: var(--pd-space-4); }
.pd-space-y-6 > * + * { margin-top: var(--pd-space-6); }
.pd-space-y-8 > * + * { margin-top: var(--pd-space-8); }

/* Typography Utilities */
.pd-text-primary { color: var(--pd-primary); }
.pd-text-secondary { color: var(--pd-secondary); }
.pd-text-muted { color: var(--pd-gray-600); }
.pd-text-subtle { color: var(--pd-gray-500); }

.pd-font-heading { 
  font-family: var(--pd-font-family-heading);
  font-weight: var(--pd-font-semibold);
  line-height: var(--pd-leading-tight);
}

/* Interactive States */
.pd-interactive {
  transition: all var(--pd-transition-normal) var(--pd-ease-mountain);
  cursor: pointer;
}

.pd-interactive:hover {
  transform: translateY(-1px);
}

.pd-interactive:active {
  transform: translateY(0);
}

/* Focus States - Accessible */
.pd-focus-ring:focus {
  outline: 2px solid var(--pd-accent-blue);
  outline-offset: 2px;
}

/* Mountain-inspired decorative elements */
.pd-mountain-border {
  border-bottom: 3px solid transparent;
  background-image: linear-gradient(90deg, var(--pd-primary) 0%, var(--pd-primary-light) 50%, var(--pd-primary) 100%);
  background-size: 100% 3px;
  background-repeat: no-repeat;
  background-position: bottom;
}

.pd-elevation-1 { box-shadow: var(--pd-shadow-sm); }
.pd-elevation-2 { box-shadow: var(--pd-shadow); }
.pd-elevation-3 { box-shadow: var(--pd-shadow-md); }
.pd-elevation-4 { box-shadow: var(--pd-shadow-lg); }
.pd-elevation-mountain { box-shadow: var(--pd-shadow-mountain); }