/* ==========================================================================
   Base — reset minimo, accesibilidad y movimiento.
   Los tokens vienen de theme.json como custom properties en :root.
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	/*
	 * Evita que la cabecera pegajosa tape el elemento enfocado al navegar con
	 * teclado o al saltar a un ancla (WCAG 2.2 — Focus Not Obscured).
	 */
	scroll-padding-top: calc(var(--wp--custom--cabecera--alto) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

body {
	margin: 0;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

img {
	height: auto;
}

/* Medida de lectura comoda. Los titulares la ajustan mas abajo. */
p,
li {
	max-inline-size: var(--wp--custom--tipo--medida);
}

/*
 * Los titulares se equilibran por navegador en vez de con <br> a mano.
 * Importa mas de lo que parece: los titulares en espanol corren un 20-25 %
 * mas largos que su original en ingles y se parten mal solos.
 */
h1,
h2,
h3,
.wp-block-post-title {
	max-inline-size: var(--wp--custom--tipo--medida-titular);
	text-wrap: balance;
}

h4,
h5,
h6,
p {
	text-wrap: pretty;
}

/* --------------------------------------------------------------- Foco ----
   Anillo doble: el interior en papel separa el exterior del fondo, asi que
   se lee igual sobre papel, sobre blanco y sobre una fotografia.
   -------------------------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid transparent;
	outline-offset: 2px;
	box-shadow: var(--wp--custom--comp--foco--anillo);
	border-radius: var(--wp--custom--radio--xs);
}

/* Nunca quitar el foco sin sustituirlo. */
:focus:not(:focus-visible) {
	outline: none;
}

/* ------------------------------------------------------- Salto de contenido */

.avanza-saltar {
	position: absolute;
	left: -9999px;
	z-index: 999;
	padding: 0.75rem 1.25rem;
	background: var(--wp--preset--color--marino);
	color: var(--wp--preset--color--crema);
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	text-decoration: none;
	border-radius: 0 0 var(--wp--custom--radio--m) 0;
}

.avanza-saltar:focus {
	left: 0;
	top: 0;
}

/* --------------------------------------------------- Solo lector de pantalla */

.screen-reader-text,
.avanza-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------- Selección --- */

::selection {
	background: var(--wp--preset--color--amarillo-suave);
	color: var(--wp--preset--color--marino);
}

/* ---------------------------------------------------- Objetivos tactiles ---
   WCAG 2.2 AA exige 24 px en web. Aqui se usan 44 px a proposito: el publico
   es mobile-first, poco tecnico y a menudo mayor.
   -------------------------------------------------------------------------- */

:where(button, .wp-block-button__link, [role="button"]) {
	min-block-size: 2.75rem;
	min-inline-size: 2.75rem;
}

/* ------------------------------------------------------ Movimiento reducido */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
