/**
 * Sticky Announcement Bar — Front-end styles.
 * Mobile-first: base rules target the smallest screens, then are refined
 * upward via min-width media queries for tablet (>=768px) and
 * desktop (>=1024px).
 */

.sab-bar {
	width: 100%;
	box-sizing: border-box;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.4;
	animation: sab-fade-in 0.25s ease-out;
}

.sab-bar * {
	box-sizing: border-box;
}

@keyframes sab-fade-in {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* --- Positioning behavior --- */

.sab-bar.sab-type-sticky.sab-position-top {
	position: sticky;
	top: 0;
}

.sab-bar.sab-type-sticky.sab-position-bottom {
	position: sticky;
	bottom: 0;
}

.sab-bar.sab-type-fixed.sab-position-top {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
}

.sab-bar.sab-type-fixed.sab-position-bottom {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
}

/* --- Inner layout ---
 * Row-based at every breakpoint (mobile-first) so the message text and
 * CTA button always share a single line — the text wraps/shrinks within
 * its own flexible column instead of pushing the button to a new row.
 */

.sab-bar-inner {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	padding: 8px 40px 8px 12px;
	position: relative;
	max-width: 1400px;
	margin: 0 auto;
	text-align: left;
}

.sab-bar-content {
	font-size: 12px;
	flex: 1 1 auto;
	min-width: 0; /* Allows the text column to actually shrink/wrap instead of overflowing. */
}

.sab-bar-content p {
	margin: 0;
}

/* --- Marquee (scrolling ticker) mode ---
 * Built with a doubled-content flex track animated via CSS, not the
 * deprecated <marquee> element. Only the text scrolls — the CTA button
 * and close button live outside this block as normal flex siblings.
 */
.sab-marquee-wrap {
	overflow: hidden;
	width: 100%;
	min-width: 0; /* Required so a flex child can actually shrink/clip. */
	flex: 1 1 auto;
}

.sab-has-marquee .sab-bar-inner {
	flex-wrap: nowrap;
}

.sab-marquee-track {
	display: flex;
	align-items: center;
	width: max-content;
	animation-duration: var( --sab-marquee-duration, 15s );
	animation-timing-function: linear;
	animation-iteration-count: infinite;
}

.sab-marquee-track.sab-marquee-left {
	animation-name: sab-marquee-scroll-left;
}

.sab-marquee-track.sab-marquee-right {
	animation-name: sab-marquee-scroll-right;
}

.sab-marquee-item {
	white-space: nowrap;
	padding-right: 48px;
	flex-shrink: 0;
}

.sab-marquee-item p {
	display: inline;
	white-space: nowrap;
}

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

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

.sab-marquee-pause-hover .sab-marquee-track:hover,
.sab-marquee-pause-hover .sab-marquee-track:focus-within {
	animation-play-state: paused;
}

/* Respect visitors who've asked the OS to reduce motion. */
@media ( prefers-reduced-motion: reduce ) {
	.sab-marquee-track {
		animation: none;
	}

	.sab-marquee-item[aria-hidden="true"] {
		display: none;
	}
}

.sab-bar-button {
	display: inline-block;
	flex-shrink: 0;
	padding: 5px 12px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: opacity 0.15s ease;
}

.sab-bar-button:hover,
.sab-bar-button:focus {
	opacity: 0.85;
	text-decoration: none;
}

.sab-bar-close {
	position: absolute;
	top: 50%;
	right: 8px;
	transform: translateY(-50%);
	background: transparent;
	border: none;
	color: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	opacity: 0.75;
}

.sab-bar-close:hover,
.sab-bar-close:focus {
	opacity: 1;
}

/* --- Device visibility toggles ---
 * Breakpoints: mobile < 768px, tablet 768–1023px, desktop >= 1024px.
 */
@media (max-width: 767px) {
	.sab-hide-mobile {
		display: none !important;
	}
}

@media (min-width: 768px) and (max-width: 1023px) {
	.sab-hide-tablet {
		display: none !important;
	}
}

@media (min-width: 1024px) {
	.sab-hide-desktop {
		display: none !important;
	}
}

/* --- Tablet and up: roomier spacing and type --- */
@media (min-width: 768px) {
	.sab-bar-inner {
		gap: 12px;
		padding: 10px 48px 10px 20px;
	}

	.sab-bar-content {
		font-size: 14px;
	}

	.sab-bar-button {
		padding: 6px 16px;
		font-size: 13px;
	}
}

/* --- Desktop refinements --- */
@media (min-width: 1024px) {
	.sab-bar-inner {
		padding: 12px 56px 12px 24px;
	}

	.sab-bar-content {
		font-size: 15px;
	}

	.sab-bar-button {
		font-size: 14px;
		padding: 7px 20px;
	}
}

/* --- Marquee bars run full-bleed (no centered max-width cap), matching
   the edge-to-edge look expected of a scrolling ticker. --- */
.sab-has-marquee .sab-bar-inner {
	max-width: none;
}

/* Utility class toggled by JS while the browser recalculates layout,
   preventing a flash of unstyled/overlapping content for fixed bars. */
.sab-bar.sab-preparing {
	visibility: hidden;
}
