/* ==========================================================================
   Base CSS - Reset, Tokens y Tipografía Editorial Contemporánea
   Librería Central — Filosofía Emil Kowalski & Anti-Slop (WCAG AA)
   ========================================================================== */

:root {
  /* Tipografía Editorial */
  --font-family-serif: "Newsreader", "Charter", "Iowan Old Style", "Palatino", serif;
  --font-family-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Modo Claro: Papel de Archivo & Tinta Editorial */
  --bg-primary: #FBF9F5;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F5F2EB;
  --bg-surface-hover: #EFEBE4;
  --bg-surface-elevated: #FFFFFF;
  
  --text-primary: #18181B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  
  /* Acentos de identidad editorial (Terracota cálido de imprenta) */
  --accent-primary: #9A3412;
  --accent-primary-hover: #7C2D12;
  --accent-soft: rgba(154, 52, 18, 0.1);
  --accent-text: #7C2D12;
  
  /* Estados del sistema */
  --color-success: #15803D;
  --color-success-bg: #DCFCE7;
  --color-error: #B91C1C;
  --color-error-bg: #FEE2E2;
  --color-warning: #B45309;
  --color-warning-bg: #FEF3C7;

  --color-badge-bg: #EFEBE4;
  --color-badge-text: #44403C;
  
  /* Bordes y sombras artesanales */
  --border-color: #E5E1D8;
  --border-subtle: #EDE9E1;
  --border-focus: #9A3412;
  
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(24, 24, 27, 0.06), 0 2px 4px -2px rgba(24, 24, 27, 0.03);
  --shadow-lg: 0 12px 32px -4px rgba(24, 24, 27, 0.08), 0 4px 12px -2px rgba(24, 24, 27, 0.04);
  --shadow-modal: 0 24px 48px -12px rgba(24, 24, 27, 0.18), 0 0 0 1px rgba(24, 24, 27, 0.06);
  
  /* Radios de borde */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  
  /* Física y tiempos de interacción (Emil Kowalski) */
  --ease-snappy: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.2, 0, 0, 1);
  --transition-fast: 120ms var(--ease-snappy);
  --transition-normal: 200ms ease;
  --line-height-base: 1.55;
  --line-height-tight: 1.2;
}

/* --------------------------------------------------------------------------
   Paleta Modo Oscuro (data-theme="dark") - Obsidiana Neutra & Ámbar Literario
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-primary: #0C0E12;
  --bg-surface: #14171E;
  --bg-surface-alt: #1A1E26;
  --bg-surface-hover: #1F242E;
  --bg-surface-elevated: #181C24;
  
  --text-primary: #F4F4F5;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  
  /* Acento Ámbar de Lectura */
  --accent-primary: #F59E0B;
  --accent-primary-hover: #D97706;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --accent-text: #FBBF24;
  
  /* Estados del sistema en modo oscuro */
  --color-success: #34D399;
  --color-success-bg: rgba(52, 211, 153, 0.14);
  --color-error: #F87171;
  --color-error-bg: rgba(248, 113, 113, 0.14);
  --color-warning: #FBBF24;
  --color-warning-bg: rgba(251, 191, 36, 0.14);

  --color-badge-bg: #1E232D;
  --color-badge-text: #CBD5E1;
  
  /* Bordes y sombras oscuras */
  --border-color: #252A34;
  --border-subtle: #1C2028;
  --border-focus: #F59E0B;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.6);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family-body);
  font-size: 0.95rem;
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
}

/* Tipografía de títulos */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-serif);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

/* Personalización de scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-pill);
}

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