/**
 * Announcement bar.
 *
 * Every value that the settings screen controls is a custom property, set on
 * :root by the inline style the plugin prints. The fallbacks below are only
 * used if that inline style is missing.
 */

.nkab-bar {
	position: relative;
	z-index: 999;
	overflow: hidden;
	box-sizing: border-box;
	width: 100%;
	padding: var( --nkab-pad-y, 10px ) 0;
	background: var( --nkab-bg, #14532d );
	color: var( --nkab-color, #fff );
	font-family: var( --nkab-family, inherit );
	font-size: var( --nkab-size, 14px );
	font-weight: var( --nkab-weight, 600 );
	line-height: 1.4;
}

.nkab-bar--sticky {
	position: sticky;
	top: 0;
}

.nkab-bar * {
	box-sizing: border-box;
}

.nkab-track {
	display: flex;
	width: max-content;
	animation: nkab-scroll var( --nkab-speed, 30s ) linear infinite;
	will-change: transform;
}

/*
 * Two identical groups sit in the track, so sliding it exactly half its own
 * width lands the second group where the first began - no visible seam.
 */
@keyframes nkab-scroll {
	from {
		transform: translateX( 0 );
	}

	to {
		transform: translateX( -50% );
	}
}

.nkab-bar--pause:hover .nkab-track,
.nkab-bar--pause:focus-within .nkab-track {
	animation-play-state: paused;
}

.nkab-group {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}

.nkab-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	padding: 0 calc( var( --nkab-gap, 48px ) / 2 );
	white-space: nowrap;
}

.nkab-item__text {
	color: inherit;
}

a.nkab-item__text {
	color: var( --nkab-link, #fff );
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Coupon ------------------------------------------------------------------ */

.nkab-coupon {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 3px 9px;
	border: 1px dashed currentColor;
	border-radius: 5px;
	background: var( --nkab-coupon-bg, #fff );
	color: var( --nkab-coupon-color, #14532d );
	font: inherit;
	font-size: 0.92em;
	letter-spacing: 0.04em;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.nkab-coupon:hover {
	opacity: 0.85;
}

.nkab-coupon:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.nkab-coupon__icon {
	flex: 0 0 auto;
	opacity: 0.75;
}

.nkab-coupon.is-copied {
	border-style: solid;
}

/* Options ----------------------------------------------------------------- */

@media ( max-width: 600px ) {
	.nkab-bar--desktop {
		display: none;
	}
}

/*
 * A bar that never stops moving is hostile to anyone who needs motion reduced.
 * Stop the animation and let the row scroll by hand instead.
 */
@media ( prefers-reduced-motion: reduce ) {
	.nkab-track {
		animation: none;
		width: auto;
	}

	.nkab-bar {
		overflow-x: auto;
	}

	.nkab-group[aria-hidden="true"] {
		display: none;
	}
}
