/**
 * Sliding Text — front-end styles.
 *
 * The loop works by laying out N copies of the same block of text in a row and
 * animating the whole row left by exactly one copy's width. When the animation
 * restarts, copy 2 is sitting precisely where copy 1 started, so the seam is
 * invisible and the text never runs out or snaps back.
 */

.sldtxt-bar {
	--sldtxt-bg: #dd3737;
	--sldtxt-fg: #ffffff;
	--sldtxt-height: 40px;
	--sldtxt-shift: 50%;
	--sldtxt-duration: 30s;

	background: var(--sldtxt-bg);
	color: var(--sldtxt-fg);
	width: 100%;
	height: var(--sldtxt-height);
	overflow: hidden;
	position: relative;
	box-sizing: border-box;
	z-index: 999;
}

.sldtxt-viewport {
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.sldtxt-track {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	width: max-content;
	height: 100%;
	will-change: transform;
	animation: sldtxt-scroll var(--sldtxt-duration) linear infinite;
}

.sldtxt-unit {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	white-space: nowrap;
	height: 100%;
	line-height: var(--sldtxt-height);
}

.sldtxt-text,
.sldtxt-sep {
	display: inline-block;
	white-space: nowrap;
	color: inherit;
}

.sldtxt-sep {
	padding: 0 1.6em;
	opacity: 0.6;
}

/* The WYSIWYG wraps content in paragraphs; flatten them onto one line. */
.sldtxt-text p {
	display: inline;
	margin: 0;
	padding: 0;
}

.sldtxt-text a {
	color: inherit;
	text-decoration: none;
}

.sldtxt-text a:hover,
.sldtxt-text a:focus {
	text-decoration: underline;
	color: inherit;
}

/* Neutralise theme list styling in case the editor produces a list. */
.sldtxt-text ul,
.sldtxt-text ol,
.sldtxt-text li {
	display: inline;
	margin: 0;
	padding: 0;
	list-style: none;
	background: none;
}

.sldtxt-pause-on-hover:hover .sldtxt-track {
	animation-play-state: paused;
}

@keyframes sldtxt-scroll {
	from {
		transform: translate3d(0, 0, 0);
	}
	to {
		transform: translate3d(calc(-1 * var(--sldtxt-shift)), 0, 0);
	}
}

/* Respect the visitor's motion preference: show the text, hold it still. */
@media (prefers-reduced-motion: reduce) {
	.sldtxt-track {
		animation: none;
		transform: none;
	}
}
