/* ==========================================================================
   DESIGN TOKENS — Variables CSS (Custom Properties)
   Sistema de colores dual (dark/light), tipografía, espaciados, breakpoints
   ========================================================================== */

:root {
  /* ── Tipografía ──────────────────────────────────────────────── */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.75rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);
  --text-lg: clamp(1.05rem, 0.95rem + 0.5vw, 1.125rem);
  --text-xl: clamp(1.15rem, 1rem + 0.75vw, 1.25rem);
  --text-2xl: clamp(1.4rem, 1.1rem + 1.5vw, 1.5rem);
  --text-3xl: clamp(1.7rem, 1.2rem + 2.5vw, 1.875rem);
  --text-4xl: clamp(2rem, 1.3rem + 3.5vw, 2.25rem);
  --text-5xl: clamp(2.5rem, 1.5rem + 5vw, 3rem);
  --text-6xl: clamp(3rem, 1.8rem + 6vw, 3.75rem);

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;

  /* ── Espaciados ──────────────────────────────────────────────── */
  --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;

  /* ── Layout ──────────────────────────────────────────────────── */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --container-2xl: 1400px;
  --nav-height: 4rem;

  /* ── Bordes & Radios ─────────────────────────────────────────── */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* ── Sombras (se redefinen en cada tema) ─────────────────────── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* ── Transiciones ────────────────────────────────────────────── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;

  /* ── Z-index scale ───────────────────────────────────────────── */
  --z-behind: -1;
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

/* ==========================================================================
   DARK MODE (por defecto)
   ========================================================================== */

[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a28;
  --bg-elevated: #1e1e2e;

  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-inverse: #18181b;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-subtle: rgba(99, 102, 241, 0.15);
  --accent-secondary: #22d3ee;
  --accent-secondary-subtle: rgba(34, 211, 238, 0.15);

  --gradient-hero: linear-gradient(135deg, #6366f1, #22d3ee);
  --gradient-text: linear-gradient(135deg, #818cf8, #22d3ee);
  --gradient-card: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));

  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.15);

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

  --nav-bg: rgba(10, 10, 15, 0.85);
  --nav-blur: blur(12px);

  --code-bg: #1e1e2e;
  --tag-bg: rgba(99, 102, 241, 0.12);
  --tag-text: #a5b4fc;

  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;
}

/* ==========================================================================
   LIGHT MODE
   ========================================================================== */

[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f4f4f5;
  --bg-elevated: #ffffff;

  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-tertiary: #a1a1aa;
  --text-inverse: #fafafa;

  --accent: #4f46e5;
  --accent-hover: #6366f1;
  --accent-subtle: rgba(79, 70, 229, 0.08);
  --accent-secondary: #0891b2;
  --accent-secondary-subtle: rgba(8, 145, 178, 0.08);

  --gradient-hero: linear-gradient(135deg, #4f46e5, #0891b2);
  --gradient-text: linear-gradient(135deg, #4f46e5, #0891b2);
  --gradient-card: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));

  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.15);

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 40px rgba(79, 70, 229, 0.1);

  --nav-bg: rgba(250, 250, 250, 0.85);
  --nav-blur: blur(12px);

  --code-bg: #f4f4f5;
  --tag-bg: rgba(79, 70, 229, 0.08);
  --tag-text: #4f46e5;

  --success: #059669;
  --error: #dc2626;
  --warning: #d97706;
}
