.cmg-ticker {
	--cmg-bar-bg: #ffffff;
	--cmg-bar-border: rgba(0, 0, 0, .12);
	--cmg-bar-height: 46px;
	--cmg-label-bg: #0f5132;
	--cmg-label-color: #ffffff;
	--cmg-item-color: #1a1a1a;
	--cmg-item-hover: #0f5132;
	--cmg-bullet: rgba(0, 0, 0, .28);
	--cmg-item-gap: 44px;
	--cmg-duration: 30s;
	--cmg-distance: 0px;

	display: flex;
	align-items: stretch;
	overflow: hidden;
	min-height: var(--cmg-bar-height);
	background: var(--cmg-bar-bg);
	border: 1px solid var(--cmg-bar-border);
	box-sizing: border-box;
	max-width: 100%;
}

.cmg-ticker * {
	box-sizing: border-box;
}

.cmg-ticker__label {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	padding: 0 18px;
	background: var(--cmg-label-bg);
	color: var(--cmg-label-color);
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
}

.cmg-ticker__viewport {
	flex: 1 1 auto;
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	/* Layout maths stays LTR; each headline sets its own text direction. */
	direction: ltr;
	min-width: 0;
}

.cmg-ticker__track {
	display: flex;
	flex-wrap: nowrap;
	will-change: transform;
}

.cmg-ticker__group {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	flex: 0 0 auto;
}

.cmg-ticker__item {
	display: inline-flex;
	align-items: center;
	padding: 0 calc(var(--cmg-item-gap) / 2);
	color: var(--cmg-item-color);
	text-decoration: none;
	white-space: nowrap;
	line-height: 1.4;
	transition: color .18s ease;
}

/* Themes often style links inside the header with very specific selectors,
   which would otherwise repaint the headlines. These rules keep the colour
   under the control of the ticker's own variables. */
.cmg-ticker .cmg-ticker__item,
.cmg-ticker a.cmg-ticker__item,
.cmg-ticker a.cmg-ticker__item:visited,
.cmg-ticker a.cmg-ticker__item:link {
	color: var(--cmg-item-color) !important;
	text-decoration: none !important;
	background: none !important;
	box-shadow: none !important;
}

.cmg-ticker a.cmg-ticker__item:hover,
.cmg-ticker a.cmg-ticker__item:focus,
.cmg-ticker a.cmg-ticker__item:focus-visible {
	color: var(--cmg-item-hover) !important;
	text-decoration: none !important;
}

.cmg-ticker .cmg-ticker__label {
	color: var(--cmg-label-color) !important;
}

.cmg-ticker__item:hover,
.cmg-ticker__item:focus-visible {
	color: var(--cmg-item-hover);
	text-decoration: none;
}

.cmg-ticker__item:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Dot separator between headlines */
.cmg-ticker__item + .cmg-ticker__item::before,
.cmg-ticker__group + .cmg-ticker__group .cmg-ticker__item:first-child::before {
	content: "";
	display: block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--cmg-bullet);
	margin-inline-end: calc(var(--cmg-item-gap) / 2);
	margin-inline-start: calc(var(--cmg-item-gap) / -4);
	flex: 0 0 auto;
}

/* RTL mode: only the text direction flips, the layout stays LTR. */
.cmg-ticker--rtl {
	flex-direction: row-reverse;
}

.cmg-ticker--rtl .cmg-ticker__item {
	direction: rtl;
	unicode-bidi: isolate;
	text-align: right;
	/* Nastaliq needs extra vertical room or its descenders get clipped. */
	line-height: 1.9;
	padding-top: 2px;
	padding-bottom: 2px;
}

/* The animation only runs once JS has measured the track width. */
.cmg-ticker.is-ready .cmg-ticker__track {
	animation-name: cmg-ticker-scroll;
	animation-duration: var(--cmg-duration);
	animation-timing-function: linear;
	animation-iteration-count: infinite;
}

.cmg-ticker.is-ready[data-direction="right"] .cmg-ticker__track {
	animation-direction: reverse;
}

.cmg-ticker--pause.is-ready:hover .cmg-ticker__track,
.cmg-ticker--pause.is-ready:focus-within .cmg-ticker__track {
	animation-play-state: paused;
}

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

/* Headlines stay readable if JavaScript is unavailable */
.cmg-ticker:not(.is-ready) .cmg-ticker__viewport {
	overflow-x: auto;
	scrollbar-width: none;
}

.cmg-ticker:not(.is-ready) .cmg-ticker__viewport::-webkit-scrollbar {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.cmg-ticker.is-ready .cmg-ticker__track {
		animation: none;
	}
	.cmg-ticker.is-ready .cmg-ticker__viewport {
		overflow-x: auto;
	}
	.cmg-ticker__group--clone {
		display: none;
	}
}

@media (max-width: 600px) {
	.cmg-ticker {
		--cmg-bar-height: 40px;
		--cmg-item-gap: 30px;
	}
	.cmg-ticker__label {
		padding: 0 12px;
		font-size: .9em;
	}
}

/* Notice shown to administrators only */
.cmg-ticker--notice {
	display: block;
	padding: 10px 14px;
	background: #fff8e5;
	border: 1px solid #f0c36d;
	color: #6b4e00;
	font-size: 14px;
}
