/* ============================================================
   TECLEA · Base: reset, tipografía, foco, utilidades
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
}
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--fuente-texto);
  font-size: 1rem;
  line-height: 1.55;
  letter-spacing: var(--interletra);
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--fuente-titulo);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 .5em;
  letter-spacing: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: var(--enlace); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
[hidden] { display: none !important; }

/* ── Foco visible (AA): anillo doble que se ve sobre cualquier fondo ── */
:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 3px;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--fondo) 80%, transparent);
}
:focus:not(:focus-visible) { outline: none; }
/* El foco programático al cambiar de pantalla (h1/main con tabindex=-1) no debe dibujar anillo */
.vista:focus, .vista [tabindex="-1"]:focus { outline: none; box-shadow: none; }

.skip-link {
  position: fixed; left: 1rem; top: -4rem; z-index: 1000;
  background: var(--primario); color: var(--primario-tinta);
  padding: .75rem 1.25rem; border-radius: var(--r-pill); font-weight: 700;
  transition: top var(--t-rapida);
}
.skip-link:focus { top: 1rem; }

/* ── Utilidades ── */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.suave { color: var(--texto-suave); }
.pequeno { font-size: .875rem; }
.pila { display: flex; flex-direction: column; gap: var(--e4); }
.fila { display: flex; align-items: center; gap: var(--e3); }
.fila--fin { justify-content: flex-end; }
.fila--envuelve { flex-wrap: wrap; }
.icono { display: inline-flex; flex: none; width: var(--tam, 24px); height: var(--tam, 24px); }
.icono svg { width: 100%; height: 100%; }

.texto-degradado {
  background: linear-gradient(100deg, var(--violeta-500), var(--coral-500) 60%, var(--sol-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme="dark"] .texto-degradado {
  background: linear-gradient(100deg, var(--violeta-300), var(--coral-400) 60%, var(--sol-400));
  -webkit-background-clip: text; background-clip: text;
}

.etiqueta {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .85rem; border-radius: var(--r-pill);
  background: var(--violeta-100); color: var(--violeta-700);
  font-weight: 800; font-size: .85rem;
}
[data-theme="dark"] .etiqueta { background: rgba(167, 148, 255, .2); color: var(--violeta-200); }
.etiqueta--sol { background: var(--sol-300); color: #4A3500; }
[data-theme="dark"] .etiqueta--sol { background: rgba(255, 208, 74, .2); color: var(--sol-300); }

/* ── Movimiento reducido (resuelto en JS: data-motion="reducido") ── */
[data-motion="reducido"] *, [data-motion="reducido"] *::before, [data-motion="reducido"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

/* ── Impresión (boletines, certificados, tarjetas de acceso) ── */
#print-root { display: none; }
@media print {
  body.imprimiendo > *:not(#print-root) { display: none !important; }
  body.imprimiendo #print-root { display: block; }
  body.imprimiendo { background: #fff !important; color: #000 !important; }
  @page { margin: 14mm; }
}
