/* Update 69: smooth page changes on every page (site and the Motorit app).
   Browsers that support cross-document view transitions (Safari 18.2+, Chrome 126+)
   cross-fade from one page to the next instead of blanking. Others ignore this file.
   The page background colour sits on <html> so the gap between pages is never white or black. */

html {
	background-color: #f8fbfe;
}

@view-transition {
	navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
	animation-duration: 180ms;
	animation-timing-function: ease-out;
}

@media (prefers-reduced-motion: reduce) {
	@view-transition {
		navigation: none;
	}

	::view-transition-group(*),
	::view-transition-old(*),
	::view-transition-new(*) {
		animation: none !important;
	}
}

/* Update 70: the header and the bottom shortlist bar stay put while only the content cross-fades.
   Each name is used once per page (one .mgh1-header and at most one shortlist bar on every page). */
.mgh1-header {
	view-transition-name: motorit-header;
}

.motorit-buyer-shortlist-nav {
	view-transition-name: motorit-shortlist-nav;
}

/* Same place on every page: no sliding, and the new copy replaces the old one at once (no ghosting). */
::view-transition-group(motorit-header),
::view-transition-group(motorit-shortlist-nav) {
	animation: none;
}

::view-transition-old(motorit-header),
::view-transition-old(motorit-shortlist-nav) {
	display: none;
}

::view-transition-new(motorit-header),
::view-transition-new(motorit-shortlist-nav) {
	animation: none;
}

/* Update 70: thin brand-teal bar while the app holds the current page for the next one (smooth-nav.js). */
.motorit-nav-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 2147483000;
	height: 3px;
	background: #067b9d;
	transform: scaleX(0);
	transform-origin: 0 50%;
	opacity: 0;
	pointer-events: none;
}

.motorit-nav-progress.is-active {
	opacity: 1;
	transform: scaleX(0.85);
	transition: opacity 120ms linear, transform 1400ms cubic-bezier(0.1, 0.7, 0.2, 1);
}

/* Fallback where cross-document view transitions are not available (the head script adds the class only in the
   app, only after a same-site link, and never with reduced motion): fade the new page in instead of popping in. */
html.motorit-nav-fadein body {
	animation: motorit-page-in 160ms ease-out;
}

@keyframes motorit-page-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.motorit-nav-progress.is-active {
		transform: scaleX(1);
		opacity: 0.7;
		transition: none;
	}

	html.motorit-nav-fadein body {
		animation: none;
	}
}
