/*
 * Motion foundation. Loaded on every page, after main.css.
 *
 * Rules every animation on this site follows (docs/MOTION.md):
 *   - only `transform` and `opacity` move; nothing that changes layout
 *   - calm: no bounce, no spin, nothing longer than 0.9s
 *   - content is visible without JavaScript and with reduced motion
 *
 * Reveal on scroll: add data-reveal to an element. motion.js adds .is-in when
 * it enters the viewport. Values: (none) = rise, "fade", "left", "right",
 * "scale", "mask" (headings: wipe up from a clip).
 * Put data-reveal-group on a parent to stagger its data-reveal children.
 */
:root {
	--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
	--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
	--dur-fast: 0.2s;
	--dur: 0.45s;
	--dur-slow: 0.8s;
	--stagger: 70ms;
}

.js [data-reveal] {
	opacity: 0;
	transform: translate3d(0, 24px, 0);
	transition:
		opacity var(--dur-slow) var(--ease-out),
		transform var(--dur-slow) var(--ease-out),
		clip-path var(--dur-slow) var(--ease-out);
	transition-delay: calc(var(--i, 0) * var(--stagger));
}
.js [data-reveal="fade"] {
	transform: none;
}
.js [data-reveal="left"] {
	transform: translate3d(-32px, 0, 0);
}
.js [data-reveal="right"] {
	transform: translate3d(32px, 0, 0);
}
.js [data-reveal="scale"] {
	transform: scale(0.96);
	transform-origin: 50% 60%;
}
.js [data-reveal="mask"] {
	opacity: 1;
	transform: translate3d(0, 0.35em, 0);
	clip-path: inset(0 0 100% 0);
}
.js [data-reveal].is-in {
	opacity: 1;
	transform: none;
}
/* Once revealed, the clip sits well outside the box on every side, so it
   never cuts off a focus outline or a descender. */
.js [data-reveal="mask"].is-in {
	clip-path: inset(-20% -20% -20% -20%);
}

/* In one column things arrive one at a time as you scroll; a stagger on top
   of that only makes each item late. */
@media (max-width: 999px) {
	:root {
		--stagger: 0ms;
	}
}

@media (prefers-reduced-motion: reduce) {
	.js [data-reveal] {
		opacity: 1;
		transform: none;
		clip-path: none;
		transition: none;
	}
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
