/*
 * vectornews-core: news ticker (block vectornews/ticker, shortcode [vn_ticker]).
 * Enqueued only when a ticker renders. Speed comes from the --vn-ticker-speed custom property that
 * PHP sets inline on .vn-ticker; the keyframes are defined once here.
 */
.vn-ticker {
	--vn-ticker-speed: 25s;
	--vn-ticker-accent: #ff4d4f;
	position: relative;
	overflow: hidden;
	box-sizing: border-box;
	border: 1px solid #e6e6e6;
	border-radius: 12px;
	background: #fff;
	color: #111;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	line-height: 1.4;
}

.vn-ticker__header {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 10px 12px;
	font-weight: 700;
	color: #fff;
	background: var(--vn-ticker-accent);
	border-bottom: 1px solid var(--vn-ticker-accent);
}

.vn-ticker__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	line-height: 1;
}

.vn-ticker__track {
	display: flex;
	align-items: center;
	width: max-content;
	min-height: 60px;
	white-space: nowrap;
	will-change: transform;
	animation: vn-ticker-scroll var(--vn-ticker-speed) linear infinite;
}

/* Two identical rows; the track moves by exactly one row (-50%), so the loop has no visible jump. */
.vn-ticker__row {
	display: inline-flex;
	align-items: center;
	gap: 24px;
	padding: 10px 12px;
}

.vn-ticker__item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.vn-ticker__item::before {
	content: "";
	flex: none;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #d33;
}

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

.vn-ticker__item a:hover,
.vn-ticker__item a:focus {
	text-decoration: underline;
}

/* Fallback line: feed unreachable with nothing cached, or a query with no news. */
.vn-ticker__track--static {
	width: auto;
	padding: 10px 12px;
	white-space: normal;
	animation: none;
}

.vn-ticker__item--message::before {
	content: none;
}

@keyframes vn-ticker-scroll {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(-50%);
	}
}

/* Hover pauses (pointer devices only, as in the old theme); keyboard focus inside pauses too. */
@media (hover: hover) {
	.vn-ticker:hover .vn-ticker__track {
		animation-play-state: paused;
	}
}

.vn-ticker:focus-within .vn-ticker__track {
	animation-play-state: paused;
}

/* Reduced motion: no animation, the strip wraps, the duplicate row disappears. */
@media (prefers-reduced-motion: reduce) {
	.vn-ticker__track {
		width: auto;
		white-space: normal;
		animation: none;
	}

	.vn-ticker__row {
		flex-wrap: wrap;
		row-gap: 8px;
	}

	.vn-ticker__row[aria-hidden="true"] {
		display: none;
	}
}
