/* La sección del hero está subida con un `margin-top` negativo desde Bricks
   para que el header quede flotando encima del video. Ese margen es un número
   fijo y el alto del header no lo es: cambia por breakpoint y por dispositivo.
   Cuando no coinciden, el hero termina antes que la pantalla y asoma la sección
   siguiente. `--af-hero-desfase` lo corrige y lo mide el JS. */
.af-hero {
	--af-hero-desfase: 0px;
	--af-hero-height: calc(100dvh - var(--af-hero-desfase));
	--af-hero-text: var(--blanco, #F8F8F6);
	--af-hero-dot: #d9d9d9;
	--af-hero-dot-active: var(--negro, #000000);
	position: relative;
	width: 100%;
	height: var(--af-hero-height);
	background-color: var(--negro, #000000);
	overflow: hidden;
}

.af-hero__track {
	display: flex;
	height: 100%;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
}

.af-hero__track::-webkit-scrollbar {
	display: none;
}

.af-hero__slide {
	position: relative;
	flex: 0 0 100%;
	scroll-snap-align: start;
	height: 100%;
}

.af-hero__media {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.af-hero__bg {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.af-hero__bg--video {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
	height: 100%;
	transform: translate(-50%, -50%);
	border: 0;
	pointer-events: none;
}

.af-hero__overlay {
	position: absolute;
	inset: 0;
	background: var(--af-hero-overlay, transparent);
	z-index: 1;
}

/**
 * El `translateZ(0)` no es un truco de rendimiento: es lo que mantiene el texto
 * por encima del video en iPhone.
 *
 * WebKit compone el `<video>` en su propia capa de hardware, y esa capa tiende
 * a quedar por encima de cualquier hermano que no esté compuesto, sin importar
 * el `z-index`. Mientras el texto tenía una transición de `transform` andando
 * estaba compuesto y se veía; al terminar la animación el `transform` volvía a
 * `none`, el navegador descartaba la capa y el texto se iba detrás del video.
 *
 * De ahí el síntoma: el texto aparecía y desaparecía, **solo** en los slides
 * con video, en Safari y en Chrome de iPhone por igual —los dos usan WebKit— y
 * con el carrusel quieto. Forzando la capa de forma permanente, el texto se
 * dibuja siempre arriba.
 */
.af-hero__content {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 12px;
	padding: 40px 40px 40px 160px;
	color: var(--af-hero-text);
	z-index: 2;
	transform: translateZ(0);
}

/* Por la misma razón, el degradado que separa el texto del fondo. */
.af-hero__overlay {
	transform: translateZ(0);
}

.af-hero__tag {
	font-family: 'Montserrat', sans-serif;
	font-size: var(--af-hero-tag-size, 18px);
	font-weight: 800;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--af-hero-tag-color, var(--verde, #79d100));
}

.af-hero__title {
	margin: 0;
	font-family: 'Montserrat', sans-serif;
	font-size: var(--af-hero-title-size, 84px);
	font-weight: 900;
	line-height: 0.95;
	text-transform: uppercase;
	max-width: 700px;
	color: var(--af-hero-title-color, var(--blanco, #F8F8F6));
}

.af-hero__promo {
	margin: 0;
	font-family: 'DM Sans', sans-serif;
	font-size: var(--af-hero-promo-size, 18px);
	font-weight: 700;
	text-transform: uppercase;
	max-width: 480px;
	line-height: 1.4;
	color: var(--af-hero-promo-color, var(--blanco, #F8F8F6));
}

.af-hero__pricing {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.af-hero__cuota-label {
	font-family: 'DM Sans', sans-serif;
	font-size: 15px;
	font-weight: 500;
	text-transform: uppercase;
	opacity: 0.85;
}

.af-hero__cuota-valor {
	font-family: 'Montserrat', sans-serif;
	font-size: var(--af-hero-price-size, 56px);
	font-weight: 900;
	line-height: 1;
	color: var(--af-hero-price-color, var(--blanco, #F8F8F6));
}

.af-hero__precio-tachado {
	font-family: 'DM Sans', sans-serif;
	font-size: 14px;
	font-weight: 700;
	text-decoration: line-through;
	opacity: 0.75;
}

.af-hero__cta {
	display: inline-block;
	width: fit-content;
	margin-top: 8px;
	padding: 12px 28px;
	border-radius: 4px;
	background: var(--verde, #79d100);
	color: var(--negro, #000000);
	font-weight: 700;
	text-decoration: none;
}

/* ---------- Entrada y salida del contenido ---------- */
/*
 * Todo cuelga de .af-hero--anim, que la pone el JS al arrancar. Si el script
 * no corre, el contenido se ve como siempre en vez de quedar invisible.
 *
 * La salida dura la mitad que la entrada y no se escalona: el carrusel es un
 * scroll horizontal, así que mientras se desliza los dos slides están a la
 * vista y el texto que se va tiene que haber terminado de irse antes.
 */
.af-hero--anim .af-hero__content > * {
	opacity: 0;
	transform: translateY(28px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.af-hero--anim .af-hero__slide.is-activo .af-hero__content > * {
	opacity: 1;
	transform: none;
	transition:
		opacity 0.65s cubic-bezier(0.22, 0.68, 0.24, 1),
		transform 0.65s cubic-bezier(0.22, 0.68, 0.24, 1);
}

/* Cada bloque entra 90 ms después del anterior, de arriba hacia abajo. */
.af-hero--anim .af-hero__slide.is-activo .af-hero__content > *:nth-child(1) { transition-delay: 0.12s; }
.af-hero--anim .af-hero__slide.is-activo .af-hero__content > *:nth-child(2) { transition-delay: 0.21s; }
.af-hero--anim .af-hero__slide.is-activo .af-hero__content > *:nth-child(3) { transition-delay: 0.30s; }
.af-hero--anim .af-hero__slide.is-activo .af-hero__content > *:nth-child(4) { transition-delay: 0.39s; }
.af-hero--anim .af-hero__slide.is-activo .af-hero__content > *:nth-child(5) { transition-delay: 0.48s; }

/* El botón llega último, con un poco más de recorrido para que se note. */
.af-hero--anim .af-hero__content > .af-hero__cta {
	transform: translateY(34px) scale(0.96);
}

.af-hero--anim .af-hero__slide.is-activo .af-hero__content > .af-hero__cta {
	transform: none;
}

/* El :not() es un seguro: si un slide llegara a tener las dos clases, sin él
   ganaría esta regla por venir después y el contenido no entraría nunca. */
.af-hero--anim .af-hero__slide.is-saliendo:not(.is-activo) .af-hero__content > * {
	opacity: 0;
	transform: translateY(-22px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	transition-delay: 0s;
}

.af-hero__cta {
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.af-hero__cta:hover {
	transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
	.af-hero--anim .af-hero__content > *,
	.af-hero--anim .af-hero__slide.is-activo .af-hero__content > *,
	.af-hero--anim .af-hero__slide.is-saliendo .af-hero__content > * {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

.af-hero__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: var(--af-hero-arrow-size, 44px);
	height: var(--af-hero-arrow-size, 44px);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--af-hero-arrow-bg, var(--blanco, #F8F8F6));
	color: var(--af-hero-arrow-color, var(--negro, #000000));
	cursor: pointer;
	z-index: 2;
}

.af-hero__arrow svg {
	width: 45%;
	height: 45%;
}

/* El fondo del botón está transparente en los ajustes del hero, así que lo
   único que se ve es el chevron: un SVG al 45 % de una caja de 100 px, con 27 px
   de aire a cada lado. Mover solo el `left` lo corría menos de lo que parecía.
 *
 * El chevron se empuja hacia el borde de afuera de su propia caja, así el
 * margen de acá es exactamente el que se ve y el área tocable sigue entera.
 * Si alguna vez se le vuelve a poner fondo al botón hay que sacar los
 * `justify-content`: el chevron quedaría descentrado dentro del círculo. */
.af-hero__arrow--prev {
	left: var(--af-hero-arrow-margen, 12px);
	justify-content: flex-start;
}

.af-hero__arrow--next {
	right: var(--af-hero-arrow-margen, 12px);
	justify-content: flex-end;
}

.af-hero__dots {
	position: absolute;
	left: 50%;
	bottom: 105px;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border-radius: 999px;
	background: var(--af-hero-dot-bg, var(--blanco, #F8F8F6));
	z-index: 2;
}

.af-hero__dot {
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: var(--af-hero-dot);
	cursor: pointer;
	transition: width 0.2s ease, background-color 0.2s ease;
}

.af-hero__dot.is-active {
	width: 24px;
	background: var(--af-hero-dot-active);
}

@media (max-width: 720px) {
	.af-hero__content {
		padding: 24px 24px 137px 24px;
		justify-content: flex-end;
		align-items: center;
		text-align: center;
	}

	.af-hero__title {
		font-size: calc(var(--af-hero-title-size, 84px) * 0.45);
		max-width: 100%;
	}

	.af-hero__pricing {
		align-items: center;
	}

	.af-hero__cta {
		margin-left: auto;
		margin-right: auto;
	}

	.af-hero__cuota-valor {
		font-size: calc(var(--af-hero-price-size, 56px) * 0.7);
	}

	.af-hero__arrow {
		width: calc(var(--af-hero-arrow-size, 44px) * 0.8);
		height: calc(var(--af-hero-arrow-size, 44px) * 0.8);
	}

	.af-hero__arrow svg {
		width: 45%;
		height: 45%;
	}

	.af-hero__arrow--prev,
	.af-hero__arrow--next {
		--af-hero-arrow-margen: 8px;
	}

	.af-hero__dots {
		bottom: 16px;
	}
}
