/**
 * Homepage "News Corner" ticker (template-parts/news-ticker.php).
 *
 * A black strip under the hero: a gold label on the leading edge and the
 * latest headlines scrolling past it, separated by dots. The track holds
 * the list twice and slides by one copy's width, so the loop is seamless.
 * It pauses while hovered or while a headline has keyboard focus, runs
 * the other way in right-to-left languages, and becomes a plain
 * swipeable row for visitors who ask for reduced motion.
 *
 * Colours come from the theme's palette (style.min.css :root) -- the
 * gold is --yellow, its hover --lyellow.
 */

.un-news-ticker {
	--un-ticker-bg: #000;
	--un-ticker-gap: 30px;
	display: flex;
	align-items: stretch;
	gap: 20px;
	margin-block-start: 10px;
	padding: 7px 10px;
	background: var(--un-ticker-bg);
	overflow: hidden;
}

.un-news-ticker__label {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	min-height: 42px;
	padding: 0 20px;
	background: var(--yellow, #ddb14d);
	color: #fff;
	font-size: 16px;
	font-weight: 500;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	/* Sits above the headlines scrolling in behind it. */
	position: relative;
	z-index: 1;
}

.un-news-ticker__label:hover,
.un-news-ticker__label:focus-visible {
	background: var(--lyellow, #e8ca59);
	color: #fff;
}

.un-news-ticker__viewport {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	overflow: hidden;
}

.un-news-ticker__track {
	display: flex;
	width: max-content;
	animation: un-news-ticker-scroll var(--un-ticker-duration, 60s) linear infinite;
}

.un-news-ticker:hover .un-news-ticker__track,
.un-news-ticker:focus-within .un-news-ticker__track {
	animation-play-state: paused;
}

.un-news-ticker__list {
	display: flex;
	flex-shrink: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.un-news-ticker__item {
	display: flex;
	align-items: center;
	white-space: nowrap;
}

/* The dot after every headline, including the last, so the join between
   the two copies looks like every other gap. */
.un-news-ticker__item::after {
	content: "\2022";
	margin-inline: calc(var(--un-ticker-gap) / 2);
	color: var(--yellow, #ddb14d);
	font-size: 12px;
}

.un-news-ticker__item a {
	color: var(--yellow, #ddb14d);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
}

.un-news-ticker__item a:hover,
.un-news-ticker__item a:focus-visible {
	color: var(--lyellow, #e8ca59);
	text-decoration: underline;
	text-underline-offset: 4px;
}

@keyframes un-news-ticker-scroll {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-50%);
	}
}

/* Right-to-left: the list starts at the right edge, so it scrolls right. */
@keyframes un-news-ticker-scroll-rtl {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(50%);
	}
}

[dir="rtl"] .un-news-ticker__track {
	animation-name: un-news-ticker-scroll-rtl;
}

@media (max-width: 767.98px) {
	.un-news-ticker {
		--un-ticker-gap: 22px;
		gap: 12px;
		padding: 6px 8px;
	}

	.un-news-ticker__label {
		min-height: 36px;
		padding: 0 12px;
		font-size: 13px;
	}

	.un-news-ticker__item a {
		font-size: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.un-news-ticker__viewport {
		overflow-x: auto;
		scrollbar-width: none;
	}

	.un-news-ticker__viewport::-webkit-scrollbar {
		display: none;
	}

	.un-news-ticker__track {
		animation: none;
	}

	.un-news-ticker__list[aria-hidden="true"] {
		display: none;
	}
}
