/* ============================================================
   Page transitions - a gentle cross-fade between pages.

   Uses the native cross-document View Transitions API: on same-site
   navigation the outgoing page fades out and the incoming one fades in,
   with the same easing as the scroll-reveal so the two read as one calm
   design language. Deliberately a pure fade (no movement) - the incoming
   page's own scroll-reveal owns the upward "rise", so they never double up.

   Progressive enhancement: browsers without the API simply navigate as
   normal (the @view-transition rule is ignored) - nothing breaks. Honours
   reduced-motion by swapping instantly.
   ============================================================ */

@view-transition {
	navigation: auto;
}

/* Calm cross-fade, matched to the reveal's duration feel and easing. */
::view-transition-old(root) {
	animation: littledale-page-out 0.4s var(--reveal-ease, ease) both;
}

::view-transition-new(root) {
	animation: littledale-page-in 0.45s var(--reveal-ease, ease) both;
}

@keyframes littledale-page-out {
	to {
		opacity: 0;
	}
}

@keyframes littledale-page-in {
	from {
		opacity: 0;
	}
}

/* Keep the fixed header OUT of the cross-fade. It is a persistent shell, not
   page content, so it must never fade or blink on navigation. Lifting it into
   its own named transition group removes it from the root snapshot; holding the
   incoming (destination) header at full opacity - with no animation on either
   snapshot - means it simply stays put while the body content cross-fades
   underneath it. (Without this, leaving the homepage - whose header is
   transparent over the hero - blended transparent -> solid on every navigation.) */
.site-header {
	view-transition-name: site-header;
}

::view-transition-group(site-header) {
	animation: none;
}

::view-transition-old(site-header) {
	animation: none;
	opacity: 0;
}

::view-transition-new(site-header) {
	animation: none;
	opacity: 1;
}

/* Reduced-motion: swap instantly, no fade. */
@media (prefers-reduced-motion: reduce) {
	::view-transition-old(root),
	::view-transition-new(root) {
		animation: none !important;
	}
}
