/* ==========================================
   Skunk Design System - CSS Custom Properties
   ========================================== */

/* ===========================================
   CUSTOMIZABLE BRAND COLORS
   Override these in your app's CSS to change the accent color:
   
   :root {
     --brand-hue: 220;        // Blue
     --brand-saturation: 90%;
     --brand-lightness: 50%;
   }
   =========================================== */

:root {
  /* Brand color configuration (HSL values for easy customization) */
  --brand-hue: 263;           /* Purple hue (0-360) */
  --brand-saturation: 84%;    /* Color intensity */
  --brand-lightness: 58%;     /* Base lightness for dark mode */
  
  /* Derived brand colors - these auto-calculate from the brand HSL values */
  --brand-primary: hsl(var(--brand-hue), var(--brand-saturation), var(--brand-lightness));
  --brand-primary-light: hsl(var(--brand-hue), var(--brand-saturation), calc(var(--brand-lightness) + 15%));
  --brand-primary-dark: hsl(var(--brand-hue), var(--brand-saturation), calc(var(--brand-lightness) - 10%));
  --brand-primary-subtle: hsl(var(--brand-hue), calc(var(--brand-saturation) * 0.3), 20%);
  
  /* Brand RGB for rgba() usage (shadows, overlays) */
  --brand-rgb: 124, 58, 237;  /* Update this when changing brand color */
}

/* Dark Theme (Default) */
:root,
[data-theme="dark"] {
  --color-scheme: dark;
  
  /* Colors - Dark Theme */
  --color-bg-primary: #080808;
  --color-bg-secondary: #0e0e0e;
  --color-bg-tertiary: #141414;
  --color-bg-hover: #1a1a1a;
  --color-bg-card: #111111;
  
  --color-border: #1e1e1e;
  --color-border-light: #2a2a2a;
  
  --color-text-primary: #e8e8e8;
  --color-text-secondary: #a0a0a0;
  --color-text-muted: #666666;
  
  /* Accent colors - derived from brand */
  --color-accent-primary: var(--brand-primary);
  --color-accent-secondary: var(--brand-primary-light);
  --color-accent-hover: var(--brand-primary-light);
  
  /* Semantic colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* Brand gradient */
  --gradient-brand: linear-gradient(135deg, #0e0e0e 0%, var(--brand-primary-subtle) 50%, #0e0e0e 100%);
  
  /* Legacy aliases */
  --color-skunk-purple: var(--brand-primary);
  --color-skunk-white: #ffffff;
  --gradient-skunk-stripe: var(--gradient-brand);
  
  /* Shadows - Dark */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-glow-strong: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Light Theme */
[data-theme="light"] {
  --color-scheme: light;
  
  /* Adjust brand colors for light mode */
  --brand-primary: hsl(var(--brand-hue), var(--brand-saturation), calc(var(--brand-lightness) - 5%));
  --brand-primary-light: hsl(var(--brand-hue), var(--brand-saturation), calc(var(--brand-lightness) + 5%));
  --brand-primary-dark: hsl(var(--brand-hue), var(--brand-saturation), calc(var(--brand-lightness) - 15%));
  --brand-primary-subtle: hsl(var(--brand-hue), calc(var(--brand-saturation) * 0.5), 95%);
  
  /* Colors - Light Theme */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f8f9fa;
  --color-bg-tertiary: #f1f3f4;
  --color-bg-hover: #e8eaed;
  --color-bg-card: #ffffff;
  
  --color-border: #e0e0e0;
  --color-border-light: #eeeeee;
  
  --color-text-primary: #1a1a1a;
  --color-text-secondary: #5f6368;
  --color-text-muted: #9aa0a6;
  
  /* Accent colors - derived from brand */
  --color-accent-primary: var(--brand-primary);
  --color-accent-secondary: var(--brand-primary-dark);
  --color-accent-hover: var(--brand-primary-dark);
  
  /* Semantic colors - slightly adjusted for light bg */
  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-info: #2563eb;
  
  /* Brand gradient - Light */
  --gradient-brand: linear-gradient(135deg, #f8f9fa 0%, var(--brand-primary-subtle) 50%, #f8f9fa 100%);
  --gradient-skunk-stripe: var(--gradient-brand);
  
  /* Shadows - Light */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-glow-strong: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* System preference support */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-scheme: light;
    
    /* Adjust brand colors for light mode */
    --brand-primary: hsl(var(--brand-hue), var(--brand-saturation), calc(var(--brand-lightness) - 5%));
    --brand-primary-light: hsl(var(--brand-hue), var(--brand-saturation), calc(var(--brand-lightness) + 5%));
    --brand-primary-dark: hsl(var(--brand-hue), var(--brand-saturation), calc(var(--brand-lightness) - 15%));
    --brand-primary-subtle: hsl(var(--brand-hue), calc(var(--brand-saturation) * 0.5), 95%);
    
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8f9fa;
    --color-bg-tertiary: #f1f3f4;
    --color-bg-hover: #e8eaed;
    --color-bg-card: #ffffff;
    
    --color-border: #e0e0e0;
    --color-border-light: #eeeeee;
    
    --color-text-primary: #1a1a1a;
    --color-text-secondary: #5f6368;
    --color-text-muted: #9aa0a6;
    
    --color-accent-primary: var(--brand-primary);
    --color-accent-secondary: var(--brand-primary-dark);
    --color-accent-hover: var(--brand-primary-dark);
    
    --color-success: #059669;
    --color-warning: #d97706;
    --color-error: #dc2626;
    --color-info: #2563eb;
    
    --gradient-brand: linear-gradient(135deg, #f8f9fa 0%, var(--brand-primary-subtle) 50%, #f8f9fa 100%);
    --gradient-skunk-stripe: var(--gradient-brand);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-glow-strong: 0 2px 6px rgba(0, 0, 0, 0.1);
  }
}

/* Shared non-color tokens (same in both themes) */
:root {
  /* Spacing Scale */
  --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 */
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Typography */
  --font-family-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', monospace;
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */
  --font-size-5xl: 3rem;     /* 48px */
  --font-size-6xl: 4rem;     /* 64px */
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-tooltip: 1100;
  --z-toast: 1200;
  
  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-mono);
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: var(--line-height-normal);
  min-height: 100vh;
  text-transform: lowercase;
}

code,
pre,
kbd,
input,
textarea,
select {
  text-transform: none;
}

button {
  text-transform: inherit;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

::selection {
  background: var(--color-accent-primary);
  color: white;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
}

/* Keyframe animations */
@keyframes wiggle {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-wiggle {
  animation: wiggle 2s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}
