/* GeSis Viajes · movimiento (T21, ARCHITECTURE §16.15): solo con no-preference (media del enlace), decorativo, sin tocar el LCP; el scroll va en @supports. */

/* Tokens de movimiento (T-UX-A). Nunca ease-in. Con reduced-motion este archivo no se descarga: el menú los usa con valor de reserva. */
:root {
	--gesis-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
	--gesis-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
	--gesis-dur-press: 160ms;
	--gesis-dur-tip: 150ms;
	--gesis-dur-hover: 200ms;
	--gesis-dur-menu: 220ms;
	--gesis-dur-lift: 240ms;
	--gesis-dur-reveal: 400ms;
	--gesis-dur-enter: 500ms;
}

@media (prefers-reduced-motion: no-preference) {

	/* 1. Curvas de nivel del hero: se deslizan despacio al hacer scroll, como un mapa */
	@supports (animation-timeline: scroll()) {
		.gesis-hero::before { transform: scale(1.06); animation: gesis-fade 1.4s ease both, gesis-map-drift linear both; animation-timeline: auto, scroll(root); animation-range: normal, 0px 700px; }
	}
	@keyframes gesis-map-drift { from { transform: scale(1.06) translateY(0); } to { transform: scale(1.06) translateY(-32px); } }

	/* 2. Brújula en el sello de coordenadas del hero: la aguja se asienta una vez al cargar */
	.gesis-hero__stamp { padding-top: 46px; }
	.gesis-hero__stamp::before { content: ""; position: absolute; top: 0; right: 0; width: 34px; height: 34px; border: 1.5px solid var(--g-azul-200); border-radius: 50%; box-shadow: inset 0 0 0 4px rgba(215, 228, 232, .08); }
	.gesis-hero__stamp::after { content: ""; position: absolute; top: 0; right: 0; width: 34px; height: 34px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 34'%3E%3Cpath d='M17 4.5 20.2 17h-6.4L17 4.5Z' fill='%23FFFFFF'/%3E%3Cpath d='M17 29.5 13.8 17h6.4L17 29.5Z' fill='%23A3C9B3'/%3E%3Ccircle cx='17' cy='17' r='1.6' fill='%23134652'/%3E%3C/svg%3E") center / contain no-repeat; transform-origin: 50% 50%; animation: gesis-needle 2.2s ease-out .3s both; }
	@keyframes gesis-needle { 0% { transform: rotate(-85deg); } 55% { transform: rotate(14deg); } 78% { transform: rotate(-6deg); } 100% { transform: rotate(0); } }
	@media (max-width: 600px) { .gesis-hero__stamp::before, .gesis-hero__stamp::after { display: none; } .gesis-hero__stamp { padding-top: 0; } }

	/* 3. Hero: entran apoyo, CTA y datos (no el H1: LCP) */
	.gesis-hero__lede, .gesis-hero__ctas, .gesis-facts { animation: gesis-enter var(--gesis-dur-enter) var(--gesis-ease-out) backwards; }
	.gesis-hero__ctas { animation-delay: 80ms; }
	.gesis-facts { animation-delay: 160ms; }
	@keyframes gesis-enter { from { opacity: 0; transform: translateY(8px); } }

	/* 4. Aparición al hacer scroll (--n: posición) */
	@supports (animation-timeline: view()) {
		:is(.gesis-dest, .gesis-steps, .is-style-indice, .gesis-meses, .gesis-ev__cards) > :nth-child(n+2) { --n: 1; }
		:is(.gesis-dest, .gesis-steps, .is-style-indice, .gesis-meses, .gesis-ev__cards) > :nth-child(n+3) { --n: 2; }
		:is(.gesis-dest, .gesis-steps, .is-style-indice, .gesis-meses, .gesis-ev__cards) > :nth-child(n+4) { --n: 3; }
		:is(.gesis-steps > *, .is-style-indice li, .gesis-meses li, .gesis-ev__cards .gesis-card, .gesis-cards > li:nth-child(n+4) > .gesis-pcard, :is(.is-style-aparecer, .is-style-deslizar):not(.gesis-hero, .gesis-hero *)) { animation: gesis-reveal linear both; animation-timeline: view(); animation-range: entry calc(var(--n, 0) * 16px) entry calc(120px + var(--n, 0) * 16px); }
		.is-style-aparecer { animation-name: gesis-fade; }
		@media (min-width: 561px) { .gesis-tile { animation: gesis-reveal linear both; animation-timeline: view(); animation-range: entry calc(var(--n, 0) * 16px) entry calc(120px + var(--n, 0) * 16px); } }
	}
	@keyframes gesis-reveal { from { opacity: 0; transform: translateY(12px); } }

	/* 4b. Mapa del tesoro del hero (T-UX-F): los tramos aparecen por opacidad con 70 ms de diferencia (14 tramos ≈ 1,4 s; 9 en pantallas estrechas) y la
	   X entra con una escala corta al terminar; `backwards` deja el estado final cuando no hay animación. No se anima la foto ni el título (LCP). */
	.gesis-hero-route__trail path { animation: gesis-route-seg 420ms var(--gesis-ease-out) backwards; animation-delay: calc(80ms + var(--i, 0) * 70ms); }
	.gesis-hero-route__x { transform-box: fill-box; transform-origin: center; animation: gesis-route-x 240ms var(--gesis-ease-out) 1410ms backwards; }
	@media (max-width: 767px) { .gesis-hero-route__x { animation-delay: 1060ms; } }
	@keyframes gesis-route-seg { from { opacity: 0; } }
	@keyframes gesis-route-x { from { opacity: 0; transform: scale(.6); } }

	/* 5. Entre páginas (inc/motion.php); lineal: sin destello (DV-UX-C-01) */
	::view-transition-old(root), ::view-transition-new(root), ::view-transition-old(gesis-header), ::view-transition-new(gesis-header) { animation-duration: 180ms; animation-timing-function: linear; }
	::view-transition-group(gesis-header) { animation-duration: 0s; }
	.gesis-header { view-transition-name: gesis-header; }
}
@media print { *, *::before, *::after { animation: none !important; } }
