/**
 * Alsace scroll motion.
 * Each section has its own gesture. Sticky pieces are the subnav progress,
 * the carnet map (existing), the collection cards, the highlight chapters, the film, the feature
 * address, the Hilaire portrait, the FAQ introduction, and the proposal card.
 */

@keyframes he-alsace-rise {
	from { opacity: 0; transform: translate3d(0, 1.35rem, 0); }
	to { opacity: 1; transform: none; }
}

@keyframes he-alsace-right {
	from { opacity: 0; transform: translate3d(1.15rem, 0, 0); }
	to { opacity: 1; transform: none; }
}

@keyframes he-alsace-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes he-alsace-unclip {
	from { clip-path: inset(100% 0 0 0); }
	to { clip-path: inset(0); }
}

@keyframes he-alsace-wipe {
	from { clip-path: inset(0 0 0 100%); }
	to { clip-path: inset(0); }
}

.dest-tax--alsace .dest-highlights__panel,
.dest-tax--alsace .dest-highlights__photo,
.dest-tax--alsace .dest-addresses__photo,
.dest-tax--alsace .dest-engine-intro__stage {
	min-width: 0;
}

.dest-tax--alsace .dest-highlights__photo,
.dest-tax--alsace .dest-addresses__photo {
	overflow: hidden;
	background: #e7e0d4;
}

/* ── Hero parallax + sticky nav progress ── */
.dest-tax--alsace .dest-tax-hero {
	background-position: center calc(50% + var(--he-hero-y, 0px));
	overflow: hidden;
}

.dest-tax--alsace .dest-alsace-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	height: 2px;
	background: #0a1b2a;
	transform: scaleX(var(--he-p, 0));
	transform-origin: 0 50%;
	pointer-events: none;
}

/* ── Aperçu: portrait wipe, then a slow drift inside the frame ── */
@media (prefers-reduced-motion: no-preference) {
	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__img {
		animation: none;
		transform: translate3d(0, var(--he-shift, 0px), 0) scale(1.06);
	}

	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__media {
		animation: he-alsace-wipe 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
	}

	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__copy > * {
		animation: he-alsace-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
	}

	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__headline { animation-delay: 0.12s; }
	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__body { animation-delay: 0.24s; }
	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__cta { animation-delay: 0.36s; }
}

/* ── Shared entrances. Hidden only after the motion script starts. ── */
html.he-alsace-motion [data-he-reveal="rise"],
html.he-alsace-motion [data-he-reveal="point"] {
	opacity: 0;
}

html.he-alsace-motion [data-he-reveal="rise"].is-in,
html.he-alsace-motion [data-he-reveal="point"].is-in {
	opacity: 1;
	animation: he-alsace-rise 0.85s cubic-bezier(0.22, 1, 0.36, 1) backwards;
	animation-delay: calc(var(--he-i, 0) * 80ms);
}

html.he-alsace-motion [data-he-reveal="right"] {
	opacity: 0;
}

html.he-alsace-motion [data-he-reveal="right"].is-in {
	opacity: 1;
	animation: he-alsace-right 0.9s cubic-bezier(0.22, 1, 0.36, 1) backwards;
	animation-delay: calc(var(--he-i, 0) * 90ms);
}

html.he-alsace-motion [data-he-reveal="fade"] {
	opacity: 0;
}

html.he-alsace-motion [data-he-reveal="fade"].is-in {
	opacity: 1;
	animation: he-alsace-fade 0.8s ease backwards;
	animation-delay: calc(var(--he-i, 0) * 90ms);
}

html.he-alsace-motion [data-he-reveal="clip"] {
	clip-path: inset(100% 0 0 0);
}

html.he-alsace-motion [data-he-reveal="clip"].is-in {
	clip-path: inset(0);
	animation: he-alsace-unclip 1.05s cubic-bezier(0.22, 1, 0.36, 1) backwards;
	animation-delay: calc(var(--he-i, 0) * 80ms);
}

/* ── Carnet: a rule draws down the notes while the map stays pinned ── */
@media (min-width: 901px) {
	html.he-alsace-motion .dest-atlas__topics {
		position: relative;
	}

	html.he-alsace-motion .dest-atlas__topics::after {
		content: "";
		position: absolute;
		left: -1.15rem;
		top: 0;
		width: 1px;
		height: var(--he-ink, 0%);
		background: #0a1b2a;
		pointer-events: none;
	}
}

