/*
 * Scroll animations (modules/animate.php). Hidden only once the head script has marked the page as able to
 * show them again; each plays once when it comes into view. .kc-anim-preview is the editor's replay.
 *
 * The dials, all in one place:
 *   --kc-anim-rise       how far it travels up
 *   --kc-anim-time       how long it takes
 *   --kc-anim-fade-ease  the fade's curve (slow to start, so it eases in from fully clear)
 *   --kc-anim-move-ease  the movement's curve (quick off the mark, settling softly)
 */
:root {
	--kc-anim-rise: 72px;
	--kc-anim-time: 1.4s;
	--kc-anim-fade-ease: cubic-bezier(0.45, 0, 0.55, 1);
	--kc-anim-move-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Where each one waits until it scrolls into view. */
.kc-anim-js .kc-anim--fade-up:not(.is-in),
.kc-anim-js .kc-anim--fade:not(.is-in),
.kc-anim-js .kc-anim--grow:not(.is-in) {
	opacity: 0;
}
.kc-anim-js .kc-anim--up:not(.is-in) {
	transform: translateY(var(--kc-anim-rise));
}

.kc-anim.is-in,
.kc-anim-preview {
	animation-duration: var(--kc-anim-time);
	animation-fill-mode: both;
}

/* Fade up: the fade and the rise run side by side, each on its own curve. */
.kc-anim--fade-up.is-in,
.kc-anim--fade-up.kc-anim-preview {
	animation-name: kc-fade, kc-rise;
	animation-timing-function: var(--kc-anim-fade-ease), var(--kc-anim-move-ease);
}

/* Fade: only the fade, in place. */
.kc-anim--fade.is-in,
.kc-anim--fade.kc-anim-preview {
	animation-name: kc-fade;
	animation-timing-function: var(--kc-anim-fade-ease);
}

/* Slide up: only the rise, fully visible the whole way. */
.kc-anim--up.is-in,
.kc-anim--up.kc-anim-preview {
	animation-name: kc-rise;
	animation-timing-function: var(--kc-anim-move-ease);
}

/* Grow (lines only): stretches out from its middle to its full width, fading in as it goes. */
.kc-anim--grow.is-in,
.kc-anim--grow.kc-anim-preview {
	animation-name: kc-fade, kc-grow;
	animation-timing-function: var(--kc-anim-fade-ease), var(--kc-anim-move-ease);
}

@keyframes kc-grow {
	from { transform: scaleX(0); }
	to   { transform: none; }
}

@keyframes kc-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes kc-rise {
	from { transform: translateY(var(--kc-anim-rise)); }
	to   { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.kc-anim-js .kc-anim:not(.is-in) { opacity: 1; transform: none; }
	.kc-anim.is-in, .kc-anim-preview { animation: none; }
}
