/**
 * WebSolex motion: reveal variants, hero entrance and count-up.
 *
 * Every hidden start state needs the .js class (set in header.php) and
 * prefers-reduced-motion: no-preference, so without JavaScript or with
 * reduced motion the content is simply shown. Only opacity, translate,
 * scale, clip-path and filter animate.
 *
 * Variants of [data-reveal] (main.js adds .is-visible on scroll):
 *   (no value)  rise 24 px (main.css, unchanged)
 *   left/right  slide in from that side
 *   scale       grow from 96 %
 *   clip        uncovered from the bottom up
 *   blur        fade from a soft blur (plain fade on phones)
 *
 * @package WebSolex
 */

@media (prefers-reduced-motion: no-preference) {
	.js [data-reveal='left'],
	.js [data-reveal='right'],
	.js [data-reveal='scale'],
	.js [data-reveal='clip'],
	.js [data-reveal='blur'] {
		transform: none;
		transition:
			opacity 0.7s var(--ease),
			translate 0.8s var(--ease),
			scale 0.7s var(--ease),
			clip-path 0.9s var(--ease),
			filter 0.7s var(--ease);
		transition-delay: var(--reveal-delay, 0s);
	}

	.js [data-reveal='left'] {
		translate: -40px 0;
	}

	.js [data-reveal='right'] {
		translate: 40px 0;
	}

	.js [data-reveal='scale'] {
		scale: 0.96;
	}

	.js [data-reveal='clip'] {
		opacity: 1;
		clip-path: inset(100% 0 0 0);
	}

	.js [data-reveal='blur'] {
		filter: blur(6px);
	}

	.js [data-reveal].is-visible {
		translate: none;
		scale: none;
		filter: none;
	}

	.js [data-reveal='clip'].is-visible {
		clip-path: inset(-10%);
	}
}

/* Phones: shorter slides, and no blur (cheaper to paint). */
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
	.js [data-reveal='left'] {
		translate: -20px 0;
	}

	.js [data-reveal='right'] {
		translate: 20px 0;
	}

	.js [data-reveal='blur'] {
		filter: none;
	}
}

/* ------------------------------------------------------- Hero entrance */
/* Plays once on load, about 1 s in total: badge, title lines, intro,
   buttons, then the statistics (which also count up) and the logos. */
@media (prefers-reduced-motion: no-preference) {
	.js .hero__inner > .badge,
	.js .hero__title-lead,
	.js .hero__title-main,
	.js .hero__intro,
	.js .hero__inner > .btn-row,
	.js .hero .clients,
	.js .hero__scroll {
		animation: wsx-rise 0.8s var(--ease) both;
	}

	.js .hero__title-lead {
		animation-delay: 0.08s;
	}

	.js .hero__title-main {
		animation-delay: 0.16s;
	}

	.js .hero__intro {
		animation-delay: 0.28s;
	}

	.js .hero__inner > .btn-row {
		animation-delay: 0.36s;
	}

	.js .hero .clients {
		animation-name: wsx-fade;
		animation-delay: 0.6s;
	}

	.js .hero__scroll {
		animation-name: wsx-fade;
		animation-delay: 0.8s;
	}

	.js .hero .stats__item[data-reveal] {
		transition-delay: calc(var(--reveal-delay, 0s) + 0.42s);
	}
}

@keyframes wsx-rise {
	from {
		opacity: 0;
		translate: 0 18px;
	}
}

@keyframes wsx-fade {
	from {
		opacity: 0;
	}
}

/* ----------------------------------------------------------- Count up */
.count-up {
	display: inline-block;
}

/* ------------------------------------------- Hero: changing service */
/* motion.js turns the blue part of the hero title into a fixed-size space
   (as wide as the longest service name) where the names take turns: the
   current one moves up a little and fades out, the next rises from below
   and goes from slightly blurred to sharp. Only shown with motion allowed. */
.rotator__line {
	white-space: nowrap;
}

.rotator__window {
	position: relative;
	display: inline-block;
	text-align: left;
}

.rotator__window--alone {
	text-align: center;
}

.rotator__sizer {
	visibility: hidden;
}

.rotator__word {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	opacity: 0;
	filter: blur(6px);
	translate: 0 0.55em;
	transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), translate 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.rotator__word.is-current {
	opacity: 1;
	filter: blur(0);
	translate: none;
}

.rotator__word.is-leaving {
	opacity: 0;
	filter: blur(4px);
	translate: 0 -0.45em;
}
