/**
 * You Save — Announcement Bar template design system ("Phase B").
 *
 * SINGLE SOURCE OF VISUAL TRUTH shared by:
 *   - Admin builder previews (React <ABBarX>) — Step 1, Step 2 picker, Step 4 review, My Presentations.
 *   - Storefront renderer (PHP Ys_AB_Frontend::build_bar_html).
 *
 * Both emit the SAME markup contract; this file styles it.
 *
 * Responsive model:
 *   - Storefront bars (no view class) adapt to CONTAINER width via container queries.
 *   - Admin previews pass view="desktop" / view="mobile" to FORCE a composition
 *     regardless of the preview frame width (so a "Desktop View" label always shows
 *     the real desktop layout, and "Mobile View" always shows the stacked layout).
 *
 * Markup contract:
 *   .ys-abx-wrap  (container-type: inline-size)
 *     .ys-abx.ys-abx--<template>[.ys-abx--view-desktop|.ys-abx--view-mobile|.ys-abx--compact]
 *       .ys-abx__inner
 *         .ys-abx__eyebrow · .ys-abx__icon · .ys-abx__msg · .ys-abx__divider
 *         .ys-abx__coupon (.ys-abx__coupon-icon / .ys-abx__code)
 *         .ys-abx__countdown (.ys-abx__cd-unit / __cd-num / __cd-lbl / __cd-sep)
 *         .ys-abx__cta
 */

.ys-abx-wrap { container-type: inline-size; width: 100%; }

.ys-abx {
	--abx-bg: #1a1a1a;
	--abx-fg: #ffffff;
	--abx-accent: #ffffff;
	position: relative;
	display: block;
	width: 100%;
	box-sizing: border-box;
	background: var(--abx-bg);
	color: var(--abx-fg);
	font-family: inherit;
	-webkit-font-smoothing: antialiased;
}
/* Only Cyber Midnight needs clipping (its decorative streaks overflow the bar). */
.ys-abx--cyber_midnight { overflow: hidden; }

/* Intrinsic desktop composition: centered at its natural width, then bounded by
   the host. Content consumes available width before flexible regions yield. */
.ys-abx__inner {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	justify-content: center;
	gap: clamp(8px, 1.25cqi, 20px);
	width: max-content;
	max-width: 100%;
	margin: 0 auto;
	padding: 13px clamp(16px, 2.5cqi, 40px);
	min-height: 48px;
	box-sizing: border-box;
}

.ys-abx__eyebrow {
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	white-space: nowrap;
	color: var(--abx-accent);
	flex: 0 0 auto;
}
.ys-abx__icon { display: inline-flex; align-items: center; flex: 0 0 auto; }
.ys-abx__icon svg { display: block; }

/* Lead group — icon + eyebrow + badge together (e.g. Flash Red). */
.ys-abx__lead { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.ys-abx__badge {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	padding: 3px 9px;
	border: 1.5px solid currentColor;
	border-radius: 4px;
	white-space: nowrap;
	line-height: 1.1;
}
.ys-abx__msg {
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
	flex: 0 1 auto;
}
.ys-abx__msg b, .ys-abx__msg strong { font-weight: 800; }

.ys-abx__divider {
	width: 1px;
	align-self: stretch;
	margin: 5px 0;
	background: currentColor;
	opacity: 0.22;
	flex: 0 0 auto;
}

.ys-abx__coupon {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13.5px;
	white-space: nowrap;
	opacity: 0.95;
	flex: 0 1 auto;
}
.ys-abx__coupon-icon { display: inline-flex; flex: 0 0 auto; opacity: 0.85; }
.ys-abx__coupon-icon svg { display: block; }
.ys-abx__code {
	display: inline-block;
	font-weight: 700;
	letter-spacing: 0.05em;
	padding: 2px 8px;
	border: 1px dashed currentColor;
	border-radius: 4px;
	font-size: 12.5px;
}

/* ── Countdown (pill units with labels) ── */
.ys-abx__countdown { display: inline-flex; align-items: flex-start; gap: 6px; white-space: nowrap; flex: 0 0 auto; }
.ys-abx__cd-unit { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; min-width: 30px; }
.ys-abx__cd-num {
	font-size: 16px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	background: rgba(255,255,255,0.14);
	border-radius: 5px;
	padding: 4px 7px;
	min-width: 16px;
	text-align: center;
}
.ys-abx__cd-lbl { font-size: 8px; font-weight: 700; letter-spacing: 0.1em; opacity: 0.65; margin-top: 4px; text-transform: uppercase; }
.ys-abx__cd-sep { font-size: 15px; font-weight: 700; opacity: 0.4; margin-top: 4px; }

/* ── CTA ── */
.ys-abx__cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	font-size: 13.5px;
	font-weight: 700;
	text-decoration: none;
	padding: 10px 20px;
	border-radius: 7px;
	background: var(--abx-accent);
	color: var(--abx-bg);
	white-space: nowrap;
	transition: filter 0.15s;
	/* Admin previews render the CTA as a non-interactive <span>: default cursor,
	   no hover affordance, not focusable. The storefront renders it as <a>. */
	cursor: default;
	border: none;
}
a.ys-abx__cta { cursor: pointer; }
a.ys-abx__cta:hover, a.ys-abx__cta:focus { filter: brightness(1.08); color: var(--abx-bg); }

