/* Base: reinicio ligero, tipografía, utilidades de accesibilidad. Solo usa tokens. */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* La cabecera es pegajosa: un ancla (#contenido, filtros) no debe quedar escondida debajo de ella. */
	scroll-padding-top: calc(var(--vw-header-height) + var(--vw-space-4));
}

body {
	margin: 0;
	background: var(--vw-color-bg);
	color: var(--vw-color-text);
	font-family: var(--vw-font-body);
	font-size: var(--vw-text-base);
	line-height: var(--vw-leading-body);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

::selection {
	background: var(--vw-color-selection);
	color: var(--vw-color-text);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0 0 var(--vw-space-3);
	font-family: var(--vw-font-heading);
	font-weight: var(--vw-weight-heading);
	line-height: var(--vw-leading-tight);
	letter-spacing: var(--vw-heading-tracking);
	text-transform: var(--vw-heading-transform);
	text-wrap: balance;
}

h1 { font-size: var(--vw-text-3xl); }
h2 { font-size: var(--vw-text-2xl); }
h3 { font-size: var(--vw-text-xl); }
h4 { font-size: var(--vw-text-lg); }

p,
ul,
ol,
dl,
figure {
	margin: 0 0 var(--vw-space-4);
}

/* Enlace base = enlace de texto: subrayado fino en reposo (nada depende solo del color), color y grosor al pasar el puntero.
   Especificidad cero (:where): cualquier regla de familia la sobrescribe. Todo enlace que no tenga regla propia (contenido, avisos, WooCommerce) hereda esto. Las familias de navegación, tarjeta y
   botón lo cambian en components.css; ver docs/12-estandar-de-interaccion.md. */
:where(a) {
	color: var(--vw-color-link);
	text-decoration: underline;
	text-decoration-thickness: var(--vw-ul-thickness-thin);
	text-decoration-color: var(--vw-color-detail);
	text-underline-offset: 0.2em;
	transition: color var(--vw-duration-fast) var(--vw-ease), text-decoration-color var(--vw-duration-fast) var(--vw-ease);
}

@media (hover: hover) {
	:where(a:hover) {
		color: var(--vw-color-link-hover);
		text-decoration-color: currentcolor;
		text-decoration-thickness: var(--vw-ul-thickness);
	}
}

:where(a:active) {
	color: var(--vw-color-link-hover);
	text-decoration-color: currentcolor;
}

/* Un enlace que solo envuelve una imagen no se subraya. */
:where(a:has(> img:only-child, > picture:only-child, > svg:only-child)) {
	text-decoration: none;
}

hr {
	border: 0;
	border-top: 1px solid var(--vw-color-border);
	margin: var(--vw-space-5) 0;
}

table {
	border-collapse: collapse;
	width: 100%;
}

/* Foco visible siempre: un solo anillo para todo el sitio. Sobre fondos oscuros o fotos, la clase .vw-on-dark (o el propio
   contenedor) lo vuelve blanco: --vw-color-focus-inverse. */
:focus-visible {
	outline: 3px solid var(--vw-color-focus);
	outline-offset: 2px;
	border-radius: var(--vw-radius-sm);
}

.vw-on-dark {
	--vw-color-focus: var(--vw-color-focus-inverse);
}

/* Campos: el anillo se pega al borde (un solo trazo, no borde más anillo separados). */
:where(input, textarea, select):focus-visible {
	outline-color: var(--vw-color-focus-halo);
	outline-offset: 0;
	border-color: var(--vw-color-focus);
}

/* Solo para lectores de pantalla (clase estándar de WordPress). */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	position: static !important;
	width: auto;
	height: auto;
	margin: 0;
	clip-path: none;
	overflow: visible;
	white-space: normal;
}

.vw-skip {
	position: absolute;
	left: var(--vw-space-3);
	top: -4rem;
	z-index: 1000;
	padding: var(--vw-space-3) var(--vw-space-4);
	background: var(--vw-color-accent);
	color: var(--vw-color-accent-contrast);
	border-radius: var(--vw-radius-sm);
	font-weight: var(--vw-weight-medium);
}

.vw-skip:focus {
	top: var(--vw-space-3);
	color: var(--vw-color-accent-contrast);
}

[hidden] {
	display: none !important;
}

/* El destino del enlace "saltar" y de los avisos no necesita contorno al recibir foco por programa. */
main:focus,
[tabindex='-1']:focus:not(:focus-visible) {
	outline: none;
}

@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;
		scroll-behavior: auto !important;
	}
}
