/* Content is visible unless JS safely prepares it below the viewport.
   The form, contact details and page titles remain steady. */
@keyframes aedPageSettle {
	from { transform: translateY(var(--aed-entry-distance, 10px)); }
	to { transform: none; }
}
@keyframes aedCardSettle {
	from { opacity: .88; translate: 0 var(--aed-entry-distance, 10px); }
	to { opacity: 1; translate: none; }
}
@keyframes aedPhotoSettle {
	from { transform: scale(1.018); }
	to { transform: none; }
}
@keyframes aedSectionPhotoSettle {
	from { transform: scale(1.028); }
	to { transform: none; }
}
@media screen and (prefers-reduced-motion: no-preference) {
	:is(.aed-about, .aed-services, .aed-contacts, .aed-projects) {
		--aed-entry-name: aedPageSettle;
		--aed-card-entry-name: aedCardSettle;
		--aed-photo-entry-name: aedPhotoSettle;
		--aed-entry-distance: 10px;
		--aed-entry-duration: 750ms;
		--aed-reveal-duration: 700ms;
		--aed-entry-easing: cubic-bezier(.22, .61, .36, 1);
	}
	:is(.aed-about-hero, .aed-svc-hero, .aed-svc-overview-opening,
		.aed-project-intro, .aed-project-hero-copy, .aed-project-hero > .aed-project-facts, .aed-project-tour-compact, .aed-project-cover, .aed-project-showcase-inner) {
		animation-name: var(--aed-entry-name);
		animation-duration: var(--aed-entry-duration);
		animation-timing-function: var(--aed-entry-easing);
		animation-fill-mode: backwards;
	}
	/* The opening catalogue row stays readable during its first-paint sequence. */
	.aed-svc-layout--overview .aed-svc-group:first-child .aed-svc-card,
	.aed-project-grid > li:nth-child(-n+3) > .aed-project-card {
		animation-name: var(--aed-card-entry-name);
		animation-duration: var(--aed-entry-duration);
		animation-timing-function: var(--aed-entry-easing);
		animation-delay: var(--aed-card-delay, 0ms);
		animation-fill-mode: backwards;
	}
	.aed-svc-group:first-child .aed-svc-card-item:nth-child(2) > .aed-svc-card { --aed-card-delay: 70ms; }
	.aed-svc-group:first-child .aed-svc-card-item:nth-child(3) > .aed-svc-card { --aed-card-delay: 140ms; }
	.aed-svc-group:first-child .aed-svc-card-item:nth-child(4) > .aed-svc-card { --aed-card-delay: 210ms; }
	.aed-project-grid > li:nth-child(2) > .aed-project-card { --aed-card-delay: 70ms; }
	.aed-project-grid > li:nth-child(3) > .aed-project-card { --aed-card-delay: 140ms; }
	.aed-about-hero-photo img {
		animation-name: var(--aed-photo-entry-name);
		animation-duration: 1100ms;
		animation-timing-function: var(--aed-entry-easing);
		animation-fill-mode: backwards;
	}
	html:has(:target) :is(.aed-about, .aed-services, .aed-contacts, .aed-projects),
	:is(.aed-about, .aed-services, .aed-contacts, .aed-projects).aed-page-motion-complete {
		--aed-entry-name: none;
		--aed-card-entry-name: none;
		--aed-photo-entry-name: none;
	}
	/* Separate translate from transform to preserve the existing card hovers. */
	:is(.aed-about, .aed-services, .aed-contacts, .aed-projects) .aed-motion-managed { animation: none !important; }
	:is(.aed-about, .aed-services, .aed-contacts, .aed-projects) .aed-motion-pending {
		opacity: 0;
		translate: 0 var(--aed-entry-distance);
	}
	:is(.aed-about, .aed-services, .aed-contacts, .aed-projects) .aed-motion-revealing {
		opacity: 1;
		translate: none;
		transition: opacity var(--aed-reveal-duration) var(--aed-entry-easing) var(--aed-reveal-delay, 0ms),
			translate var(--aed-reveal-duration) var(--aed-entry-easing) var(--aed-reveal-delay, 0ms),
			transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
	}
	/* Keep technical drawings steady while the surrounding photographs settle. */
	:is(.aed-svc-example-drawing, .aed-svc-example-visual, .aed-svc-capture-example, .aed-svc-application-figure) {
		--aed-entry-distance: 0px;
	}
	.aed-svc-interior-figure.aed-motion-image .aed-svc-interior-photo { overflow: clip; }
	:is(.aed-motion-image, .aed-svc-card, .aed-svc-related-card).aed-motion-revealing img {
		animation: aedSectionPhotoSettle 1000ms var(--aed-entry-easing) var(--aed-reveal-delay, 0ms) backwards;
	}
	@media (max-width: 800px) {
		:is(.aed-about, .aed-services, .aed-contacts, .aed-projects) {
			--aed-entry-distance: 6px;
			--aed-entry-duration: 600ms;
			--aed-reveal-duration: 600ms;
		}
		.aed-svc-group:first-child .aed-svc-card-item:nth-child(2) > .aed-svc-card { --aed-card-delay: 35ms; }
		.aed-svc-group:first-child .aed-svc-card-item:nth-child(3) > .aed-svc-card { --aed-card-delay: 70ms; }
		.aed-svc-group:first-child .aed-svc-card-item:nth-child(4) > .aed-svc-card { --aed-card-delay: 105ms; }
		.aed-project-grid > li:nth-child(2) > .aed-project-card { --aed-card-delay: 35ms; }
		.aed-project-grid > li:nth-child(3) > .aed-project-card { --aed-card-delay: 70ms; }
		.aed-about-hero-photo img,
		:is(.aed-motion-image, .aed-svc-card, .aed-svc-related-card).aed-motion-revealing img { animation: none; }
	}
}
