/**
 * You Save — Announcement Bar (Phase A: structural CSS only).
 *
 * Phase A provides the DOM skeleton, accessibility foundation, and position
 * infrastructure needed to wire up templates.  Final per-template visual
 * styling is deferred to Phase B.
 *
 * Specificity budget:
 *   (0,1,0) — single class selector, base rules
 *   (0,2,0) — two-class selector, state/modifier overrides
 */

/* ==========================================================================
   Bar container
   ========================================================================== */

.ys-ab-bar {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 10px 16px;
	font-size: 14px;
	line-height: 1.4;
}

/* Fallback bar (wp_footer path, theme does not call wp_body_open).
   Uses position:fixed to appear at the top of the viewport regardless of
   where in the DOM it was injected. */
.ys-ab-bar.is-fallback {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 9990;
}

/* Pro sticky: bar stays at the top of the viewport as the page scrolls. */
.ys-ab-bar.is-sticky {
	position: sticky;
	top: 0;
	z-index: 99;
}

/* Offset sticky / fixed bars when the WP admin bar is visible.
   WP admin bar is 32px tall on desktop, 46px on mobile (max-width:782px). */
body.admin-bar .ys-ab-bar.is-sticky,
body.admin-bar .ys-ab-bar.is-fallback {
	top: 32px;
}
@media screen and (max-width: 782px) {
	body.admin-bar .ys-ab-bar.is-sticky,
	body.admin-bar .ys-ab-bar.is-fallback {
		top: 46px;
	}
}

/* Inner layout: horizontally centered, wraps gracefully on small screens. */
.ys-ab-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px 16px;
	max-width: 1200px;
	margin: 0 auto;
}

/* ==========================================================================
   Message
   ========================================================================== */

.ys-ab-message {
	margin: 0;
	flex-shrink: 1;
}

/* ==========================================================================
   CTA link
   ========================================================================== */

.ys-ab-cta {
	display: inline-block;
	flex-shrink: 0;
	padding: 4px 12px;
	border: 1px solid currentColor;
	border-radius: 3px;
	text-decoration: none;
	font-weight: 600;
	white-space: nowrap;
	color: inherit;
}

.ys-ab-cta:hover,
.ys-ab-cta:focus {
	opacity: 0.85;
}

.ys-ab-cta:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ==========================================================================
   Countdown timer
   ========================================================================== */

.ys-ab-countdown {
	display: inline-flex;
	align-items: baseline;
	gap: 2px;
	flex-shrink: 0;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ys-ab-cd-days,
.ys-ab-cd-hours,
.ys-ab-cd-minutes,
.ys-ab-cd-seconds {
	font-weight: 700;
	min-width: 1.8ch;
	text-align: right;
}

.ys-ab-cd-sep {
	opacity: 0.7;
	margin: 0 1px;
	font-size: 0.85em;
}

/* ==========================================================================
   Dismiss (close) button — Pro only
   ========================================================================== */

.ys-ab-close {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	padding: 4px 6px;
	cursor: pointer;
	color: inherit;
	opacity: 0.7;
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
}

.ys-ab-close:hover {
	opacity: 1;
}

.ys-ab-close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 2px;
	opacity: 1;
}

/* Make the bar position:relative so the absolute close button is positioned
   relative to the bar, not the viewport. */
.ys-ab-bar {
	position: relative;
}

/* Shift inner content left when close button is present to avoid overlap. */
.ys-ab-bar:has(.ys-ab-close) .ys-ab-inner {
	padding-right: 36px;
}
