/* =========================================================================
   Voces PTM — sistema base
   Capas: tokens · base · layout · componentes · utilidades
   ========================================================================= */

@layer tokens, base, layout, componentes, utilidades;

/* ---------------------------------------------------------------- tokens */
@layer tokens {
	:root {
		/* Marca */
		--c-brand: #fe8c02;
		--c-brand-deep: #fe6f03;
		--c-brand-light: #fda304;
		--c-brand-ink: #a85300;          /* 5,38:1 sobre blanco · 4,69:1 sobre --c-paper-3 */
		--g-brand: linear-gradient(160deg, #fda304 0%, #fe8c02 55%, #fe6f03 100%);

		/* Territorio oscuro */
		--c-ink-900: #0e0e0f;
		--c-ink-800: #181818;
		--c-ink-700: #232323;
		--c-ink-600: #2e2e2e;
		--c-ink-500: #444343;

		/* Territorio claro */
		--c-paper: #fff;
		--c-paper-2: #faf9f7;
		--c-paper-3: #f2efec;
		--c-line: #e3dfda;
		--c-text: #181818;
		--c-text-mut: #5a5652;          /* 7,0:1 sobre blanco: cuerpo secundario más presente */

		/* Sobre oscuro */
		--c-on-dark: #f4f2f0;
		--c-on-dark-mut: #a5a19d;
		--c-line-dark: #2e2e2e;

		/* Estados de UI (no son colores de marca) */
		--c-focus: #2f6fed;
		--c-ok: #157347;
		--c-error: #b42318;

		/* Tipografía */
		--f-titulos: Montserrat, "Segoe UI", system-ui, -apple-system, sans-serif;
		--f-texto: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;

		--fs-display: clamp(2.125rem, 1.5rem + 2.4vw, 3.375rem);
		--fs-h1: clamp(2rem, 1.45rem + 2.1vw, 3.125rem);
		--fs-h2: clamp(1.625rem, 1.3rem + 1.3vw, 2.375rem);
		--fs-h3: clamp(1.125rem, 1.05rem + 0.35vw, 1.375rem);
		--fs-body: clamp(1rem, 0.97rem + 0.12vw, 1.0625rem);
		--fs-small: 0.875rem;
		--fs-micro: 0.8125rem;

		/* Espaciado */
		--sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
		--sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px; --sp-10: 128px;

		--seccion-y: clamp(48px, 6vw, 88px);   /* −15 % respecto a la primera pasada */
		--contenedor: 1200px;
		--gutter: clamp(20px, 4vw, 40px);

		/* Radios */
		--r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-xl: 20px; --r-pill: 999px;

		/* Transición única del sistema */
		--t: 170ms cubic-bezier(0.2, 0.6, 0.2, 1);

		--cab-alto: 72px;
	}
}

/* ------------------------------------------------------------------ base */
@layer base {
	*, *::before, *::after { box-sizing: border-box; }

	html { -webkit-text-size-adjust: 100%; }

	body {
		margin: 0;
		background: var(--c-paper);
		color: var(--c-text);
		font-family: var(--f-texto);
		font-size: var(--fs-body);
		line-height: 1.6;
		-webkit-font-smoothing: antialiased;
		text-rendering: optimizeLegibility;
		overflow-x: hidden;
	}

	h1, h2, h3, h4 {
		font-family: var(--f-titulos);
		font-weight: 700;
		line-height: 1.14;
		letter-spacing: -0.015em;
		margin: 0 0 var(--sp-4);
		text-wrap: balance;
	}

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

	p { margin: 0 0 var(--sp-4); }
	p:last-child { margin-bottom: 0; }

	a { color: var(--c-brand-ink); text-underline-offset: 0.18em; }
	a:hover { color: var(--c-text); }

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

	ul, ol { margin: 0; padding: 0; list-style: none; }

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

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

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

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

/* ---------------------------------------------------------------- layout */
@layer layout {
	.contenedor {
		width: 100%;
		max-width: var(--contenedor);
		margin-inline: auto;
		padding-inline: var(--gutter);
	}

	.seccion { padding-block: var(--seccion-y); }

	.seccion--clara { background: var(--c-paper); }
	.seccion--gris { background: var(--c-paper-3); }
	.seccion--oscura {
		background: var(--c-ink-800);
		color: var(--c-on-dark);
		padding-block: var(--seccion-y);
	}

	.seccion--clara + .seccion--clara:not(.seccion--linea) { padding-top: 0; }
	.seccion--linea { border-top: 1px solid var(--c-line); }

	.seccion--oscura h1,
	.seccion--oscura h2,
	.seccion--oscura h3 { color: #fff; }

	.seccion__cab {
		max-width: 62ch;
		margin-bottom: clamp(32px, 4vw, 56px);
	}
	.seccion__cab--estrecha { max-width: 54ch; }

	.seccion__titulo { margin-bottom: var(--sp-3); }

	.seccion__texto {
		color: var(--c-text-mut);
		font-size: 1.0625rem;
		max-width: 58ch;
	}
	.seccion--oscura .seccion__texto { color: var(--c-on-dark-mut); }

	.seccion__pie {
		margin-top: clamp(32px, 4vw, 48px);
		display: flex;
		flex-wrap: wrap;
		gap: var(--sp-5) var(--sp-7);
	}

	.rejilla {
		display: grid;
		gap: var(--sp-5);
	}
	.rejilla--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }

	main { display: block; }
}

/* ----------------------------------------------------------- componentes */
@layer componentes {

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

	.saltar {
		position: absolute;
		top: -100px;
		left: var(--sp-4);
		z-index: 200;
		background: var(--c-brand);
		color: var(--c-ink-800);
		padding: var(--sp-3) var(--sp-5);
		border-radius: 0 0 var(--r-md) var(--r-md);
		font-weight: 600;
		text-decoration: none;
		transition: top var(--t);
	}
	.saltar:focus { top: 0; }

	/* --- Antetítulo ----------------------------------------------------- */
	.eyebrow {
		display: inline-block;
		font-size: var(--fs-micro);
		font-weight: 600;
		letter-spacing: 0.09em;
		text-transform: uppercase;
		color: var(--c-brand);
		margin: 0 0 var(--sp-4);
		padding-top: var(--sp-4);
		border-top: 3px solid transparent;
		border-image: var(--g-brand) 1;
		border-bottom: 0; border-left: 0; border-right: 0;
	}
	.eyebrow--oscuro { color: var(--c-brand-ink); }

	/* --- Botones -------------------------------------------------------- */
	.btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: var(--sp-2);
		min-height: 48px;
		padding: 0 var(--sp-5);
		border: 1.5px solid transparent;
		border-radius: var(--r-md);
		font-family: var(--f-texto);
		font-size: 0.9375rem;
		font-weight: 600;
		line-height: 1;
		text-decoration: none;
		cursor: pointer;
		transition: background-color var(--t), border-color var(--t), color var(--t), transform var(--t);
	}
	.btn:hover { transform: translateY(-1px); }
	.btn:active { transform: translateY(0); }

	/* Naranja con texto carbón: 7,57:1. Nunca texto blanco sobre naranja. */
	.btn--primario {
		background: var(--c-brand);
		color: var(--c-ink-800);
		border-color: var(--c-brand);
	}
	.btn--primario:hover {
		background: var(--c-brand-light);
		border-color: var(--c-brand-light);
		color: var(--c-ink-800);
	}

	.btn--secundario {
		background: transparent;
		color: var(--c-text);
		border-color: var(--c-line);
	}
	.btn--secundario:hover { border-color: var(--c-text); color: var(--c-text); }

	.btn--sobre-oscuro { color: #fff; border-color: rgb(255 255 255 / 28%); }
	.btn--sobre-oscuro:hover { color: #fff; border-color: #fff; background: rgb(255 255 255 / 6%); }

	.btn--fantasma {
		background: transparent;
		color: var(--c-text);
		border-color: var(--c-line);
	}
	.btn--fantasma:hover { border-color: var(--c-text); color: var(--c-text); }

	.btn--sm { min-height: 40px; padding: 0 var(--sp-4); font-size: 0.875rem; }
	.btn--bloque { width: 100%; }

	.enlace-fuerte {
		display: inline-flex;
		align-items: center;
		gap: var(--sp-2);
		font-weight: 600;
		color: var(--c-brand-ink);
		text-decoration: none;
		border-bottom: 1.5px solid currentColor;
		padding-bottom: 2px;
		transition: color var(--t), gap var(--t);
	}
	.enlace-fuerte:hover { color: var(--c-text); gap: var(--sp-3); }
	.enlace-fuerte--claro { color: var(--c-brand); }
	.enlace-fuerte--claro:hover { color: #fff; }

	/* --- Chips ---------------------------------------------------------- */
	.chip {
		display: inline-block;
		padding: 3px 10px;
		border: 1px solid var(--c-line);
		border-radius: var(--r-pill);
		font-size: var(--fs-micro);
		color: var(--c-text-mut);
		background: var(--c-paper);
	}
	.chip--sutil {
		border-color: transparent;
		background: var(--c-paper-3);
		font-weight: 600;
		color: var(--c-ink-500);
	}

	/* --- Tarjetas ------------------------------------------------------- */
	.tarjeta {
		background: var(--c-paper);
		border: 1px solid var(--c-line);
		border-radius: var(--r-lg);
		overflow: hidden;
		transition: border-color var(--t), transform var(--t), box-shadow var(--t);
	}
	.tarjeta:hover {
		border-color: var(--c-brand);
		transform: translateY(-2px);
		box-shadow: 0 10px 28px -16px rgb(24 24 24 / 25%);
	}

	.tarjeta__enlace {
		display: block;
		height: 100%;
		padding: var(--sp-5);
		color: inherit;
		text-decoration: none;
	}

	.tarjeta__ico {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px; height: 44px;
		margin-bottom: var(--sp-4);
		border-radius: var(--r-md);
		background: var(--c-paper-3);
		color: var(--c-brand-ink);
	}

	.tarjeta__titulo { font-size: var(--fs-h3); margin-bottom: var(--sp-2); }
	.tarjeta__texto { color: var(--c-text-mut); font-size: 0.9375rem; margin-bottom: var(--sp-4); }

	.tarjeta__mas {
		display: inline-flex;
		align-items: center;
		gap: var(--sp-2);
		font-size: 0.875rem;
		font-weight: 600;
		color: var(--c-brand-ink);
		transition: gap var(--t);
	}
	.tarjeta:hover .tarjeta__mas { gap: var(--sp-3); }

	/* --- Lista con check ------------------------------------------------ */
	.lista-check li {
		display: flex;
		align-items: flex-start;
		gap: var(--sp-3);
		margin-bottom: var(--sp-3);
		font-size: 0.9375rem;
	}
	.lista-check svg { flex: 0 0 auto; margin-top: 3px; color: var(--c-brand); }

	/* --- Migas ---------------------------------------------------------- */
	.migas ol { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-small); }
	.migas li + li::before { content: "/"; margin-right: var(--sp-2); color: var(--c-text-mut); }
	.migas a { display: inline-block; padding-block: 4px; color: var(--c-text-mut); text-decoration: none; } /* ≥24 px de objetivo */
	.migas a:hover { color: var(--c-brand-ink); }

	/* --- Avisos --------------------------------------------------------- */
	.aviso {
		padding: var(--sp-3) var(--sp-4);
		border-radius: var(--r-md);
		border-left: 3px solid;
		font-size: 0.9375rem;
		margin-bottom: var(--sp-4);
	}
	.aviso--ok { background: rgb(21 115 71 / 12%); border-color: var(--c-ok); color: #b8f0d3; }
	.aviso--error { background: rgb(180 35 24 / 14%); border-color: var(--c-error); color: #ffc9c4; }

	/* --- Formulario ----------------------------------------------------- */
	.campo { margin-bottom: var(--sp-4); }

	.campo label {
		display: block;
		margin-bottom: var(--sp-2);
		font-size: var(--fs-small);
		font-weight: 600;
	}
	.req { color: var(--c-brand); }

	.campo input,
	.campo select,
	.campo textarea {
		width: 100%;
		min-height: 48px;
		padding: var(--sp-3) var(--sp-4);
		border: 1px solid var(--c-line);
		border-radius: var(--r-md);
		background: var(--c-paper);
		color: var(--c-text);
		font-size: 0.9375rem;
		transition: border-color var(--t);
	}
	.campo textarea { min-height: 110px; resize: vertical; }
	.campo input:hover, .campo select:hover, .campo textarea:hover { border-color: var(--c-ink-500); }
	.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--c-brand); }

	/* Honeypot: fuera de la vista pero no display:none, que algunos bots detectan. */
	.campo--trampa {
		position: absolute;
		left: -9999px;
		width: 1px; height: 1px;
		overflow: hidden;
	}

	.campo--enviar { margin-bottom: var(--sp-3); }

	.formulario__respuesta:empty { display: none; }
	.formulario__respuesta {
		margin: 0;
		font-size: 0.9375rem;
		padding: var(--sp-3) var(--sp-4);
		border-radius: var(--r-md);
		border-left: 3px solid var(--c-brand);
		background: rgb(254 140 2 / 10%);
	}

	/* --- Cabecera ------------------------------------------------------- */
	.cab {
		position: sticky;
		top: 0;
		z-index: 100;
		background: var(--c-paper);
		border-bottom: 1px solid var(--c-line);
	}

	.cab__inner {
		display: flex;
		align-items: center;
		gap: var(--sp-6);
		min-height: var(--cab-alto);
	}

	.logo { display: block; flex: 0 0 auto; }
	.logo img { width: clamp(150px, 16vw, 178px); height: auto; }

	.cab__nav { margin-left: auto; }

	.menu { display: flex; align-items: center; gap: var(--sp-5); }

	.menu__item { position: relative; }

	.menu__item > a {
		display: inline-block;
		padding: var(--sp-2) 0;
		color: var(--c-text);
		font-size: 0.9375rem;
		font-weight: 500;
		text-decoration: none;
		border-bottom: 2px solid transparent;
		transition: border-color var(--t), color var(--t);
	}
	.menu__item > a:hover { border-color: var(--c-brand); }

	.menu__item--tiene-hijos { display: flex; align-items: center; gap: 2px; }

	/* 28×28 para cumplir el tamaño mínimo de objetivo (WCAG 2.2 · 2.5.8). */
	.menu__toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 28px; height: 28px;
		padding: 0;
		background: none;
		border: 0;
		color: var(--c-text-mut);
		cursor: pointer;
		transition: transform var(--t), color var(--t);
	}
	.menu__toggle:hover { color: var(--c-text); }
	.menu__toggle[aria-expanded="true"] { transform: rotate(180deg); color: var(--c-brand-ink); }

	.submenu {
		position: absolute;
		top: calc(100% + 14px);
		left: -20px;
		z-index: 20;
		width: min(560px, 80vw);
		padding: var(--sp-3);
		background: var(--c-paper);
		border: 1px solid var(--c-line);
		border-radius: var(--r-lg);
		box-shadow: 0 12px 32px rgb(24 24 24 / 10%);
	}
	.submenu[hidden] { display: none; }

	.submenu__lista {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 2px;
	}

	.submenu__lista a {
		display: flex;
		align-items: center;
		gap: var(--sp-3);
		padding: var(--sp-3);
		border-radius: var(--r-md);
		color: var(--c-text);
		text-decoration: none;
		font-size: 0.875rem;
		transition: background-color var(--t);
	}
	.submenu__lista a:hover { background: var(--c-paper-3); }
	.submenu__ico { color: var(--c-brand-ink); display: flex; }

	.cab__acciones { display: flex; align-items: center; gap: var(--sp-3); }

	.cab__hamburguesa {
		display: none;
		align-items: center;
		justify-content: center;
		width: 44px; height: 44px;
		margin-left: auto;
		background: none;
		border: 1px solid var(--c-line);
		border-radius: var(--r-md);
		cursor: pointer;
	}
	.cab__barras { display: grid; gap: 4px; width: 18px; }
	.cab__barras i { display: block; height: 2px; background: var(--c-text); border-radius: 2px; }

	/* --- Panel móvil ---------------------------------------------------- */
	.panel {
		position: fixed;
		inset: 0;
		z-index: 150;
		background: var(--c-paper);
		display: flex;
		flex-direction: column;
		overflow-y: auto;
		overscroll-behavior: contain;
	}
	.panel[hidden] { display: none; }

	.panel__cab {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: var(--cab-alto);
		border-bottom: 1px solid var(--c-line);
	}

	.panel__cerrar {
		width: 44px; height: 44px;
		display: grid; place-items: center;
		background: none; border: 1px solid var(--c-line);
		border-radius: var(--r-md);
		cursor: pointer;
	}

	.panel__nav { flex: 1; padding-block: var(--sp-5); }
	.panel__nav a {
		display: block;
		padding: var(--sp-3) 0;
		font-family: var(--f-titulos);
		font-size: 1.125rem;
		font-weight: 600;
		color: var(--c-text);
		text-decoration: none;
		border-bottom: 1px solid var(--c-line);
	}
	.panel__sub a {
		padding-left: var(--sp-4);
		font-family: var(--f-texto);
		font-size: 0.9375rem;
		font-weight: 400;
		color: var(--c-text-mut);
	}

	.panel__pie {
		display: grid;
		gap: var(--sp-3);
		padding-bottom: var(--sp-6);
		padding-top: var(--sp-4);
		border-top: 1px solid var(--c-line);
	}

	/* --- Pie ------------------------------------------------------------ */
	.pie {
		background: var(--c-ink-900);
		color: var(--c-on-dark-mut);
		font-size: 0.9375rem;
	}

	.pie__grid {
		display: grid;
		grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
		gap: var(--sp-6) var(--sp-6);
		padding-block: clamp(40px, 5vw, 64px);
	}

	.pie__marca .logo img { width: 192px; }
	.pie__desc { margin-top: var(--sp-4); max-width: 34ch; }

	.pie__redes { display: flex; gap: var(--sp-2); margin-top: var(--sp-5); }
	.pie__redes a {
		display: grid;
		place-items: center;
		width: 40px; height: 40px;
		border: 1px solid var(--c-line-dark);
		border-radius: var(--r-md);
		color: var(--c-on-dark-mut);
		transition: color var(--t), border-color var(--t);
	}
	.pie__redes a:hover { color: var(--c-brand); border-color: var(--c-brand); }

	.pie__titulo {
		font-size: var(--fs-micro);
		font-weight: 700;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		color: #fff;
		margin-bottom: var(--sp-4);
	}
	.pie__titulo--sep { margin-top: var(--sp-6); }

	.pie__col li { margin-bottom: var(--sp-1); }
	.pie a { color: var(--c-on-dark-mut); text-decoration: none; }
	.pie a:hover { color: var(--c-brand); }

	/* WCAG 2.2 · 2.5.8: los enlaces del pie deben medir al menos 24 px de alto. */
	.pie__col a,
	.pie__legal-menu a { display: inline-block; padding-block: 3px; }

	.pie__legal { border-top: 1px solid var(--c-line-dark); }
	.pie__legal-inner {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: var(--sp-4);
		padding-block: var(--sp-4);
		font-size: var(--fs-micro);
	}
	.pie__legal-menu { display: flex; gap: var(--sp-5); }
	.pie__legal p { margin: 0; }

	/* --- 404 ------------------------------------------------------------ */
	.error404__grid {
		display: grid;
		grid-template-columns: 1.3fr 0.7fr;
		gap: var(--sp-8);
		align-items: center;
	}
	.error404__buscar { margin-top: var(--sp-6); max-width: 380px; }
	.error404__enlaces { margin-top: var(--sp-6); }
	.error404__enlaces h2 { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-text-mut); }
	.error404__enlaces ul { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); }
	.error404__mascota img { margin-inline: auto; }
}

/* ------------------------------------------------------------ utilidades */
@layer utilidades {
	.entrada { max-width: 72ch; margin-bottom: var(--sp-7); }
	.entrada__titulo { font-size: var(--fs-h2); }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1023px) {
	.cab__nav,
	.cab__acciones { display: none; }

	.cab__hamburguesa { display: inline-flex; }

	.pie__grid { grid-template-columns: 1fr 1fr; }

	.error404__grid { grid-template-columns: 1fr; }
	.error404__mascota { display: none; }
}

@media (max-width: 599px) {
	.pie__grid { grid-template-columns: 1fr; gap: var(--sp-6); }
	.pie__legal-inner { flex-direction: column; align-items: flex-start; }
	.seccion__pie { flex-direction: column; gap: var(--sp-4); align-items: flex-start; }
}

@media (min-width: 1024px) {
	.panel { display: none !important; }
}