/* ── Highlights: each experience pins, then the next one covers it ── */
@media (min-width: 981px) {
	html.he-alsace-motion .dest-highlights {
		padding-bottom: 0;
		margin-bottom: calc(-1 * var(--he-join, 0px));
	}

	html.he-alsace-motion .dest-highlights__gallery {
		display: block;
		counter-reset: he-alsace-hl;
		padding-bottom: 0;
	}

	html.he-alsace-motion .dest-highlights__item {
		position: sticky;
		top: calc(var(--he-sticky-chrome-top, 116px) + var(--dest-tax-nav-h, 56px) + 12px);
		z-index: 1;
		display: flex;
		align-items: center;
		min-height: calc(100vh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px) - 24px);
		min-height: calc(100svh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px) - 24px);
		margin: 0;
		background: var(--hilaire-ivory, #fdfbf7);
		counter-increment: he-alsace-hl;
	}

	html.he-alsace-motion .dest-highlights__item:nth-child(2) { z-index: 2; }
	html.he-alsace-motion .dest-highlights__item:nth-child(3) { z-index: 3; }
	html.he-alsace-motion .dest-highlights__item:nth-child(4) { z-index: 4; }

	/* Park the last card at the top of its frame. The script pulls the villas collection up through the empty space underneath. */
	html.he-alsace-motion .dest-highlights__item:last-child {
		align-items: flex-start;
	}

	html.he-alsace-motion .dest-addresses.dest-alsace-section {
		position: relative;
		z-index: 6;
	}

	html.he-alsace-motion .dest-highlights__item + .dest-highlights__item {
		box-shadow: 0 -18px 36px rgba(10, 27, 42, 0.06);
	}

	html.he-alsace-motion .dest-highlights__panel {
		width: 100%;
		transform: scale(calc(1 - var(--he-cover, 0) * 0.05));
		transform-origin: 50% 0;
	}

	html.he-alsace-motion .dest-highlights__figure {
		display: grid;
		grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
		column-gap: clamp(1.75rem, 4vw, 4.5rem);
		align-items: center;
		width: 100%;
	}

	html.he-alsace-motion .dest-highlights__photo img {
		width: 100%;
		height: min(68vh, 740px);
		max-height: calc(100vh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px) - 88px);
		max-height: calc(100svh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px) - 88px);
		aspect-ratio: auto;
		object-fit: cover;
		transform: translate3d(0, var(--he-shift, 0px), 0) scale(1.06);
	}

	html.he-alsace-motion .dest-highlights__figure figcaption::before {
		content: counter(he-alsace-hl, decimal-leading-zero);
		display: block;
		margin-bottom: 0.85rem;
		font-family: var(--font-heading, "Cormorant Garamond", serif);
		font-size: 1.15rem;
		letter-spacing: 0.16em;
		color: rgba(253, 251, 247, 0.62);
	}

	html.he-alsace-motion .dest-highlights__name {
		font-size: clamp(2.4rem, 3.4vw, 3.75rem);
		line-height: 0.98;
	}

	html.he-alsace-motion .dest-highlights__note {
		max-width: 28rem;
		font-size: 1.05rem;
	}
}

/* ── Engine: the film stays put and opens as the page moves ── */
html.he-alsace-motion .dest-engine-intro.is-pinned {
	overflow: visible;
	padding: 0;
	overflow-anchor: none;
}

html.he-alsace-motion .dest-engine-intro.is-pinned .dest-engine-intro__stage {
	height: 100%;
}

html.he-alsace-motion .dest-engine-intro.is-pinned .dest-engine-intro__frame {
	position: sticky;
	top: calc(var(--he-sticky-chrome-top, 116px) + var(--dest-tax-nav-h, 56px));
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: none;
	height: calc(100vh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px));
	height: calc(100svh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px));
	margin: 0;
	overflow: hidden;
	background: var(--hilaire-ivory, #fdfbf7);
}

html.he-alsace-motion .dest-engine-intro.is-pinned .dest-engine-film {
	width: min(94vw, calc((100vh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px) - 2.5rem) * 2.1));
	width: min(94vw, calc((100svh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px) - 2.5rem) * 2.1));
	max-height: calc(100vh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px) - 2.5rem);
	max-height: calc(100svh - var(--he-sticky-chrome-top, 116px) - var(--dest-tax-nav-h, 56px) - 2.5rem);
	height: auto;
	transform: scale(calc(0.96 + var(--he-p, 1) * 0.04));
	clip-path: inset(calc((1 - var(--he-p, 1)) * 4%) 0);
}

html.he-alsace-motion .dest-engine-intro.is-pinned .dest-engine-film__media {
	transform: scale(calc(1.05 - var(--he-p, 1) * 0.05));
}

/* ── Addresses: a light shift on the three card photos ── */
html.he-alsace-motion .dest-addresses__photo.is-lead img {
	transform: translate3d(0, var(--he-shift, 0px), 0) scale(1.06);
}

