/* ── Star font: absolute URL ensures homepage Elementor widgets render ★ not s ──
   WooCommerce registers this font with a relative path that fails outside
   the WooCommerce CSS context. This absolute-URL declaration guarantees it
   loads on every page (homepage product cards, shop widgets, etc.).         */
@font-face {
    font-family: "star";
    src: url("https://purehabit.fit/wp-content/plugins/woocommerce/assets/fonts/star.woff") format("woff"),
         url("https://purehabit.fit/wp-content/plugins/woocommerce/assets/fonts/star.ttf") format("truetype"),
         url("https://purehabit.fit/wp-content/plugins/woocommerce/assets/fonts/star.svg#star") format("svg");
    font-weight: normal;
    font-style: normal;
}

/* =====================================================
   Announcement Bar
   Site-wide top strip with promo code + dismiss
   ===================================================== */

/* Shimmer sweep on the code pill */
@keyframes ann-shimmer {
	0%   { background-position: -200% center; }
	100% { background-position:  200% center; }
}

/* Pulsing live dot */
@keyframes ann-pulse-dot {
	0%, 100% { opacity: 1;   transform: scale(1);    }
	50%       { opacity: 0.4; transform: scale(0.75); }
}

/* Slide-down entrance */
@keyframes ann-slide-in {
	from { transform: translateY(-100%); opacity: 0; }
	to   { transform: translateY(0);     opacity: 1; }
}

#purehabit-announcement-bar {
	position: sticky;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	z-index: 9999;
	background: linear-gradient(90deg, #d43c00 0%, #e8460e 40%, #f05a1a 100%);
	border-bottom: 1px solid rgba(0,0,0,0.18);
	color: #fff;
	text-align: center;
	padding: 10px 52px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.4;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
	animation: ann-slide-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
	box-sizing: border-box;
}

/* Soft top-light edge */
#purehabit-announcement-bar::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, transparent 60%);
	pointer-events: none;
}

/* Live pulse dot — placed via content on ann-text::before */
#purehabit-announcement-bar .ann-dot {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #fff;
	margin-right: 4px;
	vertical-align: middle;
	animation: ann-pulse-dot 1.6s ease-in-out infinite;
	flex-shrink: 0;
}

#purehabit-announcement-bar .ann-text {
	display: inline;
}

/* Promo code pill with shimmer */
#purehabit-announcement-bar .ann-code {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: rgba(255,255,255,0.18);
	border: 1.5px dashed rgba(255,255,255,0.65);
	border-radius: 5px;
	padding: 2px 11px 2px 9px;
	letter-spacing: 0.14em;
	font-weight: 900;
	font-size: 12px;
	cursor: pointer;
	user-select: all;
	position: relative;
	overflow: hidden;
	transition: background 0.2s, border-color 0.2s, transform 0.15s;
	white-space: nowrap;
}

/* Shimmer sweep */
#purehabit-announcement-bar .ann-code::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		105deg,
		transparent 30%,
		rgba(255,255,255,0.28) 50%,
		transparent 70%
	);
	background-size: 200% 100%;
	animation: ann-shimmer 2.4s linear infinite;
	pointer-events: none;
}

/* "COPY" micro-label */
#purehabit-announcement-bar .ann-code-label {
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.12em;
	opacity: 0.7;
	text-transform: uppercase;
	transition: opacity 0.2s;
}

#purehabit-announcement-bar .ann-code:hover {
	background: rgba(255,255,255,0.30);
	border-color: rgba(255,255,255,0.9);
	transform: scale(1.04);
}

#purehabit-announcement-bar .ann-code:hover .ann-code-label {
	opacity: 1;
}

/* Copied confirmation */
#purehabit-announcement-bar .ann-copied {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11.5px;
	font-weight: 700;
	background: rgba(255,255,255,0.2);
	border-radius: 50px;
	padding: 2px 10px;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.25s, transform 0.25s;
	pointer-events: none;
	white-space: nowrap;
	/* On mobile it needs to float above the ticker, not inside it */
	position: relative;
	z-index: 3;
}

#purehabit-announcement-bar .ann-copied.show {
	opacity: 1;
	transform: translateY(0);
}

/* Shop link */
#purehabit-announcement-bar .ann-shop-link {
	color: #fff;
	font-weight: 900;
	white-space: nowrap;
	text-decoration: none;
	border-bottom: 1.5px solid rgba(255,255,255,0.55);
	padding-bottom: 1px;
	transition: border-color 0.18s;
}

#purehabit-announcement-bar .ann-shop-link:hover {
	border-color: #fff;
}

/* Ticker track — flex row on desktop, scrolling on mobile */
#purehabit-announcement-bar .ann-ticker-track {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: center;
}

/* Separator dot between items */
#purehabit-announcement-bar .ann-sep {
	opacity: 0.4;
	font-size: 10px;
	line-height: 1;
}

/* Dismiss × */
#purehabit-announcement-bar .ann-dismiss {
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: rgba(255,255,255,0.70);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 5px 7px;
	border-radius: 4px;
	transition: color 0.18s, background 0.18s;
	display: flex;
	align-items: center;
	justify-content: center;
}

#purehabit-announcement-bar .ann-dismiss:hover {
	color: #fff;
	background: rgba(255,255,255,0.15);
}

/* ── Mobile ── */
@keyframes ann-ticker {
	0%   { transform: translateX(0); }
	100% { transform: translateX(-50%); }
}

@media (max-width: 600px) {
	#purehabit-announcement-bar {
		font-size: 12px;
		padding: 9px 44px 9px 0;
		gap: 0;
		flex-wrap: nowrap;
		overflow: hidden;
		width: 100%;
		/* fade edges */
		-webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 88%, transparent 100%);
		mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 88%, transparent 100%);
	}

	/* Ticker wrapper — all inner items scroll as one line */
	#purehabit-announcement-bar .ann-ticker-track {
		display: flex;
		align-items: center;
		gap: 18px;
		white-space: nowrap;
		flex-shrink: 0;
		animation: ann-ticker 18s linear infinite;
	}

	#purehabit-announcement-bar .ann-ticker-track:hover {
		animation-play-state: paused;
	}

	#purehabit-announcement-bar .ann-sep {
		display: inline-block; /* show on mobile inside ticker */
	}

	#purehabit-announcement-bar .ann-shop-link {
		display: none;
	}

	/* Keep ann-copied visible — float it over the ticker */
	#purehabit-announcement-bar .ann-copied {
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%) translateY(4px);
		z-index: 10;
		background: rgba(20,20,20,0.88);
		backdrop-filter: blur(6px);
		border: 1px solid rgba(255,255,255,0.2);
		padding: 4px 14px;
		white-space: nowrap;
	}

	#purehabit-announcement-bar .ann-copied.show {
		opacity: 1;
		transform: translate(-50%, -50%) translateY(0);
	}

	#purehabit-announcement-bar .ann-dismiss {
		/* keep dismiss visible and above the scroll track */
		background: linear-gradient(90deg, transparent, #e8460e 40%);
		z-index: 2;
		padding-left: 14px;
	}
}
