/*
 * Base: reinicio, tipografía, foco visible, accesibilidad y "menos movimiento".
 * Usa los valores de tokens.css. Detalle en docs/DISENO.md §5 y §12.
 */

/* ---------- Reinicio mínimo ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Que un ancla (#contacto) no quede tapada por la cabecera fija */
  scroll-padding-top: calc(var(--alto-cabecera) + var(--e-4));
}

body {
  margin: 0;
  background-color: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: var(--t-cuerpo);
  font-weight: var(--peso-regular);
  line-height: var(--t-cuerpo-lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

img,
video {
  height: auto;
}

h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

/* ---------- Tipografía ----------
 * Cada estilo existe como clase (.display, .h2…) para poder usar el aspecto
 * en cualquier etiqueta, y como valor por defecto de h1, h2 y h3. */
h1,
.display {
  font-size: var(--t-display);
  font-weight: var(--peso-extrabold);
  line-height: var(--t-display-lh);
  letter-spacing: var(--t-display-ls);
}

h2,
.h2 {
  font-size: var(--t-h2);
  font-weight: var(--peso-extrabold);
  line-height: var(--t-h2-lh);
  letter-spacing: var(--t-h2-ls);
}

.declaracion {
  font-size: var(--t-declaracion);
  font-weight: var(--peso-regular);
  line-height: var(--t-declaracion-lh);
  letter-spacing: var(--t-declaracion-ls);
  max-width: 22ch;
}

h3,
.h3 {
  font-size: var(--t-h3);
  font-weight: var(--peso-semibold);
  line-height: var(--t-h3-lh);
  letter-spacing: var(--t-h3-ls);
}

.cuerpo-grande {
  font-size: var(--t-cuerpo-grande);
}

/* Los títulos de display no se cortan a media palabra salvo que no quede otra */
.display,
h1,
.h2,
h2 {
  overflow-wrap: break-word;
}

/* Texto largo: máximo 65 caracteres por línea */
p {
  max-width: var(--ancho-texto);
  text-wrap: pretty; /* evita que una palabra suelta quede sola en la última línea */
}

.texto-2 {
  color: var(--texto-2);
}

/* ---------- Foco visible (nunca se quita sin reemplazo) ---------- */
:focus-visible {
  outline: 2px solid var(--foco);
  outline-offset: 3px;
}

/* Al saltar al contenido, <main> recibe el foco pero no necesita anillo */
main[tabindex="-1"]:focus {
  outline: none;
}

/* ---------- Accesibilidad ---------- */

/* Link «Saltar al contenido»: invisible hasta que se enfoca con el teclado */
.saltar {
  position: absolute;
  top: var(--e-2);
  left: var(--e-2);
  z-index: 1000;
  padding: var(--e-3) var(--e-5);
  background: var(--papel);
  color: var(--negro);
  font-weight: var(--peso-semibold);
  text-decoration: none;
  transform: translateY(-200%);
}

.saltar:focus {
  transform: none;
  outline: 2px solid var(--azul);
  outline-offset: 2px;
}

/* Texto sólo para lectores de pantalla (ej. «se abre en una pestaña nueva») */
.solo-lectores {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Menos movimiento ----------
 * Si la persona pidió menos movimiento en su sistema: sin desplazamientos,
 * escalas ni scroll suave. La información sigue toda visible. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
