/* CSS Variables - Design System */

:root {
  /* ===== Color System - Light Theme ===== */
  
  /* Primary Colors */
  --color-primary: #2563EB;
  --color-primary-hover: #1D4ED8;
  --color-secondary: #3B82F6;
  --color-accent: #F97316;
  
  /* Background Colors */
  --color-bg-primary: #FFFFFF;
  --color-bg-secondary: #F8FAFC;
  --color-bg-tertiary: #F1F5F9;
  
  /* Text Colors */
  --color-text-primary: #0F172A;
  --color-text-secondary: #475569;
  --color-text-tertiary: #64748B;
  
  /* Border Colors */
  --color-border: #E2E8F0;
  --color-border-hover: #CBD5E1;
  
  /* ===== Shadow System - iOS 27 Soft Colored Shadows ===== */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 12px 40px rgba(0,0,0,0.1), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-glow: 0 0 48px rgba(37, 99, 235, 0.15);
  
  /* ===== Spacing System ===== */
  --spacing-xs: 0.25rem;    /* 4px */
  --spacing-sm: 0.5rem;     /* 8px */
  --spacing-md: 1rem;       /* 16px */
  --spacing-lg: 1.5rem;     /* 24px */
  --spacing-xl: 2rem;       /* 32px */
  --spacing-2xl: 3rem;      /* 48px */
  
  /* ===== Border Radius System - iOS 27 Liquid Glass ===== */
  --radius-sm: 0.5rem;     /* 8px */
  --radius-md: 0.75rem;    /* 12px */
  --radius-lg: 1rem;       /* 16px */
  --radius-xl: 1.25rem;    /* 20px */
  --radius-2xl: 1.5rem;    /* 24px */
  --radius-full: 9999px;

  /* ===== Shadow System - iOS 27 Soft Colored Shadows ===== */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.12);

  /* ===== Glass Effect Variables ===== */
  --glass-bg: color-mix(in srgb, var(--color-bg-primary) 72%, transparent);
  --glass-blur: blur(20px) saturate(200%);
  --glass-border: 1px solid color-mix(in srgb, var(--color-border) 40%, transparent);
  --glass-highlight: inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent);
  
  /* ===== Transition Timing ===== */
  --transition-fast: 150ms;
  --transition-base: 200ms;
  --transition-slow: 300ms;
  --transition-slower: 500ms;
  
  /* ===== Layout Variables ===== */
  --header-height: 3.5rem;
  --sidebar-width: 280px;
  --toc-width: 200px;
  --content-max-width: 800px;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  /* Primary Colors */
  --color-primary: #3B82F6;
  --color-primary-hover: #60A5FA;
  --color-secondary: #4F46E5;
  --color-accent: #FB923C;
  
  /* Background Colors - 避免纯黑，用深蓝灰 */
  --color-bg-primary: #0B1121;
  --color-bg-secondary: #111827;
  --color-bg-tertiary: #1E293B;
  
  /* Text Colors */
  --color-text-primary: #F1F5F9;
  --color-text-secondary: #94A3B8;
  --color-text-tertiary: #64748B;
  
  /* Border Colors */
  --color-border: #1E293B;
  --color-border-hover: #334155;
  
  /* Shadow System - Darker shadows for dark mode */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 48px rgba(59, 130, 246, 0.25);
}

/* ===== Smooth Theme Transitions ===== */
* {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: var(--transition-base);
  transition-timing-function: ease-in-out;
}

/* Exclude transitions for elements that shouldn't animate */
*:where(:not(:active):not(:focus):not(:focus-within)) {
  transition-property: background-color, border-color, color, fill, stroke;
}

/* Respect user's motion preferences */
@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;
  }
}
