/* ============================================
   DESIGN SYSTEM - Abstraction Cheatsheet
   Premium dark-mode design with glassmorphism
   ============================================ */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Color Palette - Dark Theme (Default) */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-elevated: #30363d;
  
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-link: #58a6ff;
  
  /* Accent Colors */
  --accent-blue: #58a6ff;
  --accent-purple: #a371f7;
  --accent-green: #3fb950;
  --accent-orange: #f0883e;
  --accent-red: #f85149;
  --accent-cyan: #39d4e0;
  
  /* Accent Glows */
  --glow-blue: rgba(88, 166, 255, 0.15);
  --glow-purple: rgba(163, 113, 247, 0.15);
  --glow-green: rgba(63, 185, 80, 0.15);
  
  /* Code Syntax Colors */
  --code-bg: #161b22;
  --code-string: #a5d6ff;
  --code-keyword: #ff7b72;
  --code-function: #d2a8ff;
  --code-number: #79c0ff;
  --code-comment: #8b949e;
  --code-operator: #ff7b72;
  --code-variable: #ffa657;
  
  /* Visualization Colors */
  --viz-node: #238636;
  --viz-node-active: #3fb950;
  --viz-edge: #58a6ff;
  --viz-highlight: #f0883e;
  --viz-token: #a371f7;
  
  /* Borders & Shadows */
  --border-default: #30363d;
  --border-muted: #21262d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--glow-blue);
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  
  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal: 400;
  --z-tooltip: 500;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  
  --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;
  
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;
  
  /* Layout */
  --sidebar-width: 280px;
  --content-max-width: 900px;
  --header-height: 64px;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eaeef2;
  --bg-elevated: #ffffff;
  
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8c959f;
  --text-link: #0969da;
  
  --code-bg: #f6f8fa;
  --border-default: #d0d7de;
  --border-muted: #d8dee4;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 {
  font-size: var(--text-4xl);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: var(--text-2xl);
  margin-top: var(--space-3xl);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-default);
}

h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  color: var(--accent-blue);
}

h4 {
  font-size: var(--text-lg);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

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

a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 600;
  color: var(--text-primary);
}

em {
  font-style: italic;
}

blockquote {
  border-left: 4px solid var(--accent-blue);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--glow-blue);
  padding: var(--space-md);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-default) 20%,
    var(--border-default) 80%,
    transparent
  );
  margin: var(--space-3xl) 0;
}

/* Lists */
ul, ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-xl);
}

li {
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}

li::marker {
  color: var(--accent-blue);
}

/* Code (inline) */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
}

/* Code (block) - handled in components.css */
pre {
  font-family: var(--font-mono);
}

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

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-blue); }
.text-success { color: var(--accent-green); }
.text-warning { color: var(--accent-orange); }
.text-error { color: var(--accent-red); }

/* Background Colors */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Spacing Utilities */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* Visibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   SELECTION STYLES
   ============================================ */
::selection {
  background: var(--accent-blue);
  color: white;
}

/* ============================================
   SCROLLBAR STYLES
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

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

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) var(--bg-secondary);
}

/* ============================================
   FOCUS STYLES
   ============================================ */
:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
