/*
 * Base — reset, elements, layout primitives, utilities.
 * Loaded after tokens.css. No component styles live here.
 */

/* ---- Reset ---------------------------------------------------------- */

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

* {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-h-sticky) + var(--sp-5));
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

body {
	margin: 0;
	background: var(--c-bg);
	color: var(--c-text);
	font-family: var(--font-sans);
	font-size: var(--fs-base);
	line-height: var(--lh-normal);
	font-weight: var(--fw-normal);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

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

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

/* ---- Typography ------------------------------------------------------ */

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-display);
	color: var(--c-text-strong);
	font-weight: var(--fw-bold);
	line-height: var(--lh-snug);
	letter-spacing: var(--tracking-snug);
	text-wrap: balance;
}

h1 {
	font-size: var(--fs-2xl);
	line-height: var(--lh-tight);
	letter-spacing: var(--tracking-tight);
	font-weight: var(--fw-black);
}

h2 {
	font-size: var(--fs-xl);
	letter-spacing: var(--tracking-tight);
	font-weight: var(--fw-bold);
}

h3 {
	font-size: var(--fs-lg);
}

h4 {
	font-size: var(--fs-md);
	font-weight: var(--fw-semi);
}

h5,
h6 {
	font-size: var(--fs-base);
	font-weight: var(--fw-semi);
}

p {
	text-wrap: pretty;
}

a {
	color: var(--c-link);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
	color: var(--c-link-hover);
}

strong,
b {
	font-weight: var(--fw-semi);
	color: var(--c-text-strong);
}

ul,
ol {
	padding-inline-start: 1.25em;
}

blockquote {
	margin: var(--sp-6) 0;
	padding-inline-start: var(--sp-5);
	border-inline-start: 3px solid var(--c-brand-500);
	font-size: var(--fs-md);
	color: var(--c-text-strong);
}

hr {
	border: 0;
	border-top: 1px solid var(--c-border);
	margin: var(--sp-8) 0;
}

/* ---- Focus — visible for keyboards, quiet for mice ------------------- */

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

:focus:not(:focus-visible) {
	outline: none;
}

/* ---- Selection ------------------------------------------------------- */

::selection {
	background: var(--c-brand-200);
	color: var(--c-ink-900);
}

/* ---- Layout primitives ----------------------------------------------- */

.container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.container--wide {
	max-width: var(--container-wide);
}

.container--text {
	max-width: var(--container-text);
}

.section {
	padding-block: var(--section-y);
	position: relative;
}

.section--tight {
	padding-block: calc(var(--section-y) * 0.6);
}

.section--subtle {
	background: var(--c-bg-subtle);
}

.section--muted {
	background: var(--c-bg-muted);
}

/* Inverse sections carry the dark rhythm of the page. Text tokens are
   remapped rather than overridden per-element, so any component dropped
   inside inherits correct colours automatically. */
.section--inverse {
	background: var(--c-bg-inverse);
	--c-text: rgba(255, 255, 255, 0.76);
	--c-text-strong: var(--c-white);
	--c-text-muted: rgba(255, 255, 255, 0.55);
	--c-border: rgba(255, 255, 255, 0.14);
	--c-border-strong: rgba(255, 255, 255, 0.24);
	--c-link: var(--c-brand-300);
	--c-link-hover: var(--c-white);
	color: var(--c-text);
}

.section--inverse h1,
.section--inverse h2,
.section--inverse h3,
.section--inverse h4,
.section--inverse h5,
.section--inverse h6 {
	color: var(--c-text-strong);
}

.stack > * + * {
	margin-block-start: var(--flow, var(--sp-4));
}

.grid {
	display: grid;
	gap: var(--grid-gap, var(--sp-6));
}

.cluster {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cluster-gap, var(--sp-4));
	align-items: center;
}

/* Variante para rejillas con pocas tarjetas: auto-fill mantiene las columnas
   vacías, así una sola tarjeta conserva su ancho en vez de estirarse a todo
   el contenedor. Con auto-fit, una noticia suelta ocupaba la fila entera. */
/* Doble clase a propósito: .auto-grid se declara más abajo y, con la misma
   especificidad, ganaría por orden. */
.auto-grid.auto-grid--fill {
	grid-template-columns: repeat(
		auto-fill,
		minmax(min(var(--col-min, 260px), 100%), 1fr)
	);
}

/* Auto-fitting grid: never needs media queries, never leaves orphans
   stretched across the full width. */
.auto-grid {
	display: grid;
	gap: var(--grid-gap, var(--sp-6));
	grid-template-columns: repeat(
		auto-fit,
		minmax(min(var(--col-min, 260px), 100%), 1fr)
	);
}

/* ---- Utilities -------------------------------------------------------- */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	left: var(--sp-4);
	top: var(--sp-4);
	z-index: var(--z-modal);
	transform: translateY(-200%);
	background: var(--c-white);
	color: var(--c-brand-700);
	padding: var(--sp-3) var(--sp-5);
	border-radius: var(--r-sm);
	box-shadow: var(--shadow-lg);
	font-weight: var(--fw-semi);
	text-decoration: none;
	transition: transform var(--dur-base) var(--ease-out);
}

.skip-link:focus {
	transform: translateY(0);
}

.text-center {
	text-align: center;
}

.measure {
	max-width: var(--container-text);
}

.measure-center {
	max-width: var(--container-text);
	margin-inline: auto;
}

/* Eyebrow / kicker above a heading */
.eyebrow {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	font-size: var(--fs-sm);
	font-weight: var(--fw-semi);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: var(--c-brand-500);
	margin-bottom: var(--sp-3);
}

.section--inverse .eyebrow {
	color: var(--c-brand-300);
}

.eyebrow::before {
	content: "";
	width: 1.75rem;
	height: 2px;
	background: currentColor;
	border-radius: var(--r-full);
	flex: none;
}

.lede {
	font-size: var(--fs-md);
	line-height: var(--lh-relaxed);
	color: var(--c-text);
}

/* ---- Scroll reveal ---------------------------------------------------
 * Progressive enhancement: elements are visible by default and only hidden
 * once JS confirms IntersectionObserver support (adds .js-reveal-ready to
 * <html>). Without JS, nothing is ever invisible.
 */
.js-reveal-ready [data-reveal] {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
	transition-delay: var(--reveal-delay, 0ms);
}

.js-reveal-ready [data-reveal].is-visible {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.js-reveal-ready [data-reveal] {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/* Tercer fondo, en el verde azulado de la marca. Alternar sólo blanco y azul
   claro dejaba las páginas largas monótonas; el teal rompe la serie sin salir
   de la paleta del flyer. */
.section--teal {
	background: var(--c-bg-teal);
}

/*
 * Medida de lectura del artículo, más ancha que la de --container-text.
 * A 68ch el texto de una entrada se veía en una columna estrecha en el
 * centro de una pantalla de escritorio; 82ch sigue dentro del rango legible
 * y ocupa la página sin dejarla vacía a los lados.
 */
.container--article {
	max-width: 82ch;
}
