/* ============================================================================
   DESIGN SYSTEM — El francés de Ariana
   Tokens visuales y componentes base compartidos por las 21 lecciones, el
   índice, Hermes y el panel de admin.

   Fuente de verdad REAL — antes vivía en app/css/theme.css, un directorio
   congelado desde la migración del 14 sep que Vercel nunca despliega, así
   que cada página traía su propia copia del CSS pegada a mano en un
   <style> inline (la razón original — que un <link> no resolvía en el
   sandbox de Claude Artifacts — ya no aplica desde que el sitio se mudó a
   hosting estático real en Vercel). Ver AGENTS.md § Design System.

   Catálogo visual en vivo: design-system.html (en esta misma carpeta).
   ============================================================================ */

/* ---------- 1. Tokens (Variables) ---------- */
:root {
  /* Superficies */
  --paper: #EEF1F5;
  --card: #FFFFFF;
  --card-2: #F5F7FA;

  /* Texto y Líneas */
  --ink: #28303F;
  --ink-soft: #5C6675;
  --line: #DBE1E9;
  --rule: #B9C7DE;

  /* Colores Semánticos */
  --blue: #3E6BAE;
  --blue-soft: #E4EDF9;
  --pen: #D64F39;
  --pen-soft: #FADFD9;
  --grass: #3F9D6B;
  --grass-soft: #DDF0E5;
  --sun: #EBAF3C;
  --hl: #C1743A;
  --hl-soft: #F6E7D6;

  /* Variantes para TEXTO de color (>= 4.5:1 sobre --card y sobre su -soft).
     Los tokens base (--pen, --grass, --hl) quedan para bordes, rellenos e iconos. */
  --pen-text: #B83B26;
  --grass-text: #307751;
  --hl-text: #965A2D;

  /* Elevación */
  --shadow: 0 2px 4px rgba(40,48,63,.06), 0 14px 30px -14px rgba(40,48,63,.28);

  /* Botones de acción principal (se mantienen oscuros en ambos temas para el contraste del texto blanco) */
  --cta: #D3442C;       /* 4.53:1 con texto blanco (antes #D64F39 = 4.17) */
  --cta-blue: #3F6CB0;

  /* Escala tipográfica (solo tamaños de texto de interfaz; los títulos y
     elementos display se dimensionan localmente) */
  --fs-xs: .82rem;      /* etiquetas, metadatos */
  --fs-sm: .9rem;       /* texto secundario, instrucciones */
  --fs-md: 1rem;        /* texto de interfaz por defecto */
  --fs-lg: 1.15rem;     /* texto destacado */

  /* Radios */
  --r-sm: 10px;         /* controles pequeños, chips cuadrados */
  --r-md: 16px;         /* tarjetas internas, opciones */
  --r-lg: 22px;         /* pantallas */
  --r-pill: 999px;

  /* Espaciado (paso de 4px; solo valores que ya existían, sin cambiar layouts) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  /* Tamaño mínimo de objetivo táctil */
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14181F; --card: #1C222C; --card-2: #232B36;
    --ink: #E9EDF3; --ink-soft: #A3AEBE; --line: #2E3744; --rule: #3A4A63;
    --blue: #7BA6E0; --blue-soft: #213047; --pen: #EE7359; --pen-soft: #3A241F;
    --grass: #68BE8E; --grass-soft: #1E3129; --sun: #EBAF3C;
    --hl: #E0965A; --hl-soft: #382719;
    --pen-text: #EE7359; --grass-text: #68BE8E; --hl-text: #E0965A;
    --shadow: 0 2px 4px rgba(0,0,0,.35), 0 16px 34px -16px rgba(0,0,0,.6);
  }
}

:root[data-theme="dark"] {
  --paper: #14181F; --card: #1C222C; --card-2: #232B36;
  --ink: #E9EDF3; --ink-soft: #A3AEBE; --line: #2E3744; --rule: #3A4A63;
  --blue: #7BA6E0; --blue-soft: #213047; --pen: #EE7359; --pen-soft: #3A241F;
  --grass: #68BE8E; --grass-soft: #1E3129; --sun: #EBAF3C;
  --hl: #E0965A; --hl-soft: #382719;
  --pen-text: #EE7359; --grass-text: #68BE8E; --hl-text: #E0965A;
  --shadow: 0 2px 4px rgba(0,0,0,.35), 0 16px 34px -16px rgba(0,0,0,.6);
}

/* ---------- 2. Base y Resets ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font-family: inherit; }

/* Accesibilidad del foco */
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }

/* ---------- 3. Componentes UI Base ---------- */

/* Pantallas y Contenedores */
.screen {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

/* Tipografía de Títulos */
h1 {
  font-family: "Baloo 2", cursive;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.15;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}

/* Botón Principal (Hero) */
.btn-hero {
  border: 0;
  cursor: pointer;
  background: var(--cta);
  color: #fff;
  font-family: "Baloo 2", cursive;
  font-weight: 600;
  font-size: 1.3rem;
  padding: 16px 34px;
  min-height: var(--tap);
  border-radius: var(--r-md);
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: transform 0.15s ease;
}
.btn-hero:active { transform: scale(0.97); }

/* Botón Secundario (Fantasma) */
.btn-ghost {
  border: 2px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  border-radius: var(--r-pill);
  padding: 10px 20px;
  min-height: var(--tap);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.btn-ghost:active { transform: scale(0.97); }
.btn-hero + .btn-ghost { margin-top: -4px; }

/* Selector de Voz Global */
.vozrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vozlbl { font-size: var(--fs-xs); color: var(--ink-soft); font-weight: 700; }
.vozopt {
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: var(--fs-xs);
  padding: 7px 14px;
  min-height: var(--tap);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.vozopt.on {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
}
.vozopt:active { transform: scale(0.96); }

/* Animaciones */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
