/*
 * "Ready to Take Your Brand to the Next Level" band on the four service pages.
 *
 * Same animation as the Home page CTA (assets/css/base.css, assets/js/text-reveal.js):
 * - heading: every letter rises 20 px and fades in over 0.5 s, 0.04 s after the previous
 *   one, started when 30% of the heading is visible;
 * - text and button: Elementor's fadeInUp (1.25 s, from 100% of their own height),
 *   started when they enter the viewport. Each plays once.
 *
 * Only applies inside .toposel-home-cta (printed by templates/parts/cta.php for the
 * service pages). The heading is hidden only while html.tsv-js is set (supported browser,
 * no reduced-motion request) and always appears after 3 s at the latest; the text and
 * button are hidden only after the script has marked them ready, so without JavaScript
 * everything is simply visible.
 */

html.tsv-js .toposel-home-cta [data-tsl-reveal]:not(.tsl-reveal-ready) {
	opacity: 0;
	animation: toposel-cta-failsafe 0s linear 3s forwards;
}

.toposel-home-cta .tsl-reveal-word,
.toposel-home-cta .tsl-reveal-char {
	display: inline-block;
}

.toposel-home-cta .tsl-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Letters wait hidden until the heading is told to run. */
.toposel-home-cta .tsl-reveal-ready:not(.tsl-reveal-done) .tsl-reveal-char {
	opacity: 0;
	transform: translateY(20px);
}

.toposel-home-cta .tsl-reveal-run .tsl-reveal-word,
.toposel-home-cta .tsl-reveal-run .tsl-reveal-char {
	animation: toposel-cta-char-up 0.5s forwards;
}

.toposel-home-cta .tsl-reveal-run .tsl-reveal-char {
	animation-delay: calc(var(--tsl-i) * 0.04s);
}

@keyframes toposel-cta-char-up {
	from {
		opacity: 0;
		transform: translateY(20px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes toposel-cta-failsafe {
	to {
		opacity: 1;
	}
}

.toposel-home-cta [data-tsl-fade].tsl-fade-ready {
	opacity: 0;
}

.toposel-home-cta [data-tsl-fade].tsl-fade-ready.tsl-fade-in {
	opacity: 1;
	animation: toposel-cta-fade-in-up 1.25s both;
}

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

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

@media (prefers-reduced-motion: reduce) {
	html.tsv-js .toposel-home-cta [data-tsl-reveal]:not(.tsl-reveal-ready),
	.toposel-home-cta [data-tsl-fade].tsl-fade-ready,
	.toposel-home-cta [data-tsl-fade].tsl-fade-ready.tsl-fade-in {
		opacity: 1;
		animation: none;
	}

	.toposel-home-cta .tsl-reveal-char,
	.toposel-home-cta .tsl-reveal-word,
	.toposel-home-cta .tsl-reveal-run .tsl-reveal-char,
	.toposel-home-cta .tsl-reveal-run .tsl-reveal-word {
		opacity: 1;
		transform: none;
		animation: none;
	}
}
