/* UK Threat Level */

.utl {
	--utl-bg: #0f1720;
	--utl-fg: #e8edf2;
	--utl-muted: #93a1b0;
	--utl-off: #2a3644;
	position: relative;
	box-sizing: border-box;
	width: 100%;
	background: var(--utl-bg);
	color: var(--utl-fg);
	border-left: 6px solid var(--utl-colour);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.35;
	z-index: 50;
}

.utl *,
.utl *::before,
.utl *::after {
	box-sizing: border-box;
}

.utl a {
	color: inherit;
}

.utl__inner {
	display: flex;
	align-items: center;
	gap: 24px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 12px 20px;
}

/* ---------- Bar style ---------- */

.utl__current {
	display: flex;
	flex-direction: column;
	min-width: 190px;
}

.utl__eyebrow {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--utl-muted);
}

.utl__level {
	font-size: 24px;
	font-weight: 800;
	letter-spacing: 0.04em;
	color: var(--utl-colour);
	line-height: 1.1;
}

.utl__meaning {
	font-size: 13px;
	color: var(--utl-fg);
}

.utl__scale {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 4px;
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.utl__step {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin: 0;
	padding: 0;
	text-align: center;
	cursor: default;
}

.utl__step-bar {
	display: block;
	height: 8px;
	border-radius: 2px;
	background: var(--utl-off);
}

.utl__step--below .utl__step-bar {
	background: var(--utl-step);
	opacity: 0.45;
}

.utl__step--current .utl__step-bar {
	height: 12px;
	margin-top: -2px;
	margin-bottom: -2px;
	background: var(--utl-step);
	box-shadow: 0 0 10px var(--utl-step);
}

.utl__step-name {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--utl-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.utl__step--current .utl__step-name {
	color: var(--utl-fg);
}

.utl__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	font-size: 12px;
	color: var(--utl-muted);
	text-align: right;
	white-space: nowrap;
}

.utl__ni strong {
	margin-left: 4px;
	letter-spacing: 0.04em;
}

.utl__source a {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.utl__source a:hover,
.utl__source a:focus {
	color: var(--utl-fg);
}

/* ---------- Ticker style ---------- */

.utl--ticker .utl__inner {
	gap: 0;
	padding: 0;
	max-width: none;
}

.utl__badge {
	flex: 0 0 auto;
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 9px 16px;
	background: var(--utl-colour);
	color: #fff !important;
	text-decoration: none;
	font-weight: 700;
	white-space: nowrap;
}

.utl--substantial .utl__badge,
.utl--moderate .utl__badge {
	color: #111 !important;
}

.utl__badge-label {
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.85;
}

.utl__badge-level {
	font-size: 15px;
	letter-spacing: 0.06em;
}

.utl__ticker {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
	mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}

.utl__ticker-track {
	display: inline-flex;
	white-space: nowrap;
	animation: utl-scroll 40s linear infinite;
}

.utl__ticker:hover .utl__ticker-track,
.utl__ticker:focus-within .utl__ticker-track {
	animation-play-state: paused;
}

.utl__ticker-item {
	padding: 9px 3em 9px 1.5em;
	white-space: pre;
}

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

@media (prefers-reduced-motion: reduce) {
	.utl__ticker-track {
		animation: none;
	}
	.utl__ticker-item[aria-hidden="true"] {
		display: none;
	}
	.utl__ticker-item {
		white-space: normal;
	}
}

/* ---------- Dismiss ---------- */

.utl__close {
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	margin: 0 0 0 4px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--utl-muted);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.utl--ticker .utl__close {
	margin-right: 8px;
}

.utl__close:hover,
.utl__close:focus-visible {
	background: rgba(255, 255, 255, 0.1);
	color: var(--utl-fg);
}

.utl--stale .utl__source::after {
	content: " (cached)";
}

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
	.utl--bar .utl__inner {
		flex-wrap: wrap;
		gap: 10px 16px;
		padding: 12px 16px;
	}
	.utl--bar .utl__current {
		flex: 1 1 auto;
		min-width: 0;
	}
	.utl--bar .utl__meta {
		order: 2;
	}
	.utl--bar .utl__scale {
		order: 3;
		flex-basis: 100%;
	}
	.utl--bar .utl__close {
		position: absolute;
		top: 8px;
		right: 8px;
	}
	.utl--bar.utl--auto .utl__inner {
		padding-right: 44px;
	}
}

@media (max-width: 520px) {
	.utl__level {
		font-size: 20px;
	}
	.utl--bar .utl__meta {
		align-items: flex-start;
		text-align: left;
		flex-basis: 100%;
		order: 4;
	}
	.utl__scale {
		gap: 3px;
	}
	.utl__step-name {
		font-size: 8.5px;
		letter-spacing: 0;
		text-overflow: clip;
	}
	.utl__badge-label {
		display: none;
	}
}