/* ───────────────────────── Template: General ───────────────────────── */
.ys-abx--general { --abx-bg: #F5F0E9; --abx-fg: #283E33; --abx-accent: #283E33; }
.ys-abx--general .ys-abx__cta { color: #F5F0E9; }
.ys-abx--general .ys-abx__msg { font-weight: 600; }

/* ───────────────────────── Template: BFCM Basic ────────────────────── */
.ys-abx--bfcm_basic { --abx-bg: #0e0e0e; --abx-fg: #ffffff; --abx-accent: #ff3b3b; }
.ys-abx--bfcm_basic .ys-abx__eyebrow { color: #ffffff; font-weight: 700; letter-spacing: 0.18em; font-size: 13px; }
.ys-abx--bfcm_basic .ys-abx__msg { color: #ff3b3b; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.ys-abx--bfcm_basic .ys-abx__coupon { font-weight: 600; }
.ys-abx--bfcm_basic .ys-abx__cta { color: #ffffff; background: #ff3b3b; font-weight: 800; }

/* ───────────────────────── Template: Midnight Luxe (Pro) ───────────── */
.ys-abx--midnight_luxe {
	--abx-bg: #0d0b08; --abx-fg: #f0e4c0; --abx-accent: #e7c66a;
	background: radial-gradient(120% 180% at 50% 0%, #1a160d 0%, #0d0b08 70%);
}
.ys-abx--midnight_luxe .ys-abx__eyebrow { color: #e7c66a; font-weight: 700; letter-spacing: 0.22em; font-size: 12px; }
.ys-abx--midnight_luxe .ys-abx__msg { color: #e7c66a; font-weight: 800; font-size: 20px; }
.ys-abx--midnight_luxe .ys-abx__divider { opacity: 0.4; }
.ys-abx--midnight_luxe .ys-abx__cta { background: linear-gradient(180deg,#f0d987,#d8b24e); color: #1a1205; font-weight: 800; }
.ys-abx--midnight_luxe .ys-abx__cd-num { background: #1c1810; color: #f0e4c0; border: 1px solid rgba(231,198,106,0.3); }
.ys-abx--midnight_luxe .ys-abx__cd-lbl { color: rgba(231,198,106,0.75); opacity: 1; }
.ys-abx--midnight_luxe .ys-abx__cd-sep { color: #e7c66a; }

/* ───────────────────────── Template: Flash Red (Pro) ───────────────── */
.ys-abx--flash_red {
	--abx-bg: #e01230; --abx-fg: #ffffff; --abx-accent: #ffffff;
	background: linear-gradient(90deg, #e4142f 0%, #d60f29 100%);
	overflow: hidden;
}
/* Darker diagonal geometric wedge on the right (Figma). */
.ys-abx--flash_red::after {
	content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 44%;
	background: linear-gradient(115deg, transparent 0%, transparent 42%, rgba(150,8,24,0.5) 43%, rgba(120,6,20,0.62) 100%);
	pointer-events: none;
}
.ys-abx--flash_red .ys-abx__inner { position: relative; z-index: 1; }
.ys-abx--flash_red .ys-abx__lead { gap: 12px; }
.ys-abx--flash_red .ys-abx__icon svg { width: 22px; height: 22px; }
.ys-abx--flash_red .ys-abx__eyebrow { color: #ffffff; letter-spacing: 0.1em; font-size: 14px; font-weight: 800; }
.ys-abx--flash_red .ys-abx__badge { border-color: rgba(255,255,255,0.9); color: #ffffff; }
.ys-abx--flash_red .ys-abx__msg { font-weight: 800; font-size: 24px; letter-spacing: -0.01em; }
.ys-abx--flash_red .ys-abx__coupon { font-size: 13px; opacity: 0.95; }
.ys-abx--flash_red .ys-abx__cta { background: #ffffff; color: #d01228; font-weight: 800; }
.ys-abx--flash_red .ys-abx__cd-num { background: #ffffff; color: #d01228; font-weight: 800; border-radius: 6px; }
.ys-abx--flash_red .ys-abx__cd-lbl { color: rgba(255,255,255,0.9); opacity: 1; }
.ys-abx--flash_red .ys-abx__cd-sep { color: rgba(255,255,255,0.85); }

/* ───────────────────────── Template: Cyber Midnight (Pro) ──────────── */
.ys-abx--cyber_midnight {
	--abx-bg: #080a1a; --abx-fg: #e6f2ff; --abx-accent: #28e0ff;
	background: linear-gradient(100deg, #080a1a 0%, #141033 55%, #1a0f2e 100%);
}
/* Decorative diagonal light streaks (corners), pointer-events none. */
.ys-abx--cyber_midnight::before,
.ys-abx--cyber_midnight::after {
	content: ''; position: absolute; top: -40%; width: 70px; height: 200%;
	background: linear-gradient(180deg, rgba(40,224,255,0.65), rgba(168,85,247,0.0));
	transform: rotate(22deg); pointer-events: none; opacity: 0.5;
}
.ys-abx--cyber_midnight::before { left: 3%; }
.ys-abx--cyber_midnight::after  { right: 3%; background: linear-gradient(180deg, rgba(168,85,247,0.6), rgba(40,224,255,0.0)); }
.ys-abx--cyber_midnight .ys-abx__inner { position: relative; z-index: 1; }
.ys-abx--cyber_midnight .ys-abx__eyebrow {
	background: linear-gradient(90deg, #28e0ff, #a855f7);
	-webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
	font-size: 13px; letter-spacing: 0.12em;
}
.ys-abx--cyber_midnight .ys-abx__msg { color: #ffffff; font-weight: 800; font-size: 17px; }
.ys-abx--cyber_midnight .ys-abx__cta { background: linear-gradient(90deg, #28e0ff, #a855f7); color: #080a1a; font-weight: 800; }
.ys-abx--cyber_midnight .ys-abx__cd-num { background: rgba(40,224,255,0.16); color: #28e0ff; }
.ys-abx--cyber_midnight .ys-abx__cd-lbl { color: rgba(230,242,255,0.65); }

/* Desktop priority at the safe host width: secondary yields first. The message
   and CTA keep their intrinsic size while space exists; ellipsis is only a
   consequence of actual flex shrink, never a fixed character/region-width cap. */
.ys-abx:not(.ys-abx--compact) .ys-abx__msg {
 min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.ys-abx:not(.ys-abx--compact) .ys-abx__coupon {
 min-width: 0; flex-shrink: 1000; overflow: hidden;
}
.ys-abx:not(.ys-abx--compact) .ys-abx__cta {
 display: block; flex-shrink: 1; min-width: 8rem;
 overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; text-align: center;
}
/* Reserve a real flex item for dismissal instead of overlaying the CTA. */
.ys-abx__inner > .ys-abx__close {
 position: static; transform: none; flex: 0 0 auto; order: 1;
 min-width: 32px; min-height: 32px; margin: 0;
}

/* ═══════════════════════ MOBILE composition ═══════════════════════════════
   Stacked + centered. Applied to responsive bars under 900px (unless forced
   desktop) AND to any bar with view="mobile". Rules duplicated because a
   @container block and a plain class list cannot be merged into one selector. */
@container (max-width: 900px) {
	.ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__inner {
		flex-direction: column; gap: 9px; padding: 15px 16px; text-align: center;
		justify-content: center; width: 100%; max-width: 100%;
	}
	.ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__divider { display: none; }
	.ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__msg { white-space: normal; }
	.ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__coupon { white-space: normal; justify-content: center; }
	.ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__cta { width: 100%; justify-content: center; }
}
.ys-abx--view-mobile .ys-abx__inner {
	flex-direction: column; gap: 9px; padding: 15px 16px; text-align: center;
	justify-content: center; width: 100%; max-width: 100%;
}
.ys-abx--view-mobile .ys-abx__divider { display: none; }
.ys-abx--view-mobile .ys-abx__msg { white-space: normal; }
.ys-abx--view-mobile .ys-abx__coupon { white-space: normal; justify-content: center; }
.ys-abx--view-mobile .ys-abx__cta { width: 100%; justify-content: center; }

/* Fallback (no container-query support): viewport width governs responsive bars. */
@supports not (container-type: inline-size) {
	@media (max-width: 900px) {
		.ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__inner { flex-direction: column; gap: 9px; padding: 15px 16px; text-align: center; max-width: none; }
		.ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__divider { display: none; }
		.ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__cta { width: 100%; justify-content: center; }
	}
}

/* Preserve the stacked composition on tablet/mobile, including extreme tokens. */
.ys-abx--view-mobile :is(.ys-abx__msg, .ys-abx__coupon, .ys-abx__cta) {
 max-width: 100%; white-space: normal; overflow-wrap: anywhere; overflow: visible;
}
.ys-abx--view-mobile .ys-abx__lead { max-width: 100%; flex-wrap: wrap; justify-content: center; }
.ys-abx--view-mobile .ys-abx__inner:has(.ys-abx__close) { padding-top: 48px; }
.ys-abx--view-mobile .ys-abx__inner > .ys-abx__close { position: absolute; top: 8px; right: 12px; }
@container (max-width: 900px) {
 .ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) :is(.ys-abx__msg, .ys-abx__coupon, .ys-abx__cta) {
  max-width: 100%; white-space: normal; overflow-wrap: anywhere; overflow: visible;
 }
 .ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__lead { max-width: 100%; flex-wrap: wrap; justify-content: center; }
 .ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__inner:has(.ys-abx__close) { padding-top: 48px; }
 .ys-abx:not(.ys-abx--view-desktop):not(.ys-abx--compact) .ys-abx__inner > .ys-abx__close { position: absolute; top: 8px; right: 12px; }
}

/* ═══════════════════════ Compact variant (card thumbnails) ═══════════════════ */
.ys-abx--compact .ys-abx__inner {
	width: auto;
	flex-direction: row; flex-wrap: nowrap; gap: 7px; padding: 8px 12px;
	min-height: 0; justify-content: flex-start; align-items: center; text-align: left; max-width: none;
}
.ys-abx--compact .ys-abx__eyebrow { font-size: 8.5px; letter-spacing: 0.06em; white-space: nowrap; flex: 0 0 auto; }
.ys-abx--compact .ys-abx__msg { font-size: 10px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.ys-abx--compact .ys-abx__coupon { display: none; }
.ys-abx--compact .ys-abx__countdown { display: none; }
.ys-abx--compact .ys-abx__divider { display: inline-block; height: 13px; margin: 0; flex: 0 0 auto; }
.ys-abx--compact .ys-abx__icon { flex: 0 0 auto; }
.ys-abx--compact .ys-abx__icon svg { width: 14px; height: 14px; }
.ys-abx--compact .ys-abx__cta { width: auto; flex: 0 0 auto; margin-left: auto; font-size: 8.5px; font-weight: 700; padding: 4px 9px; border-radius: 4px; }

/* ═══════════════════════ Storefront positioning ═══════════════════════════ */
.ys-abx-wrap.is-fallback { position: fixed; top: 0; left: 0; right: 0; z-index: 9990; }
.ys-abx-wrap.is-sticky  { position: sticky; top: 0; z-index: 99; }
body.admin-bar .ys-abx-wrap.is-fallback,
body.admin-bar .ys-abx-wrap.is-sticky { top: 32px; }
@media screen and (max-width: 782px) {
	body.admin-bar .ys-abx-wrap.is-fallback,
	body.admin-bar .ys-abx-wrap.is-sticky { top: 46px; }
}

/* Dismiss button (Pro). */
.ys-abx__close {
	position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
	background: none; border: none; color: currentColor; font-size: 20px; line-height: 1;
	cursor: pointer; opacity: 0.7; padding: 4px 8px; z-index: 2;
}
.ys-abx__close:hover { opacity: 1; }

/* Approved optional region overrides. Missing values retain curated palettes/artwork. */
.ys-abx[style*="--ys-ab-background"] { background: var(--ys-ab-background); }
.ys-abx[style*="--ys-ab-text"] { color: var(--ys-ab-text); }
.ys-abx[style*="--ys-ab-text"] :is(.ys-abx__coupon,.ys-abx__eyebrow,.ys-abx__cd-lbl) { color: var(--ys-ab-text); }
.ys-abx[style*="--ys-ab-text"] .ys-abx__msg { color: var(--ys-ab-accent, var(--ys-ab-text)); }
.ys-abx[style*="--ys-ab-accent"] :is(.ys-abx__msg,.ys-abx__icon,.ys-abx__cd-sep) { color: var(--ys-ab-accent); }
.ys-abx[style*="--ys-ab-button-background"] .ys-abx__cta { background: var(--ys-ab-button-background); }
.ys-abx[style*="--ys-ab-button-text"] .ys-abx__cta { color: var(--ys-ab-button-text); }
.ys-abx__inner { min-width: 0; }
.ys-abx__msg, .ys-abx__coupon, .ys-abx__cta { overflow-wrap: anywhere; min-width: 0; }

/* Pending dismissible bars never participate in first paint or layout. */
.ys-abx-wrap[hidden] { display: none !important; }
