/*
 * Announcement bar above the site header - see src/Bar/Bar.php and bar.js.
 *
 * In normal flow, not positioned over the page: the old alert bar was absolute
 * and needed padding pushed onto <body> and #site_header at three breakpoints
 * to make room for itself. Messages share one grid cell, so the bar is as tall
 * as its tallest message and does not move the page as they rotate.
 *
 * Colours: --tcup-bar-bg and --tcup-bar-fg, set from the settings screen for
 * the bar and per message. The default is the old bar's cream-to-pink.
 */

.tcup-bar {
	--tcup-bar-bg: linear-gradient(90deg, #fffbf0 0%, #f9e0e8 100%);
	--tcup-bar-fg: var(--tn-fg, #4c4b4b);
	--tcup-bar-accent: var(--tn-primary, #e45e9a);

	position: relative;
	background: var(--tcup-bar-bg);
	color: var(--tcup-bar-fg);
	font-family: "Montserrat", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: 0.02em;
}

.tcup-bar[hidden] {
	display: none !important;
}

/*
 * Printed above and below the header; one shows. Below on tablets and phones,
 * where the theme's menu button is fixed to the top corner - the same split
 * the old alert bar had, at the theme's large breakpoint.
 */
.tcup-bar--below {
	display: none;
}

@media (max-width: 1024px) {
	.tcup-bar--above {
		display: none;
	}

	.tcup-bar--below {
		display: block;
	}
}

.tcup-bar__inner {
	display: grid;
	grid-template-columns: 32px minmax(0, 1fr) 32px;
	align-items: center;
	gap: 4px;
	max-width: 1300px;
	min-height: 38px;
	margin: 0 auto;
	padding: 3px 8px;
}

.tcup-bar--dismissible .tcup-bar__inner {
	grid-template-columns: 32px minmax(0, 1fr) 32px 32px;
}

.tcup-bar__slides {
	display: grid;
	min-width: 0;
	text-align: center;
}

.tcup-bar__msg {
	grid-area: 1 / 1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 4px 10px;
	min-width: 0;
	padding: 5px 0;
	opacity: 0;
	visibility: hidden;
	transform: translate3d(0, 6px, 0);
	transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}

.tcup-bar__msg.is-active {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.tcup-bar__msg[hidden] {
	display: none;
}

/*
 * The pulsing dot (Top bar tab: "Pulsing dot"), as the old alert bar had: a
 * small dot with a ring that grows out of it and fades, on repeat. Its colour
 * is --tcup-bar-dot, or the text colour.
 */
.tcup-bar__dot {
	position: relative;
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	margin-right: 2px;
	border-radius: 50%;
	background: var(--tcup-bar-dot, currentColor);
}

.tcup-bar__dot::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--tcup-bar-dot, currentColor);
	opacity: 0;
	animation: tcup-bar-dot 1.4s ease-out 0.3s infinite;
}

@keyframes tcup-bar-dot {
	0% {
		opacity: 0.45;
		transform: scale(1);
	}

	100% {
		opacity: 0;
		transform: scale(3);
	}
}

.tcup-bar__text {
	min-width: 0;
	overflow-wrap: anywhere;
}

.tcup-bar__text i {
	margin-right: 0.45em;
	vertical-align: -0.1em;
}

.tcup-bar__text strong,
.tcup-bar__text b {
	font-weight: 700;
}

.tcup-bar a,
.tcup-bar a:hover,
.tcup-bar a:focus {
	color: inherit;
}

.tcup-bar__text--link {
	text-decoration: none;
}

.tcup-bar__text--link:hover,
.tcup-bar__text--link:focus-visible,
.tcup-bar__text a,
.tcup-bar__cta {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tcup-bar__cta {
	font-weight: 700;
	white-space: nowrap;
}

/*
 * The countdown: one small tile per unit - 02d 04h 12m 09s - tinted from the
 * bar's own text colour, so it suits any message's colours. Fixed-width digits
 * so it does not wobble as it ticks.
 */
.tcup-bar__countdown {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	white-space: nowrap;
}

.tcup-bar__cd-unit {
	display: inline-flex;
	align-items: baseline;
	gap: 1px;
	padding: 4px 6px;
	border-radius: 6px;
	background: rgba(76, 75, 75, 0.1);
	background: color-mix(in srgb, currentColor 12%, transparent);
}

.tcup-bar__cd-unit b {
	font-weight: 700;
}

.tcup-bar__cd-unit small {
	font-size: 0.75em;
	font-weight: 500;
	opacity: 0.7;
}

.tcup-bar__countdown[hidden] {
	display: none;
}

/* Live lines from the cart: a button, because it opens the drawer. */
.tcup-bar__live {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 4px 10px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	/* A <button> for what it does, but it reads as a line of the bar - not in
	   the theme's lowercase button style. */
	text-transform: none;
	cursor: pointer;
}

.tcup-bar__live:hover .tcup-bar__live-text,
.tcup-bar__live:focus-visible .tcup-bar__live-text {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/*
 * It is a <button>, so the theme's button rule (hover, focus, active -> a
 * #c01360 background) repainted the whole line magenta under the pointer.
 * Every state keeps the bar's own look; hover only underlines the words.
 */
.tcup-bar .tcup-bar__live:hover,
.tcup-bar .tcup-bar__live:focus,
.tcup-bar .tcup-bar__live:active {
	background: none;
	color: inherit;
	box-shadow: none;
}

/*
 * Progress: the line itself is the meter (Settings > Top bar > Reward
 * progress) - a pill that fills from the left, or a line under the words that
 * fills. Colours come from the settings, else a soft pink on a faint grey.
 * Every state is listed so the theme's button hover cannot repaint it.
 */
.tcup-bar__live--progress,
.tcup-bar .tcup-bar__live--progress:hover,
.tcup-bar .tcup-bar__live--progress:focus,
.tcup-bar .tcup-bar__live--progress:active {
	color: var(--tcup-bar-progress-text, inherit);
}

.tcup-bar__live--pill,
.tcup-bar .tcup-bar__live--pill:hover,
.tcup-bar .tcup-bar__live--pill:focus,
.tcup-bar .tcup-bar__live--pill:active {
	padding: 2px 12px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--tcup-bar-progress-fill, rgba(228, 94, 154, 0.3)) var(--tcup-bar-progress, 0%), var(--tcup-bar-progress-track, rgba(76, 75, 75, 0.07)) var(--tcup-bar-progress, 0%));
}

.tcup-bar__live--underline,
.tcup-bar .tcup-bar__live--underline:hover,
.tcup-bar .tcup-bar__live--underline:focus,
.tcup-bar .tcup-bar__live--underline:active {
	padding: 0 0 5px;
	border-radius: 0;
	background: linear-gradient(90deg, var(--tcup-bar-progress-fill, #e45e9a) var(--tcup-bar-progress, 0%), var(--tcup-bar-progress-track, rgba(76, 75, 75, 0.15)) var(--tcup-bar-progress, 0%)) left bottom / 100% 3px no-repeat;
}

.tcup-bar__live .woocommerce-Price-amount {
	font-weight: 700;
}

.tcup-bar__code {
	display: inline-block;
	padding: 0 6px;
	border: 1px dashed currentColor;
	border-radius: 4px;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.tcup-bar__nav,
.tcup-bar__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: inherit;
	opacity: 0.65;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease;
}

/*
 * Every state keeps the bar's own colours. The theme's global button rule
 * (button:hover, :focus, :active -> #c01360 background, white text) outranks
 * a bare class, so a clicked or tapped arrow turned dark pink and stayed that
 * way while focused. Hover only brightens the icon; keyboard focus keeps the
 * outline ring below.
 */
.tcup-bar__nav:hover,
.tcup-bar__nav:focus,
.tcup-bar__nav:active,
.tcup-bar__close:hover,
.tcup-bar__close:focus,
.tcup-bar__close:active {
	background: none;
	color: inherit;
}

.tcup-bar__nav:hover,
.tcup-bar__close:hover {
	opacity: 1;
}

.tcup-bar :focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.tcup-bar__ucss-anchor {
	display: none !important;
}

/* Hidden arrows keep their column, so the text stays centred. */
.tcup-bar__nav[hidden] {
	display: inline-flex;
	visibility: hidden;
}

.tcup-bar__nav--next svg {
	transform: scaleX(-1);
}

.tcup-bar__close {
	font-size: 1.25rem;
	line-height: 1;
}

/* Phones: no arrows (swipe instead), and a little tighter. */
@media (max-width: 640px) {
	.tcup-bar {
		font-size: 0.8125rem;
		letter-spacing: 0.01em;
	}

	.tcup-bar__inner,
	.tcup-bar--dismissible .tcup-bar__inner {
		grid-template-columns: minmax(0, 1fr);
		min-height: 36px;
		padding: 2px 14px;
	}

	.tcup-bar--dismissible .tcup-bar__inner {
		grid-template-columns: minmax(0, 1fr) 28px;
		padding-right: 4px;
	}

	.tcup-bar__nav,
	.tcup-bar__nav[hidden] {
		display: none;
	}

	.tcup-bar__close {
		width: 28px;
		height: 28px;
	}

	.tcup-bar__msg {
		gap: 3px 8px;
	}

	/* Narrow screens: a slimmer pill. */
	.tcup-bar__live--pill {
		padding: 1px 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tcup-bar__dot::after {
		animation: none;
	}

	.tcup-bar__msg {
		transform: none;
		transition: opacity 0.2s ease, visibility 0s linear 0.2s;
	}
}
