/* Tokens de diseño (DESIGN.md §2, §3, §4, §6, §9). Único lugar donde viven valores
   sueltos: el resto del CSS usa solo estas variables. Para sumar el modo oscuro
   (fase posterior) basta un bloque :root[data-theme="dark"] que redefina estos tokens. */

:root {
  color-scheme: light;

  /* Color (§2) */
  --frame: #eaefed;
  --surface: #ffffff;
  --raised: #f5f7f6;
  --active: #dfe6e3;
  --border: #e2e7e5;
  --rule: #eef1f0;
  --control: #7b8582;
  --ink: #14181a;
  --muted: #4b5552;
  --faint: #66706d;
  --accent: #11634d;
  --accent-strong: #0c5040;
  --accent-tint: #e1f0ea;
  --accent-ink: #0b4a39;
  --on-accent: #ffffff;
  --danger: #b42318;
  --danger-tint: #fdecea;
  --danger-ink: #8a1c12;
  --warn-tint: #fff3d6;
  --warn-ink: #7a4100;
  --neutral-tint: #e6ebe9;
  --neutral-ink: #3a423f;
  --focus: #14181a;
  --scrim: rgb(20 24 26 / 0.48);
  --tip-bg: #1f2624;

  /* Tipografía (§3) */
  --font-sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas,
    monospace;
  --fs-title: 1.5rem;
  --fs-section: 1.25rem;
  --fs-body: 1.0625rem;
  --fs-meta: 0.9375rem;
  --fs-figure: 1.875rem;
  --lh-title: 1.2;
  --lh-section: 1.4;
  --lh-body: 1.5;
  --lh-meta: 1.45;
  --lh-figure: 1.1;

  /* Medidas (§4). Todo en rem: "Letra grande" escala el sistema entero. */
  --control-h: 3rem;
  --control-h-compact: 2.5rem;
  --touch-min: 2.75rem;
  --radius-sheet: 1rem;
  --radius-card: 0.625rem;
  --radius-control: 0.5rem;
  --radius-pill: 999px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --gutter: 1rem;
  --topbar-h: 3.5rem;
  --bottomnav-h: 4rem;
  --sidebar-w: 15.5rem;
  --form-max: 40rem;
  --content-max: 75rem;

  /* Elevación (§6): el primer anillo es el borde, no se suma un border encima. */
  --e-sunk: inset 0 1px 2px rgb(20 24 26 / 0.06);
  --e1: 0 0 0 1px rgb(20 24 26 / 0.08), 0 1px 2px rgb(20 24 26 / 0.08),
    0 3px 8px -2px rgb(20 24 26 / 0.1);
  /* e1 sin el anillo: para botones que ya llevan su propio borde de control. */
  --e1-flat: 0 1px 2px rgb(20 24 26 / 0.08), 0 3px 8px -2px rgb(20 24 26 / 0.1);
  --e2: 0 0 0 1px rgb(20 24 26 / 0.08), 0 2px 4px rgb(20 24 26 / 0.08),
    0 12px 24px -6px rgb(20 24 26 / 0.18);
  --e2-up: 0 -1px 0 rgb(20 24 26 / 0.08), 0 -4px 12px rgb(20 24 26 / 0.06);
  --e3: 0 0 0 1px rgb(20 24 26 / 0.08), 0 4px 8px rgb(20 24 26 / 0.06),
    0 12px 28px rgb(20 24 26 / 0.12);
  --e4: 0 0 0 1px rgb(20 24 26 / 0.06), 0 24px 56px rgb(20 24 26 / 0.2);

  /* Movimiento (§9) */
  --dur-fast: 120ms;
  --dur-mid: 160ms;
  --dur-menu: 200ms;
  --dur-modal: 240ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: ease-in;

  /* Escala de z-index */
  --z-skip: 100;
  --z-bar: 20;
  --z-sheet: 40;
  --z-float: 60; /* Tom Select, Flatpickr, Tippy, menús */
  --z-modal: 1060; /* SweetAlert2 trae este valor */
}

@media (min-width: 640px) {
  :root {
    --gutter: 1.5rem;
  }
}

@media (min-width: 1024px) {
  :root {
    --gutter: 2rem;
    --fs-title: 1.75rem;
    --topbar-h: 4rem;
  }
}

/* "Letra grande": preferencia por usuario (DESIGN.md §3 y decisión 5). */
html[data-text="grande"] {
  font-size: 112.5%;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-mid: 0ms;
    --dur-menu: 0ms;
    --dur-modal: 0ms;
  }
}