/* ── Insider: lines slide in like entries in a ledger ── */
html.he-alsace-motion [data-he-reveal="ledger"] .dest-insider__row,
html.he-alsace-motion [data-he-reveal="ledger"] .dest-insider__text,
html.he-alsace-motion [data-he-reveal="ledger"] .dest-addresses__actions,
html.he-alsace-motion [data-he-reveal="ledger"] .dest-addresses__held {
	opacity: 0;
	transform: translate3d(1rem, 0, 0);
	transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
	transition-delay: calc(var(--he-i, 0) * 70ms);
}

html.he-alsace-motion [data-he-reveal="ledger"] .dest-insider__text {
	transition-delay: calc(var(--he-i, 0) * 70ms + 50ms);
}

html.he-alsace-motion [data-he-reveal="ledger"] .dest-addresses__actions,
html.he-alsace-motion [data-he-reveal="ledger"] .dest-addresses__held {
	transition-delay: calc(var(--he-i, 0) * 70ms + 90ms);
}

html.he-alsace-motion [data-he-reveal="ledger"].is-in .dest-insider__row,
html.he-alsace-motion [data-he-reveal="ledger"].is-in .dest-insider__text,
html.he-alsace-motion [data-he-reveal="ledger"].is-in .dest-addresses__actions,
html.he-alsace-motion [data-he-reveal="ledger"].is-in .dest-addresses__held {
	opacity: 1;
	transform: none;
}

/* ── Why Hilaire: the portrait sticks and each point underlines itself ── */
html.he-alsace-motion .dest-why-alsace__media {
	overflow: hidden;
}

html.he-alsace-motion .dest-why-alsace__media img {
	transform: translate3d(0, var(--he-shift, 0px), 0) scale(1.07);
}

html.he-alsace-motion .dest-why-alsace__points li {
	background-image: linear-gradient(#0a1b2a, #0a1b2a);
	background-repeat: no-repeat;
	background-position: left top;
	background-size: 0 1px;
	transition: background-size 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

html.he-alsace-motion .dest-why-alsace__points li.is-lit,
html.he-alsace-motion .dest-why-alsace__points li.is-read {
	background-size: 100% 1px;
}

@media (min-width: 901px) {
	html.he-alsace-motion .dest-why-alsace__grid {
		align-items: start;
	}

	html.he-alsace-motion .dest-why-alsace__media {
		position: sticky;
		top: calc(var(--he-sticky-chrome-top, 116px) + var(--dest-tax-nav-h, 56px) + 18px);
		align-self: start;
	}

	html.he-alsace-motion .dest-why-alsace__media img {
		width: 100%;
		height: min(70vh, 760px);
		aspect-ratio: auto;
		object-fit: cover;
	}
}

/* ── FAQ: the title and map stay while the questions pass ── */
@media (min-width: 780px) {
	html.he-alsace-motion .dest-faq-editorial {
		overflow: visible;
	}

	html.he-alsace-motion .dest-faq-editorial__copy {
		position: sticky;
		top: calc(var(--he-sticky-chrome-top, 116px) + var(--dest-tax-nav-h, 56px) + 18px);
		align-self: start;
	}
}

/* ── Proposal: chapters rise; the contact card clears the subnav ── */
@media (min-width: 1024px) {
	.dest-tax--alsace .request-proposal__sidebar-inner {
		top: calc(var(--he-sticky-chrome-top, 116px) + var(--dest-tax-nav-h, 56px) + 18px);
	}
}

/* ── Collection: each portrait drifts inside its frame ── */
html.he-alsace-motion .dest-collection__photo img {
	transform: translate3d(0, var(--he-shift, 0px), 0) scale(1.08);
}

/* ── Voyages: photographs drift inside the cards ── */
html.he-alsace-motion #voyages .journal-card__media {
	overflow: hidden;
}

html.he-alsace-motion #voyages .journal-card__img--hero {
	transform: translate3d(0, var(--he-shift, 0px), 0) scale(1.07);
}

/* ── Related: pictures slide sideways, each in its own direction ── */
html.he-alsace-motion .dest-related-alsace__link {
	overflow: hidden;
}

html.he-alsace-motion .dest-related-alsace__img {
	transform: translate3d(var(--he-drift, 0px), 0, 0) scale(1.08);
}

@media (prefers-reduced-motion: reduce) {
	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__img,
	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__media,
	.dest-tax--alsace .dest-editorial--alsace .dest-editorial__copy > * {
		animation: none;
		transform: none;
		clip-path: none;
		opacity: 1;
	}
}
