/*
 * Announcement bar styles (sc_announcement_bar).
 *
 * Replaces the child theme's inline wp_head block, which set
 * `background-color: transparent !important` on nearly every rule and left
 * the actual colour to whatever container the shortcode landed in. This
 * paints its own surface from the shared tokens in sc-ticket-shared.css, so
 * the bar reads as part of the same system as the ticket pages and the
 * homepage hero: near-black ground, gold date chip, near-white lead phrase,
 * red CTA, Barlow type. Nothing here uses !important.
 *
 * Crossfade follows the homepage slider's model (sc-homepage-slider.css):
 * the active item is the only one in normal flow, so it dictates the bar's
 * height, and inactive items are absolutely overlaid at opacity 0.
 *
 * Written mobile-first. The old rules stacked the bar into a tall block on
 * phones; here the phone layout is the baseline and the single-row desktop
 * layout is the enhancement.
 */

.sc-announcement-bar-widget {
	display: block;
	background: var(--sc-ab-bg, var(--bg));
	border-bottom: 1px solid var(--border);
}

/* An author-level `display: block` outranks the user-agent rule behind the
 * hidden attribute, so without this the dismiss button would store the
 * dismissal and leave the bar on screen. */
.sc-announcement-bar-widget[hidden] {
	display: none;
}

/*
 * Small screens get a two-column grid: the announcement on the left, the
 * rotator controls stacked in a narrow column on the right. Giving the
 * controls their own row instead cost ~45px of header on every phone, which
 * is most of what made the old bar feel like a block rather than a bar.
 */
.sc-announcement-bar {
	position: relative;
	max-width: var(--sc-ab-max-width, 1280px);
	margin: 0 auto;
	padding: 8px 38px 8px 16px;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	column-gap: 8px;
	outline: none;
}

.sc-announcement-bar:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

/* ----- Items ----- */

.sc-announcement-items {
	position: relative;
	grid-column: 1;
	list-style: none;
	margin: 0;
	padding: 0;
	min-width: 0;
	flex: 1 1 auto;
}

.sc-announcement-item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	text-align: left;
	transition: opacity var(--sc-ab-transition, 400ms) ease;
}

/* Inactive items are lifted out of flow and faded out; the active item
 * stays in flow so the bar's height tracks whatever is showing. */
.sc-announcement-item:not(.is-active) {
	position: absolute;
	inset: 0;
	opacity: 0;
	pointer-events: none;
}

.sc-announcement-item.is-active {
	position: relative;
	opacity: 1;
}

.sc-announcement-meta {
	font-family: 'Barlow Condensed', 'Barlow', -apple-system, Arial, sans-serif;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--sc-ab-meta, var(--accent));
	white-space: nowrap;
}

.sc-announcement-title {
	font-family: 'Barlow Condensed', 'Barlow', -apple-system, Arial, sans-serif;
	font-size: 17px;
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--sc-ab-title, var(--text));
}

