/**
 * Scroll-driven motion layer.
 *
 * Native CSS scroll timelines are the primary experience.
 * Unsupported browsers receive the complete static page.
 */

@media (prefers-reduced-motion: no-preference) {
	@keyframes paez-hero-in {
		from {
			opacity: 0;
			translate: 0 40px;
		}
		to {
			opacity: 1;
			translate: 0 0;
		}
	}

	@keyframes paez-title-reveal {
		from {
			opacity: 0;
			clip-path: inset(0 0 100% 0);
			translate: 0 36px;
		}
		to {
			opacity: 1;
			clip-path: inset(0);
			translate: 0 0;
		}
	}

	@keyframes paez-reveal-up {
		from {
			opacity: 0;
			translate: 0 70px;
			scale: 0.96;
		}
		to {
			opacity: 1;
			translate: 0 0;
			scale: 1;
		}
	}

	@keyframes paez-reveal-left {
		from {
			opacity: 0;
			translate: -64px 0;
		}
		to {
			opacity: 1;
			translate: 0 0;
		}
	}

	@keyframes paez-reveal-right {
		from {
			opacity: 0;
			translate: 64px 0;
		}
		to {
			opacity: 1;
			translate: 0 0;
		}
	}

	@keyframes paez-reveal-scale {
		from {
			opacity: 0;
			translate: 0 48px;
			scale: 0.9;
		}
		to {
			opacity: 1;
			translate: 0 0;
			scale: 1;
		}
	}

	@keyframes paez-mask-reveal {
		from {
			opacity: 0;
			clip-path: inset(0 0 100% 0);
			scale: 1.08;
		}
		to {
			opacity: 1;
			clip-path: inset(0);
			scale: 1;
		}
	}

	@keyframes paez-watermark {
		from {
			transform: translate3d(8%, -50%, 0);
		}
		to {
			transform: translate3d(-18%, -50%, 0);
		}
	}

	@keyframes paez-progress {
		from {
			transform: scaleX(0);
		}
		to {
			transform: scaleX(1);
		}
	}

	@keyframes paez-header-shadow {
		to {
			box-shadow: 0 22px 52px rgba(5, 42, 61, 0.16);
		}
	}

	@keyframes paez-hero-parallax {
		to {
			transform: translate3d(0, 56px, 0) scale(1.1);
		}
	}

	@keyframes paez-line-grow {
		from {
			transform: scaleX(0);
		}
		to {
			transform: scaleX(1);
		}
	}

	.hero-in {
		animation: paez-hero-in 1000ms cubic-bezier(0.16, 1, 0.3, 1) both;
	}

	.hero-in--delay {
		animation-delay: 160ms;
	}

	@supports ((animation-timeline: view()) and (animation-range: entry)) {
		[data-reveal] {
			animation: paez-reveal-up 1ms linear both;
			animation-timeline: view(block);
			animation-range: entry 5% cover 38%;
		}

		[data-reveal="left"] {
			animation-name: paez-reveal-left;
		}

		[data-reveal="right"] {
			animation-name: paez-reveal-right;
		}

		.procedure-row[data-reveal]:nth-child(odd) {
			animation-name: paez-reveal-left;
		}

		.procedure-row[data-reveal]:nth-child(even) {
			animation-name: paez-reveal-right;
		}

		.procedure-card[data-reveal],
		.case-card[data-reveal],
		.blog-card[data-reveal],
		.related-card[data-reveal],
		.doctor-clinic__grid figure[data-reveal] {
			animation-name: paez-reveal-scale;
		}

		[data-reveal] h1,
		[data-reveal] h2 {
			animation: paez-title-reveal 1ms linear both;
			animation-timeline: view(block);
			animation-range: entry 3% cover 30%;
		}

		.home-doctor__image,
		.home-3d__viewer,
		.case-card__media,
		.blog-card__media img,
		.doctor-clinic__grid img {
			animation: paez-mask-reveal 1ms linear both;
			animation-timeline: view(block);
			animation-range: entry 5% cover 42%;
		}

		.home-3d__watermark {
			animation: paez-watermark 1ms linear both;
			animation-timeline: view(block);
			animation-range: cover 0% cover 100%;
		}

		.timeline-grid::before {
			animation: paez-line-grow 1ms linear both;
			animation-timeline: view(block);
			animation-range: entry 12% cover 32%;
		}

		@media (max-width: 768px) {
			[data-reveal="left"],
			[data-reveal="right"],
			.procedure-row[data-reveal]:nth-child(odd),
			.procedure-row[data-reveal]:nth-child(even) {
				animation-name: paez-reveal-up;
			}
		}
	}

	@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
		.progress-bar {
			display: block !important;
			animation: paez-progress 1ms linear both;
			animation-timeline: scroll(root block);
			animation-range: 0% 100%;
		}

		.site-header {
			animation: paez-header-shadow 1ms linear both;
			animation-timeline: scroll(root block);
			animation-range: 0 180px;
		}

		.home-hero__image {
			animation: paez-hero-parallax 1ms linear both;
			animation-timeline: scroll(root block);
			animation-range: 0 700px;
		}
	}
}

.progress-bar {
	position: fixed;
	top: 0;
	right: 0;
	left: 0;
	z-index: 300;
	display: none;
	height: 2px;
	background: var(--paez-blue);
	transform-origin: 0 50%;
}

@media (prefers-reduced-motion: reduce) {
	.hero-in,
	[data-reveal],
	[data-reveal] h1,
	[data-reveal] h2,
	.home-hero__image,
	.home-doctor__image,
	.home-3d__viewer,
	.case-card__media,
	.blog-card__media img,
	.doctor-clinic__grid img,
	.progress-bar,
	.timeline-grid::before {
		animation: none !important;
		opacity: 1 !important;
		translate: none !important;
		transform: none !important;
		scale: none !important;
		clip-path: none !important;
	}

	.home-3d__watermark {
		animation: none !important;
		transform: translate3d(8%, -50%, 0) !important;
	}
}
