/* ── Casa da Vila — motion layer ──────────────────────────────────
 * Every effect is opt-in per widget and disabled wholesale under
 * prefers-reduced-motion. Elements start visible and are hidden only
 * once JS confirms it can animate them (html.cdv-fx-ready), so the
 * page is never blank if JS fails.
 * ─────────────────────────────────────────────────────────────── */

/* ── Scroll reveal: fade + rise ─────────────────────────────────── */
html.cdv-fx-ready .cdv-fx-up,
html.cdv-fx-ready .cdv-fx-stagger > * {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: opacity, transform;
}

html.cdv-fx-ready .cdv-fx-up.is-visible,
html.cdv-fx-ready .cdv-fx-stagger > .is-visible {
	opacity: 1;
	transform: none;
	will-change: auto;
}

/* Stagger delays — rows cascade in sequence */
html.cdv-fx-ready .cdv-fx-stagger > *:nth-child(1) { transition-delay: 0ms; }
html.cdv-fx-ready .cdv-fx-stagger > *:nth-child(2) { transition-delay: 70ms; }
html.cdv-fx-ready .cdv-fx-stagger > *:nth-child(3) { transition-delay: 140ms; }
html.cdv-fx-ready .cdv-fx-stagger > *:nth-child(4) { transition-delay: 210ms; }
html.cdv-fx-ready .cdv-fx-stagger > *:nth-child(5) { transition-delay: 280ms; }
html.cdv-fx-ready .cdv-fx-stagger > *:nth-child(6) { transition-delay: 350ms; }
html.cdv-fx-ready .cdv-fx-stagger > *:nth-child(7) { transition-delay: 420ms; }
html.cdv-fx-ready .cdv-fx-stagger > *:nth-child(8) { transition-delay: 490ms; }

/* ── Hero: staggered entrance ───────────────────────────────────── */
html.cdv-fx-ready .cdv-fx-reveal [data-fx-step] {
	opacity: 0;
	transform: translateY(28px);
	transition: opacity 1.1s cubic-bezier(0.22, 1, 0.36, 1),
		transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
html.cdv-fx-ready .cdv-fx-reveal.is-visible [data-fx-step] {
	opacity: 1;
	transform: none;
}
html.cdv-fx-ready .cdv-fx-reveal.is-visible [data-fx-step="1"] { transition-delay: 200ms; }
html.cdv-fx-ready .cdv-fx-reveal.is-visible [data-fx-step="2"] { transition-delay: 380ms; }
html.cdv-fx-ready .cdv-fx-reveal.is-visible [data-fx-step="3"] { transition-delay: 600ms; }

/* ── Hero: parallax ─────────────────────────────────────────────── */
.cdv-hero.cdv-fx-parallax .cdv-hero__imgwrap {
	will-change: transform;
	/* extra height so the drift never exposes an edge */
	height: 125%;
	top: -12.5%;
}
.cdv-hero.cdv-fx-parallax .cdv-hero__imgwrap img { height: 100%; }

/* ── Hero: Ken Burns slow zoom ──────────────────────────────────── */
.cdv-hero.cdv-fx-kenburns .cdv-hero__img {
	animation: cdv-kenburns 26s ease-in-out infinite alternate;
	transform-origin: 55% 45%;
}
@keyframes cdv-kenburns {
	from { transform: scale(1); }
	to   { transform: scale(1.09); }
}

/* ── Hover zoom on gallery tiles ────────────────────────────────── */
.cdv-fx-zoom img {
	transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.cdv-fx-zoom:hover img { transform: scale(1.06); }

/* ── Carousel cross-fade mode ───────────────────────────────────── */
.cdv-carousel--fade .cdv-carousel__track {
	display: block;
	transform: none !important;
	position: relative;
	height: 100%;
}
.cdv-carousel--fade .cdv-carousel__slide {
	position: absolute;
	inset: 0;
	width: 100% !important;
	opacity: 0;
	transition: opacity 1s ease-in-out;
}
.cdv-carousel--fade .cdv-carousel__slide.is-current { opacity: 1; }

/* ── Nav: slides down on first paint ────────────────────────────── */
html.cdv-fx-ready .cdv-nav {
	animation: cdv-nav-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
	animation-delay: 0.15s;
}
@keyframes cdv-nav-in {
	from { opacity: 0; transform: translateY(-100%); }
	to   { opacity: 1; transform: none; }
}

/* ── Link + CTA micro-interactions ──────────────────────────────── */
.cdv-nav__cta {
	position: relative;
	overflow: hidden;
}
.cdv-nav__cta::after {
	content: '';
	position: absolute;
	inset: 0;
	background: currentColor;
	opacity: 0;
	transition: opacity 0.35s ease;
	pointer-events: none;
}
.cdv-nav__cta:hover::after { opacity: 0.08; }

.cdv-contact-row__value {
	background-image: linear-gradient(currentColor, currentColor);
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0% 1px;
	transition: background-size 0.45s cubic-bezier(0.22, 1, 0.36, 1), color 0.3s;
}
.cdv-contact-row:hover .cdv-contact-row__value { background-size: 100% 1px; }

/* ── Respect the user's motion preference ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
	html.cdv-fx-ready .cdv-fx-up,
	html.cdv-fx-ready .cdv-fx-stagger > *,
	html.cdv-fx-ready .cdv-fx-reveal [data-fx-step] {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
	.cdv-hero.cdv-fx-kenburns .cdv-hero__img,
	html.cdv-fx-ready .cdv-nav {
		animation: none !important;
	}
	.cdv-hero.cdv-fx-parallax .cdv-hero__imgwrap {
		transform: none !important;
		height: 100%;
		top: 0;
	}
	.cdv-fx-zoom img,
	.cdv-carousel__track,
	.cdv-carousel--fade .cdv-carousel__slide {
		transition: none !important;
	}
	.cdv-hero__scroll { animation: none !important; }
}
