/**
 * Motion utility classes (see includes/motion.php).
 */

/* Entrance: hidden until the "animate-in" module marks the block as visible, then plays once. */
@media (prefers-reduced-motion: no-preference) {
	[class*="agma-fade-in-"]:not(.is-visible) {
		visibility: hidden;
	}

	.agma-fade-in-left.is-visible {
		animation: agma-fade-in-left 1.25s both;
	}

	.agma-fade-in-right.is-visible {
		animation: agma-fade-in-right 1.25s both;
	}

	.agma-fade-in-up.is-visible {
		animation: agma-fade-in-up 1.25s both;
	}
}

@keyframes agma-fade-in-left {
	from {
		opacity: 0;
		transform: translate3d(-100%, 0, 0);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes agma-fade-in-right {
	from {
		opacity: 0;
		transform: translate3d(100%, 0, 0);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes agma-fade-in-up {
	from {
		opacity: 0;
		transform: translate3d(0, 100%, 0);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* Scroll motion: 120px each way while the block crosses the viewport. */
@supports (animation-timeline: view()) {
	@media (prefers-reduced-motion: no-preference) {
		.agma-scroll-up,
		.agma-scroll-down {
			animation: linear both;
			animation-timeline: view();
			animation-range: cover 20% cover 80%;
		}

		.agma-scroll-up {
			animation-name: agma-scroll-up;
		}

		.agma-scroll-down {
			animation-name: agma-scroll-down;
		}

		.agma-scroll-range-narrow {
			animation-range: cover 35% cover 60%;
		}

		.agma-scroll-range-late {
			animation-range: cover 35% cover 75%;
		}
	}
}

@keyframes agma-scroll-up {
	from {
		translate: 0 120px;
	}

	to {
		translate: 0 -120px;
	}
}

@keyframes agma-scroll-down {
	from {
		translate: 0 -120px;
	}

	to {
		translate: 0 120px;
	}
}
