/* ============================================
 * CSS Design System - Variables & Tokens
 * ============================================ */

:root {
  /* ========== Core Colors ========== */
  
  /* Primary Brand Colors */
  --color-primary: #0366d6;
  --color-primary-dark: #044289;
  --color-primary-light: #4a90e2;
  
  /* Secondary Colors */
  --color-secondary: #2da44e;
  --color-secondary-dark: #22863a;
  --color-secondary-light: #3fb950;
  
  /* Accent Colors */
  --color-accent-purple: #5c5be5;
  --color-accent-purple-dark: #3838b8;
  --color-slack: #4a154b;
  --color-slack-dark: #611f69;
  --color-slack-light: #7a2f7b;
  
  /* Neutral Palette */
  --color-gray-900: #24292e;
  --color-gray-800: #3d4144;
  --color-gray-700: #586069;
  --color-gray-600: #6a737d;
  --color-gray-500: #959da5;
  --color-gray-400: #c6cbd1;
  --color-gray-300: #d1d5da;
  --color-gray-200: #d0d7de;
  --color-gray-100: #f6f8fa;
  --color-white: #ffffff;
  --color-black: #000000;
  
  /* ========== Semantic Colors ========== */
  
  /* Backgrounds */
  --bg-primary: #f4f6f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #fafafa;
  --bg-code: #f6f8fa;
  --bg-hover: #f0f0f0;
  --bg-active: #e6e6e6;
  
  /* Text */
  --text-primary: var(--color-gray-900);
  --text-secondary: var(--color-gray-700);
  --text-muted: var(--color-gray-600);
  --text-link: var(--color-primary);
  --text-link-hover: var(--color-primary-dark);
  --text-inverse: var(--color-white);
  
  /* Borders */
  --border-color: var(--color-gray-200);
  --border-color-dark: var(--color-gray-300);
  --border-color-light: #ebebeb;
  
  /* ========== Typography ========== */
  
  /* Font Families */
  --font-sans: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
  
  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-snug: 1.45;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;
  
  /* ========== Spacing ========== */
  
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  
  /* ========== Borders ========== */
  
  /* Border Width */
  --border-width: 1px;
  --border-width-2: 2px;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 18px;
  --radius-full: 9999px;
  
  /* ========== Shadows ========== */
  
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(27, 31, 35, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
  
  /* ========== Z-Index Scale ========== */
  
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  
  /* ========== Transitions ========== */
  
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-transform: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* ========== Layout ========== */
  
  --container-max-width: 850px;
  --sidebar-width: 250px;
  --side-nav-width: 260px;
  --header-height: 60px;
  
  /* ========== Breakpoints (for JS reference) ========== */
  
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
  
  /* ========== Legacy Compatibility ========== */
  /* These maintain backward compatibility with existing code */
  
  --c-blue-600: var(--color-primary);
  --c-blue-700: var(--color-primary-dark);
  --c-green-600: var(--color-secondary);
  --c-gray-900: var(--color-gray-900);
  --c-gray-700: var(--color-gray-700);
  --c-gray-200: var(--color-gray-200);
  --c-white: var(--color-white);
  --c-purple-600: var(--color-accent-purple);
  --c-purple-800: var(--color-accent-purple-dark);
  --font-mono: var(--font-mono);
  --shadow-sm: var(--shadow-sm);
}

/* ============================================
 * Dark Theme Variables
 * ============================================ */

html.theme-dark {
  /* Dark theme backgrounds */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1a1d23;
  --bg-code: #161b22;
  --bg-hover: #1c2128;
  --bg-active: #282c34;
  
  /* Dark theme text */
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-link: #58a6ff;
  --text-link-hover: #79c0ff;
  
  /* Dark theme borders */
  --border-color: #30363d;
  --border-color-dark: #484f58;
  --border-color-light: #21262d;
  
  /* Dark theme specific colors */
  --color-sidebar-bg: #231c31;
  --color-card-bg: var(--bg-secondary);
}

/* ============================================
 * Light Theme Variables (explicit)
 * ============================================ */

html.theme-light {
  /* Ensure light theme uses default values */
  --bg-primary: #dbe0e5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #fafafa;
  
  /* Light theme specific */
  --color-sidebar-bg: #f0f0f0;
  --color-card-bg: #fafafa;
}