.sc-announcement-text {
	font-size: 14px;
	line-height: 1.35;
	color: var(--sc-ab-text, var(--muted));

	/* Phones get at most two lines of body copy, so one wordy announcement
	 * can't push the header halfway down the screen. Lifted at >=768px. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sc-announcement-text a {
	color: var(--accent);
	text-decoration: underline;
}

.sc-announcement-text a:hover,
.sc-announcement-text a:focus-visible {
	color: var(--accent-warm);
}

/* ----- CTA ----- */

.sc-announcement-cta {
	display: inline-block;
	flex: 0 0 auto;
	min-height: 40px;
	padding: 10px 18px;
	border: 1px solid var(--sc-ab-cta-bg, var(--primary));
	border-radius: 4px;
	background: var(--sc-ab-cta-bg, var(--primary));
	color: var(--sc-ab-cta-text, #fff);
	font-family: 'Barlow Condensed', 'Barlow', -apple-system, Arial, sans-serif;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sc-announcement-cta:hover,
.sc-announcement-cta:focus-visible {
	background: var(--primary-hv);
	border-color: var(--primary-hv);
	color: #fff;
}

.sc-announcement-cta:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ----- Controls ----- */

.sc-announcement-controls {
	grid-column: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	flex: 0 0 auto;
}


.sc-announcement-arrow,
.sc-announcement-pause,
.sc-announcement-dismiss {
	/* Glyphs read small, but every control keeps a 44px tap target. */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.2s ease;
}

.sc-announcement-arrow:hover,
.sc-announcement-pause:hover,
.sc-announcement-dismiss:hover {
	color: var(--text);
}

.sc-announcement-arrow:focus-visible,
.sc-announcement-pause:focus-visible,
.sc-announcement-dismiss:focus-visible,
.sc-announcement-dot:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -4px;
	color: var(--text);
}

/* Pause glyph: two bars while playing, a play triangle once latched off. */
.sc-announcement-pause-icon {
	position: relative;
	display: block;
	width: 10px;
	height: 12px;
}

.sc-announcement-pause-icon::before,
.sc-announcement-pause-icon::after {
	content: "";
	position: absolute;
	top: 0;
	width: 3px;
	height: 12px;
	background: currentColor;
}

.sc-announcement-pause-icon::before { left: 0; }
.sc-announcement-pause-icon::after { right: 0; }

.sc-announcement-pause[aria-pressed="true"] .sc-announcement-pause-icon::before {
	left: 1px;
	width: 0;
	height: 0;
	background: transparent;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
	border-left: 10px solid currentColor;
}

.sc-announcement-pause[aria-pressed="true"] .sc-announcement-pause-icon::after {
	display: none;
}

/* Arrows only earn their space once the bar is a single wide row; below
 * that, swiping and the dots cover navigation. Scoped to the container so it
 * outranks the shared button rule above whatever the source order. */
.sc-announcement-controls .sc-announcement-arrow {
	display: none;
}

.sc-announcement-dots {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0;
}

.sc-announcement-dot {
	width: 20px;
	height: 20px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	position: relative;
}

.sc-announcement-dot::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 7px;
	height: 7px;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: var(--border);
	transition: background-color 0.2s ease;
}

.sc-announcement-dot:hover::before {
	background: var(--muted);
}

.sc-announcement-dot.is-active::before {
	background: var(--accent);
}

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

.sc-announcement-dismiss {
	position: absolute;
	top: 2px;
	right: 0;
	font-size: 26px;
}

/* ----- Small tablets and up ----- */

@media (min-width: 481px) {
	.sc-announcement-bar {
		padding: 10px 44px 10px 20px;
	}

	.sc-announcement-text {
		font-size: 15px;
	}
}

/* ----- Desktop: collapse to a single row ----- */

@media (min-width: 769px) {
	.sc-announcement-bar {
		display: flex;
		flex-direction: row;
		align-items: center;
		gap: 16px;
		min-height: 56px;
		padding: 8px 52px 8px 24px;
	}

	.sc-announcement-item {
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: center;
		gap: 16px;
	}

	.sc-announcement-controls .sc-announcement-arrow {
		display: inline-flex;
	}

	.sc-announcement-controls {
		flex-direction: row;
		gap: 2px;
	}

	.sc-announcement-dots {
		padding: 0 6px;
	}

	.sc-announcement-cta {
		min-height: 36px;
		padding: 8px 16px;
	}

	.sc-announcement-title {
		font-size: 19px;
		white-space: nowrap;
	}

	/* Room to breathe on a wide screen: one line, ellipsised rather than
	 * clamped, so the row height stays constant as items rotate. */
	.sc-announcement-text {
		display: block;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		min-width: 0;
	}

	.sc-announcement-dismiss {
		top: 50%;
		right: 4px;
		transform: translateY(-50%);
	}
}

/* ----- Phones: arrows are redundant next to swipe + dots ----- */

@media (max-width: 480px) {
	.sc-announcement-title {
		font-size: 16px;
	}

	.sc-announcement-text {
		font-size: 14px;
		-webkit-line-clamp: 2;
	}

	.sc-announcement-cta {
		padding: 9px 14px;
		font-size: 14px;
	}
}

/* ----- Motion ----- */

@media (prefers-reduced-motion: reduce) {
	.sc-announcement-item,
	.sc-announcement-cta,
	.sc-announcement-arrow,
	.sc-announcement-pause,
	.sc-announcement-dismiss,
	.sc-announcement-dot::before {
		transition: none;
	}
}
