/* TBB News Banner — matches tbb-forums (#45a0ab) */
:root {
	--tbb-nb-bg: #45a0ab;
	--tbb-nb-bg-hover: #3d8e98;
	--tbb-nb-text: #ffffff;
	--tbb-nb-height: 96px;
	--tbb-nb-offset-top: 0px;
	--tbb-nb-total-offset: 96px;
	--tbb-nb-pad-x: clamp(28px, 5vw, 52px);
	--tbb-nb-pad-y: 16px;
	--tbb-nb-thumb: 64px;
}

/* Do not pad body — that shows as a white band above the fixed banner */
html.tbb-news-banner-active,
body.tbb-news-banner-active {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

body.tbb-news-banner-active:not(.tbb-news-banner-dismissed) #page,
body.tbb-news-banner-active:not(.tbb-news-banner-dismissed) .site-content,
body.tbb-news-banner-active:not(.tbb-news-banner-dismissed) #masthead {
	margin-top: 0;
}

body.tbb-news-banner-active:not(.tbb-news-banner-dismissed) #page {
	padding-top: var(--tbb-nb-total-offset);
}

.tbb-news-banner {
	position: fixed;
	top: var(--tbb-nb-offset-top);
	left: 0;
	right: 0;
	z-index: 99998;
	margin: 0;
	padding: 0;
	border: none;
	box-sizing: border-box;
	min-height: var(--tbb-nb-height);
	background: var(--tbb-nb-bg);
	color: var(--tbb-nb-text);
	font-family: inherit;
	font-size: 1.0625rem;
	line-height: 1.4;
	box-shadow: 0 2px 8px rgba(69, 160, 171, 0.35);
}

body.tbb-news-banner-dismissed .tbb-news-banner {
	display: none;
}

.tbb-news-banner__inner {
	position: relative;
	display: flex;
	align-items: center;
	gap: 18px;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: var(--tbb-nb-pad-y) var(--tbb-nb-pad-x);
	padding-right: calc(var(--tbb-nb-pad-x) + 48px);
	box-sizing: border-box;
}

.tbb-news-banner__label {
	flex: 0 0 auto;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 0.8125rem;
	white-space: nowrap;
	padding: 0 8px 0 4px;
	align-self: center;
}

.tbb-news-banner__track {
	flex: 1 1 auto;
	min-width: 0;
	position: relative;
	display: flex;
	align-items: center;
	padding: 0 8px;
}

.tbb-news-banner__item {
	display: none;
	align-items: center;
	gap: 14px;
	width: 100%;
	min-width: 0;
	color: inherit;
	text-decoration: none;
	padding: 6px 8px;
	border-radius: 8px;
	transition: background 0.2s ease;
}

.tbb-news-banner__item.is-active {
	display: flex;
}

.tbb-news-banner__item:hover,
.tbb-news-banner__item:focus-visible {
	color: var(--tbb-nb-text);
	text-decoration: none;
	background: rgba(255, 255, 255, 0.08);
	outline: none;
}

.tbb-news-banner__item:hover .tbb-news-banner__title,
.tbb-news-banner__item:focus-visible .tbb-news-banner__title {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tbb-news-banner__media {
	flex: 0 0 auto;
	line-height: 0;
}

.tbb-news-banner__thumb {
	display: block;
	width: var(--tbb-nb-thumb);
	height: var(--tbb-nb-thumb);
	border-radius: 8px;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.25);
}

.tbb-news-banner__thumb--fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 1.375rem;
	text-transform: uppercase;
	color: var(--tbb-nb-text);
}

.tbb-news-banner__body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	justify-content: center;
}

.tbb-news-banner__meta {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.tbb-news-banner__type {
	flex: 0 0 auto;
	padding: 5px 12px;
	border-radius: 5px;
	background: rgba(255, 255, 255, 0.22);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.tbb-news-banner__title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.35;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tbb-news-banner__excerpt {
	display: block;
	font-size: 0.9375rem;
	line-height: 1.35;
	opacity: 0.92;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tbb-news-banner__dismiss {
	position: absolute;
	top: 50%;
	right: max(16px, env(safe-area-inset-right));
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 5px;
	background: transparent;
	color: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.9;
	transition: background 0.2s ease, opacity 0.2s ease;
}

.tbb-news-banner__dismiss:hover,
.tbb-news-banner__dismiss:focus-visible {
	background: var(--tbb-nb-bg-hover);
	opacity: 1;
	outline: none;
}

/* Astra sticky header sits below banner + admin bar */
body.tbb-news-banner-active:not(.tbb-news-banner-dismissed) .ast-primary-header-bar,
body.tbb-news-banner-active:not(.tbb-news-banner-dismissed) #ast-fixed-header,
body.tbb-news-banner-active:not(.tbb-news-banner-dismissed) .ast-header-sticky-active .ast-primary-header-bar {
	top: var(--tbb-nb-total-offset) !important;
}

@media (max-width: 768px) {
	:root {
		--tbb-nb-pad-x: 20px;
		--tbb-nb-pad-y: 14px;
		--tbb-nb-height: 104px;
		--tbb-nb-thumb: 52px;
	}

	.tbb-news-banner {
		font-size: 0.9375rem;
	}

	.tbb-news-banner__inner {
		flex-wrap: wrap;
		align-items: flex-start;
		gap: 10px 12px;
		padding-right: calc(var(--tbb-nb-pad-x) + 52px);
	}

	.tbb-news-banner__label {
		width: 100%;
		padding: 0 4px;
	}

	.tbb-news-banner__track {
		width: 100%;
		padding: 0 2px;
	}

	.tbb-news-banner__item {
		align-items: flex-start;
		gap: 10px;
		padding: 2px 4px;
	}

	.tbb-news-banner__meta {
		flex-wrap: wrap;
		align-items: flex-start;
		gap: 6px 8px;
	}

	.tbb-news-banner__title {
		flex: 1 1 100%;
		font-size: 1rem;
		white-space: normal;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		line-clamp: 2;
	}

	.tbb-news-banner__excerpt {
		white-space: normal;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		font-size: 0.875rem;
	}

	.tbb-news-banner__dismiss {
		width: 44px;
		height: 44px;
		right: max(12px, env(safe-area-inset-right));
	}
}

@media (max-width: 480px) {
	:root {
		--tbb-nb-pad-x: 16px;
		--tbb-nb-pad-y: 12px;
		--tbb-nb-height: 108px;
		--tbb-nb-thumb: 48px;
	}

	.tbb-news-banner__title {
		font-size: 1rem;
		-webkit-line-clamp: 2;
		line-clamp: 2;
	}

	.tbb-news-banner__excerpt {
		font-size: 0.8125rem;
		-webkit-line-clamp: 2;
		line-clamp: 2;
	}

	.tbb-news-banner__type {
		font-size: 0.6875rem;
		padding: 4px 10px;
	}
}
