/* ==========================================================================
   Malai · base
   Tokens, tipografía y reset. Ningún componente vive aquí.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tipografía self-hosted
   Jost es una variable font: un único fichero cubre de Light 300 a SemiBold
   600, así que no hay un @font-face por peso.
   -------------------------------------------------------------------------- */

@font-face {
	font-family: "Jost";
	src: url("../fonts/jost-latin.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Jost";
	src: url("../fonts/jost-latin-ext.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
		U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
	/* Color · marca
	   Los ratios están medidos sobre la superficie tintada (--c-super-1), que
	   es el fondo más claro sobre el que llega a haber texto; sobre blanco
	   suben. Medirlos solo sobre blanco engañaba: los dos tonos de texto
	   pasaban allí y se quedaban en 4,2 en las secciones claras, que son la
	   mitad de la web. Los que no llegan a 4.5:1 quedan marcados como
	   solo-gráficos: no se usan para texto. */
	--c-acento: #054c5e;         /* 8,0:1 · fondos oscuros, titulares, botón primario */
	--c-marca: #4aa9d8;          /* 2,2:1 · SOLO gráfico: isotipo, iconos, filetes */
	--c-marca-texto: #1f7099;    /* 4,6:1 · el azul de marca cuando lleva texto */
	--c-tinta: #2a3c4b;          /* 9,6:1 · texto corriente */
	--c-tinta-suave: #5a6c7a;    /* 4,6:1 · texto secundario */
	--c-boton-suave: #5c7983;    /* 4,6:1 · botón secundario, con texto blanco encima */

	/* Color · superficies */
	--c-fondo: #ffffff;
	--c-super-1: #e6edee;        /* barra de navegación y secciones claras */
	--c-super-2: #cddbde;        /* segunda barra, bordes, separadores */
	--c-borde: #d5e0e3;

	/* Color · sobre fondo oscuro */
	--c-sobre-oscuro: #ffffff;
	--c-sobre-oscuro-suave: #c3d6dc;  /* 7,3:1 sobre --c-acento */

	/* Color · iconos de marca
	   Son duotono: el contorno hereda el color del texto y los dos azules
	   salen de aquí, de modo que el mismo símbolo sirve sobre fondo claro y
	   sobre fondo oscuro sin necesidad de dos juegos de archivos. */
	--icono-acento: #5eaee0;
	--icono-suave: #dbecf7;

	/* Color · tarjetas de especialidad */
	--c-tarjeta-cuerpo: #0a4c5d;
	--c-tarjeta-pie: #628f9b;    /* blanco sobre este tono da 4,6:1 */

	/* Color · estados */
	--c-acento-hover: #033a48;
	--c-foco: #2176a1;
	--c-error: #b3261e;          /* 6,1:1 sobre blanco */
	--c-exito: #1e6b4f;          /* 6,4:1 sobre blanco */

	/* Tipografía */
	--f-titulo: "Jost", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	--f-texto: var(--f-titulo);

	--peso-fino: 300;
	--peso-normal: 400;
	--peso-medio: 500;
	--peso-fuerte: 600;

	/* Escala fluida. Los extremos son móvil 360 y escritorio 1440.
	   Jost es geométrica y tiene la altura de x baja: al mismo tamaño en
	   píxeles se lee más pequeña que una humanista, así que la escala va
	   deliberadamente por encima de lo habitual. */
	--fs-xs: 0.8125rem;                                  /* 13 · solo versales */
	--fs-sm: 1rem;                                       /* 16 · metadatos */
	--fs-base: 1.1875rem;                                /* 19 · texto corriente */
	--fs-lead: clamp(1.1875rem, 1.1rem + 0.35vw, 1.375rem); /* 19 → 22 · hero y entradillas */
	--fs-h4: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
	--fs-h3: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
	--fs-h2: clamp(1.875rem, 1.4rem + 2vw, 2.875rem);    /* 30 → 46 */
	--fs-h1: clamp(2.25rem, 1.55rem + 3vw, 3.75rem);     /* 36 → 60 */

	--lh-apretado: 1.15;
	--lh-titulo: 1.22;
	--lh-texto: 1.7;

	--tracking-versal: 0.12em;   /* la navegación va en versales muy espaciadas */
	--tracking-titulo: -0.01em;

	/* Espaciado */
	--e-3xs: 0.25rem;
	--e-2xs: 0.5rem;
	--e-xs: 0.75rem;
	--e-s: 1rem;
	--e-m: 1.5rem;
	--e-l: 2rem;
	--e-xl: 3rem;
	--e-2xl: 4rem;
	--e-3xl: 6rem;

	/* Ritmo vertical de sección, fluido */
	--e-seccion: clamp(3rem, 2rem + 5vw, 6rem);

	/* Anchos */
	--ancho-max: 1520px;         /* ancho de la maqueta; se cambia solo aquí */
	--ancho-estrecho: 44rem;     /* texto largo: blog y páginas legales */
	--pad-lateral: clamp(1.25rem, 4vw, 2.5rem);

	/* Radios */
	--r-s: 4px;
	--r-m: 8px;
	--r-l: 16px;
	--r-xl: 24px;
	--r-pill: 999px;

	/* Sombras */
	--s-baja: 0 1px 2px rgb(5 76 94 / 0.06), 0 2px 8px rgb(5 76 94 / 0.06);
	--s-media: 0 4px 12px rgb(5 76 94 / 0.08), 0 12px 32px rgb(5 76 94 / 0.08);
	--s-alta: 0 8px 24px rgb(5 76 94 / 0.12), 0 24px 60px rgb(5 76 94 / 0.10);

	/* Movimiento */
	--t-rapida: 140ms;
	--t-media: 240ms;
	--curva: cubic-bezier(0.2, 0, 0.2, 1);
}

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

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

* {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Compensa la cabecera fija al saltar a un ancla. */
	scroll-padding-top: 7rem;
}

body {
	margin: 0;
	background-color: var(--c-fondo);
	color: var(--c-tinta);
	font-family: var(--f-texto);
	font-size: var(--fs-base);
	font-weight: var(--peso-normal);
	line-height: var(--lh-texto);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

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

img {
	height: auto;
}

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

button {
	background: none;
	border: 0;
	cursor: pointer;
}

p,
li,
figcaption {
	text-wrap: pretty;
	overflow-wrap: break-word;
}

/* --------------------------------------------------------------------------
   Titulares
   El diseño pide titulares finos y elegantes: Jost en peso 300 y sin
   versales, salvo en navegación y etiquetas.
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--f-titulo);
	font-weight: var(--peso-fino);
	line-height: var(--lh-titulo);
	letter-spacing: var(--tracking-titulo);
	color: var(--c-acento);
	text-wrap: balance;
}

h1 {
	font-size: var(--fs-h1);
	line-height: var(--lh-apretado);
}

h2 {
	font-size: var(--fs-h2);
}

h3 {
	font-size: var(--fs-h3);
	font-weight: var(--peso-normal);
}

h4 {
	font-size: var(--fs-h4);
	font-weight: var(--peso-medio);
}

/* Antetítulo: la línea corta en versales sobre el H2. */
.antetitulo {
	display: block;
	margin-bottom: var(--e-2xs);
	color: var(--c-marca-texto);
	font-size: var(--fs-xs);
	font-weight: var(--peso-medio);
	letter-spacing: var(--tracking-versal);
	line-height: 1.4;
	text-transform: uppercase;
}

.entradilla {
	font-size: var(--fs-lead);
	color: var(--c-tinta-suave);
}

/* --------------------------------------------------------------------------
   Enlaces y foco
   -------------------------------------------------------------------------- */

a {
	color: var(--c-marca-texto);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: color var(--t-rapida) var(--curva);
}

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

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

/* Sobre fondo oscuro el anillo azul no contrasta: se invierte. */
.sobre-oscuro :focus-visible {
	outline-color: var(--c-sobre-oscuro);
}

/* --------------------------------------------------------------------------
   Utilidades de accesibilidad
   -------------------------------------------------------------------------- */

.solo-lectores {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.salto-contenido {
	position: absolute;
	top: var(--e-2xs);
	left: var(--e-2xs);
	z-index: 999;
	padding: var(--e-2xs) var(--e-s);
	background: var(--c-acento);
	color: var(--c-sobre-oscuro);
	border-radius: var(--r-m);
	font-weight: var(--peso-medio);
	text-decoration: none;
	transform: translateY(-200%);
	transition: transform var(--t-rapida) var(--curva);
}

.salto-contenido:focus-visible {
	transform: translateY(0);
	color: var(--c-sobre-oscuro);
}

/* --------------------------------------------------------------------------
   Movimiento reducido
   -------------------------------------------------------------------------- */

@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;
	}
}
