/* ==========================================================================
   JuanDavid.dev — Premium Design System
   Inspired by Vercel, Linear, Raycast & GitHub
   ========================================================================== */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* --- Root Design Tokens (Dark Mode Default) --- */
:root {
  /* Core Colors */
  --bg-primary: #060910;
  --bg-secondary: #0c1019;
  --bg-tertiary: #121828;
  --bg-elevated: #181f33;
  --bg-card: rgba(14, 20, 35, 0.7);
  --bg-card-hover: rgba(22, 32, 56, 0.9);
  --bg-glass: rgba(10, 15, 28, 0.8);
  --bg-glass-light: rgba(20, 28, 50, 0.6);
  --bg-overlay: rgba(4, 6, 12, 0.85);

  /* Text Colors */
  --text-primary: #f0f2f7;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #060910;

  /* Accent Colors */
  --accent-cyan: #38bdf8;
  --accent-blue: #60a5fa;
  --accent-indigo: #6366f1;
  --accent-purple: #a78bfa;
  --accent-violet: #c084fc;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;
  --accent-orange: #fb923c;

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #38bdf8 0%, #6366f1 40%, #a78bfa 70%, #c084fc 100%);
  --gradient-brand-reverse: linear-gradient(135deg, #c084fc 0%, #a78bfa 30%, #6366f1 60%, #38bdf8 100%);
  --gradient-hero: linear-gradient(180deg, rgba(6, 9, 16, 0) 0%, rgba(6, 9, 16, 0.8) 100%);
  --gradient-aurora: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(99, 102, 241, 0.12) 50%, rgba(192, 132, 252, 0.08) 100%);
  --gradient-glow: radial-gradient(ellipse at 50% 0%, rgba(56, 189, 248, 0.2) 0%, rgba(99, 102, 241, 0.1) 40%, transparent 70%);
  --gradient-card: linear-gradient(145deg, rgba(14, 20, 35, 0.8) 0%, rgba(22, 32, 56, 0.4) 100%);
  --gradient-border: linear-gradient(135deg, rgba(56, 189, 248, 0.4), rgba(99, 102, 241, 0.4), rgba(192, 132, 252, 0.4));
  --gradient-footer: linear-gradient(180deg, transparent 0%, rgba(56, 189, 248, 0.03) 50%, rgba(6, 9, 16, 1) 100%);

  /* Borders & Shadows */
  --border-color: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-hover: rgba(56, 189, 248, 0.35);
  --border-accent: rgba(99, 102, 241, 0.3);
  --border-glow: rgba(167, 139, 250, 0.25);

  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 30px 70px rgba(0, 0, 0, 0.6);
  --shadow-glow-cyan: 0 0 30px rgba(56, 189, 248, 0.2);
  --shadow-glow-indigo: 0 0 30px rgba(99, 102, 241, 0.2);
  --shadow-glow-purple: 0 0 30px rgba(167, 139, 250, 0.15);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Font Sizes */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fs-4xl: 3rem;
  --fs-5xl: 3.75rem;

  /* Spacing */
  --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;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 800ms;

  --transition-fast: var(--duration-fast) var(--ease-in-out);
  --transition-normal: var(--duration-normal) var(--ease-out);
  --transition-slow: var(--duration-slow) var(--ease-out);

  /* Layout */
  --max-width: 1200px;
  --max-width-lg: 1400px;
  --header-height: 72px;
  --section-padding: 6rem 0;

  /* Z-index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 1100;
  --z-cursor: 9999;
}

/* --- Light Theme Overrides --- */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-light: rgba(248, 250, 252, 0.9);
  --bg-overlay: rgba(241, 245, 249, 0.9);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f8fafc;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --border-hover: rgba(56, 189, 248, 0.5);

  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.1);
  --shadow-glow-cyan: 0 0 30px rgba(56, 189, 248, 0.12);
  --shadow-glow-indigo: 0 0 30px rgba(99, 102, 241, 0.12);

  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(241, 245, 249, 0.6) 100%);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-indigo);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

/* --- Focus Styles (WCAG AA) --- */
:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --- Selection --- */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

h1 { font-size: clamp(2.5rem, 6vw, var(--fs-5xl)); font-weight: 800; }
h2 { font-size: clamp(1.875rem, 4vw, var(--fs-3xl)); }
h3 { font-size: clamp(1.25rem, 2.5vw, var(--fs-xl)); }
h4 { font-size: var(--fs-lg); }

p {
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  font-size: var(--fs-base);
  line-height: 1.8;
}

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

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

code, pre {
  font-family: var(--font-mono);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

/* --- Utility Classes --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-lg {
  max-width: var(--max-width-lg);
}

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

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

/* --- Section Headers --- */
.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-16) auto;
}

.section-header .section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-full);
}

.section-header h2 {
  margin-bottom: var(--space-4);
}

.section-header p {
  font-size: var(--fs-md);
  max-width: 600px;
  margin: 0 auto;
}

/* --- Grid System --- */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* --- Section Spacing --- */
.section {
  padding: var(--section-padding);
  position: relative;
}

/* --- Divider --- */
.section-divider {
  width: 80px;
  height: 3px;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  margin: 0 auto;
}
