/* ============================================================
   Black Friday launch bar (template-parts/bf-bar.php)
   Pinned to the top of the window; the sticky header pins right
   under it. Same black + electric blue as the Black Friday pages.
   This file only loads while the bar is on, so every offset
   below disappears with it.
   ============================================================ */
:root { --bfbar-h: 46px; }
@media (max-width: 760px) { :root { --bfbar-h: 44px; } }

.bfbar {
	position: sticky; top: 0; z-index: 101; isolation: isolate; overflow: hidden;
	max-height: 140px;
	background:
		radial-gradient(260px 90px at 14% 130%, rgba(47, 107, 255, .55), transparent 70%),
		radial-gradient(320px 90px at 86% -30%, rgba(29, 78, 216, .55), transparent 70%),
		radial-gradient(420px 60px at 50% 120%, rgba(76, 141, 255, .22), transparent 70%),
		#030509;
	color: rgba(222, 232, 255, .74);
	font: 500 14px/1.2 var(--font-body);
	transition: max-height .3s ease, opacity .22s ease;
}
.bfbar-off .bfbar { display: none; }
.bfbar.is-closing { max-height: 0 !important; opacity: 0; }

/* Dotted texture, faded at the edges */
.bfbar::before {
	content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
	background-image: radial-gradient(rgba(147, 180, 255, .2) 1px, transparent 1.2px);
	background-size: 12px 12px;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
	mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
	opacity: .55;
}
/* Glowing base line with a light running along it */
.bfbar::after {
	content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; pointer-events: none;
	background: linear-gradient(90deg, rgba(76, 141, 255, 0) 0%, rgba(76, 141, 255, .45) 20%, #b9d3ff 50%, rgba(76, 141, 255, .45) 80%, rgba(76, 141, 255, 0) 100%);
	background-size: 200% 100%;
	animation: bfbar-line 6s linear infinite;
}
@keyframes bfbar-line { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Light beam that sweeps across every few seconds */
.bfbar__beam {
	position: absolute; top: 0; bottom: 0; left: 0; width: 34%; z-index: -1; pointer-events: none;
	background: linear-gradient(90deg, transparent, rgba(127, 178, 255, .16) 45%, rgba(200, 222, 255, .22) 50%, rgba(127, 178, 255, .16) 55%, transparent);
	transform: translateX(-120%) skewX(-24deg);
	animation: bfbar-beam 7s cubic-bezier(.55, .1, .35, 1) infinite 1.2s;
}
@keyframes bfbar-beam { 0% { transform: translateX(-120%) skewX(-24deg); } 45%, 100% { transform: translateX(400%) skewX(-24deg); } }

.bfbar__inner {
	display: flex; align-items: center; justify-content: center; gap: 14px;
	height: var(--bfbar-h); max-width: var(--container); margin-inline: auto; padding: 0 56px;
}

/* "Black Friday" chip with chrome lettering */
.bfbar__tag {
	display: inline-flex; align-items: center; gap: 7px; flex: none;
	padding: 6px 12px 6px 10px; border-radius: 999px;
	border: 1px solid rgba(127, 178, 255, .38);
	background: linear-gradient(180deg, rgba(76, 141, 255, .16), rgba(76, 141, 255, .04));
	box-shadow: 0 0 22px -6px rgba(76, 141, 255, .85), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.bfbar__bolt { flex: none; color: #9cc2ff; filter: drop-shadow(0 0 5px rgba(76, 141, 255, 1)); animation: bfbar-flicker 4s ease-in-out infinite; }
@keyframes bfbar-flicker { 0%, 88%, 100% { opacity: 1; } 90% { opacity: .35; } 92% { opacity: 1; } 94% { opacity: .5; } }
.bfbar__tag-text {
	font: 700 11.5px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
	background: linear-gradient(100deg, #ffffff 0%, #d6e5ff 28%, #7fb2ff 44%, #ffffff 56%, #d6e5ff 78%, #ffffff 100%);
	background-size: 240% 100%;
	-webkit-background-clip: text; background-clip: text; color: transparent;
	animation: bfbar-chrome 5s linear infinite;
}
@keyframes bfbar-chrome { from { background-position: 120% 0; } to { background-position: -120% 0; } }

.bfbar__msg { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.bfbar__lead { color: rgba(222, 232, 255, .78); }
.bfbar__date {
	display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 7px;
	font: 700 13px/1 var(--font-display); letter-spacing: .01em; color: #fff;
	background: linear-gradient(135deg, #4c8dff 0%, #2563eb 60%, #1d4ed8 100%);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, .14) inset, 0 6px 18px -6px rgba(37, 99, 235, .95), 0 0 24px -8px rgba(76, 141, 255, .9);
}

.bfbar__rule { flex: none; width: 1px; height: 20px; background: linear-gradient(180deg, transparent, rgba(147, 180, 255, .4), transparent); }

/* ---------- Which half of the sale the bar is showing ----------
   Both messages ship in the markup; .bfbar.is-live picks the live one, so a
   cached page flips over on its own the moment the sale opens. */
.bfbar__msg--live, .bfbar__sr--live, .bfbar__clock-label--live, .bfbar__cta { display: none; }
.bfbar.is-live .bfbar__msg--pre, .bfbar.is-live .bfbar__sr--pre, .bfbar.is-live .bfbar__clock-label--pre { display: none; }
.bfbar.is-live .bfbar__msg--live { display: inline-flex; }
.bfbar.is-live .bfbar__sr--live { display: block; }
.bfbar.is-live .bfbar__clock-label--live, .bfbar.is-live .bfbar__cta { display: inline-flex; }

.bfbar__clock-label { flex: none; color: rgba(222, 232, 255, .72); white-space: nowrap; }

/* "Sale is live" with a breathing dot */
.bfbar__live { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: #fff; white-space: nowrap; }
.bfbar__dot {
	position: relative; flex: none; width: 7px; height: 7px; border-radius: 50%;
	background: #7fe0a8; box-shadow: 0 0 10px rgba(127, 224, 168, .95);
}
.bfbar__dot::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%; background: #7fe0a8;
	animation: bfbar-ping 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes bfbar-ping { 75%, 100% { transform: scale(2.8); opacity: 0; } }

/* Link through to the sale page */
.bfbar__cta {
	align-items: center; gap: 5px; flex: none; padding: 5px 11px; border-radius: 999px;
	font: 600 12.5px/1 var(--font-body); color: #eaf1ff; text-decoration: none;
	border: 1px solid rgba(147, 180, 255, .34); background: rgba(255, 255, 255, .06);
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.bfbar__cta:hover { color: #fff; background: rgba(76, 141, 255, .24); border-color: rgba(147, 180, 255, .6); }
.bfbar__cta:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(76, 141, 255, .55); }

/* Countdown */
.bfbar__clock { display: inline-flex; align-items: center; gap: 4px; font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
.bfbar__cell {
	display: inline-flex; align-items: baseline; gap: 2px; padding: 4px 7px 4px 8px; border-radius: 7px;
	background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
	border: 1px solid rgba(147, 180, 255, .18);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
	overflow: hidden;
}
.bfbar__cell b {
	display: inline-block; min-width: 2ch; text-align: right;
	font-weight: 700; font-size: 13px; line-height: 1; color: #fff; font-variant-numeric: tabular-nums;
	text-shadow: 0 0 12px rgba(127, 178, 255, .65);
}
.bfbar__cell b.is-tick { animation: bfbar-tick .38s cubic-bezier(.2, .8, .3, 1); }
@keyframes bfbar-tick { from { transform: translateY(-55%); opacity: 0; } to { transform: none; opacity: 1; } }
.bfbar__cell i { font-style: normal; font-size: 10.5px; font-weight: 600; color: rgba(147, 180, 255, .75); }
.bfbar__sep { color: rgba(127, 178, 255, .7); font-weight: 700; font-size: 13px; animation: bfbar-blink 1s steps(2, start) infinite; }
@keyframes bfbar-blink { to { opacity: .25; } }

/* Dismiss */
.bfbar__close {
	position: absolute; top: 50%; right: 14px; transform: translateY(-50%);
	display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
	border: 1px solid transparent; border-radius: 50%; background: transparent; cursor: pointer;
	color: rgba(222, 232, 255, .55); transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.bfbar__close:hover { color: #fff; background: rgba(255, 255, 255, .08); border-color: rgba(147, 180, 255, .25); }
.bfbar__close:focus-visible { outline: none; color: #fff; box-shadow: 0 0 0 3px rgba(76, 141, 255, .55); }

/* ---------- Make room for the pinned bar ----------
   Header, anchor jumps and each page's sticky rail move down by the bar's
   height. html.bfbar-off = closed or expired; html.bfbar-closing = sliding away. */
html:not(.bfbar-off):not(.bfbar-closing) { scroll-padding-top: calc(90px + var(--bfbar-h)); }
html:not(.bfbar-off) .nav { transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, top .3s ease; }
html:not(.bfbar-off):not(.bfbar-closing) .nav { top: var(--bfbar-h); }
html:not(.bfbar-off):not(.bfbar-closing) .cap-jump { top: calc(68px + var(--bfbar-h)); }
html:not(.bfbar-off):not(.bfbar-closing) .bfd-bar { top: calc(80px + var(--bfbar-h)); }
html:not(.bfbar-off):not(.bfbar-closing) .faqp-rail,
html:not(.bfbar-off):not(.bfbar-closing) .pp-rail,
html:not(.bfbar-off):not(.bfbar-closing) .dc-side { top: calc(96px + var(--bfbar-h)); }
html:not(.bfbar-off):not(.bfbar-closing) .hw-trace { top: calc(104px + var(--bfbar-h)); }
html:not(.bfbar-off):not(.bfbar-closing) .sp-aside__sticky { top: calc(108px + var(--bfbar-h)); }
@media (min-width: 981px) {
	html:not(.bfbar-off):not(.bfbar-closing) .dc-side { max-height: calc(100vh - 116px - var(--bfbar-h)); }
	html:not(.bfbar-off):not(.bfbar-closing) .pp-rail { max-height: calc(100vh - 120px - var(--bfbar-h)); }
}
@media (min-width: 1081px) {
	html:not(.bfbar-off):not(.bfbar-closing) .sp-toc__list { max-height: calc(100vh - 230px - var(--bfbar-h)); }
}
@media (max-width: 980px) {
	html:not(.bfbar-off):not(.bfbar-closing) .dc-side { top: calc(72px + var(--bfbar-h)); }
}
@media (max-width: 640px) {
	html:not(.bfbar-off):not(.bfbar-closing) .cap-jump { top: calc(60px + var(--bfbar-h)); }
}
/* Signed-in editors: keep the bar below the WordPress toolbar */
@media (min-width: 783px) {
	.admin-bar .bfbar { top: 32px; }
	html:not(.bfbar-off):not(.bfbar-closing) .admin-bar .nav { top: calc(32px + var(--bfbar-h)); }
}

/* ---------- Smaller screens ---------- */
@media (max-width: 1100px) {
	.bfbar.is-live .bfbar__cta { display: none; }
}
@media (max-width: 760px) {
	.bfbar__inner { gap: 10px; padding: 0 48px 0 16px; }
	.bfbar__rule, .bfbar__lead { display: none; }
	.bfbar.is-live .bfbar__cta { display: none; }
	.bfbar__close { right: 8px; }
}
@media (max-width: 520px) {
	.bfbar__inner { justify-content: flex-start; gap: 8px; padding-left: 12px; }
	.bfbar.is-live .bfbar__clock-label--live, .bfbar.is-live .bfbar__clock { display: none; }
	.bfbar__tag { padding: 5px 9px 5px 8px; gap: 5px; }
	.bfbar__tag-text { font-size: 10px; letter-spacing: .08em; }
	.bfbar__date { padding: 4px 8px; font-size: 12px; }
	.bfbar__cell--s, .bfbar__sep { display: none; }
	.bfbar__cell { padding: 3px 4px 3px 5px; border-radius: 6px; }
	.bfbar__cell b { min-width: 0; font-size: 12px; }
	.bfbar__cell i { font-size: 9.5px; }
	.bfbar__clock { gap: 3px; }
}
@media (max-width: 360px) {
	.bfbar__clock { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.bfbar, .bfbar::after, .bfbar__beam, .bfbar__bolt, .bfbar__tag-text, .bfbar__sep, .bfbar__cell b.is-tick { animation: none; transition: none; }
	.bfbar__beam { display: none; }
}
