/* =========================================================
   ESPT Competizione — base.css
   Reset, elementos HTML sueltos, estructura de página y
   estados comunes (cargando, avisos). Sin componentes.
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  /* Al saltar a un ancla o al tabular, la cabecera fija no tapa el destino. */
  scroll-padding-top: calc(var(--alto-cabecera) + var(--e-3));
  -webkit-tap-highlight-color: var(--c-rojo-suave);
}

body {
  margin: 0;
  background: var(--c-pista);
  color: var(--c-texto);
  font-family: var(--f-base);
  font-size: var(--t-md);
  line-height: 1.55;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

canvas { max-width: 100%; }

img { max-width: 100%; display: block; }

a {
  color: var(--c-rojo);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover { text-decoration: underline; }

/* Quita el retardo del doble toque en todo lo que se pulsa. */
a, button, select, input { touch-action: manipulation; }

:focus-visible {
  outline: 2px solid var(--c-texto);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Enlace para saltar la cabecera (teclado y lectores) ---------- */
.salto {
  position: absolute;
  left: var(--margen);
  top: var(--e-2);
  z-index: 40;
  padding: var(--e-2) var(--e-3);
  background: var(--c-texto);
  color: var(--c-pista);
  border-radius: var(--radio);
  font-weight: 600;
  transform: translateY(-200%);
}
.salto:focus { transform: none; }

/* ---------- Estructura ---------- */
.contenedor {
  width: 100%;
  max-width: calc(var(--ancho) + 2 * var(--margen));
  margin: 0 auto;
  padding: 0 var(--margen);
}

.principal {
  padding: var(--e-5) 0 var(--e-6);
  min-height: 70vh;
}
.principal:focus { outline: none; }   /* recibe el foco del enlace de salto, no hace falta anillo */

.bloque { margin-top: var(--e-5); }

/* ---------- Cabecera de cada vista ---------- */
.titulo-vista {
  margin: 0;
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 400;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.subtitulo-vista {
  margin: var(--e-3) 0 0;
  color: var(--c-texto-2);
  max-width: 62ch;
}

.numeros { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.nota {
  margin: var(--e-3) 0 0;
  font-size: var(--t-xs);
  color: var(--c-texto-3);
  line-height: 1.6;
  max-width: 80ch;
}

/* ---------- Estados ---------- */
.aviso {
  padding: var(--e-4);
  border: 1px solid var(--c-rojo);
  border-left-width: 4px;
  background: var(--c-rojo-suave);
  color: var(--c-texto);
  border-radius: var(--radio);
}
.aviso p { margin: 0 0 var(--e-2); }
.aviso p:last-child { margin-bottom: 0; }

.aviso code {
  background: var(--c-pista);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--c-texto-2);
}

/* Aviso de una sección que ha fallado: más discreto que un error de página. */
.aviso--seccion {
  padding: var(--e-3);
  font-size: var(--t-sm);
}

.cargando { color: var(--c-texto-2); padding: var(--e-4) 0; margin: 0; }

/* Quita el elemento del todo: ni se ve ni lo lee un lector de pantalla. */
.oculto { display: none !important; }

/* Lo contrario: no se ve, pero un lector de pantalla sí lo lee. */
.solo-lector {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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