/*
 * Black Week ticker (CSS only).
 * Colors, font size and padding come from the Group block in the editor
 * (the Group carries the additional CSS class "tt-bw-ticker"); this file only
 * handles layout and animation.
 */
.tt-bw-ticker {
	overflow: hidden;
}

/* Text follows the Group's Typography settings from the editor (size, weight, family),
   even if the theme or a plugin styles list elements. */
.tt-bw-ticker .tt-bw-ticker__group,
.tt-bw-ticker .tt-bw-ticker__group li {
	font: inherit;
}

.tt-bw-ticker .tt-bw-ticker__track {
	display: flex;
	width: max-content;
	max-width: none; /* keeps a constrained Group layout from clipping the track */
	margin-inline: 0;
	animation: tt-bw-scroll 60s linear infinite;
}

/* Second ticker that scrolls the other way: give the Group BOTH classes,
   "tt-bw-ticker tt-bw-ticker--reverse". Same seamless loop, just played backwards. */
.tt-bw-ticker.tt-bw-ticker--reverse .tt-bw-ticker__track {
	animation-direction: reverse;
}

/* Courtesy for mouse users: pause while hovering so the text can be read. */
.tt-bw-ticker:hover .tt-bw-ticker__track {
	animation-play-state: paused;
}

.tt-bw-ticker__group {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-around;
	gap: 3rem;
	box-sizing: border-box;
	min-width: 100vw; /* each copy is at least one screen wide, so the loop never shows a gap */
	margin: 0;
	padding: 0 3rem 0 0;
	list-style: none;
}

.tt-bw-ticker__group li {
	display: flex;
	align-items: center;
	gap: .75rem;
	margin: 0;
	white-space: nowrap;
}

/* Small outlined button: takes the Group's text color, so it follows the editor colors. */
.tt-bw-ticker__btn {
	display: inline-block;
	padding: .2rem .9rem;
	border: 2px solid currentColor;
	border-radius: 999px;
	color: inherit;
	font: inherit;
	line-height: 1.4;
	text-decoration: none;
}

.tt-bw-ticker__btn:hover {
	background: color-mix(in srgb, currentColor 20%, transparent);
	color: inherit;
}

.tt-bw-ticker__btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Keyboard users: stop the scroll while a button has focus. */
.tt-bw-ticker:focus-within .tt-bw-ticker__track {
	animation-play-state: paused;
}

/* Track holds two identical groups, so moving by half its width loops seamlessly. */
@keyframes tt-bw-scroll {
	to { transform: translateX(-50%); }
}

/* Pulsing CTA: add class "tt-bw-pulse" to a Button block (Advanced > Additional CSS class) */
.tt-bw-pulse .wp-block-button__link,
.tt-bw-pulse.wp-block-button__link {
	animation: tt-bw-pulse 1.2s ease-in-out 3;
}

@keyframes tt-bw-pulse {
	50% { transform: scale(1.06); }
}

/* Hover lift on product cards: add class "tt-bw-lift" to a Group/Column */
.tt-bw-lift {
	transition: transform .2s ease;
}

.tt-bw-lift:hover {
	transform: translateY(-4px);
}

@media (prefers-reduced-motion: reduce) {
	/* No scrolling: show the offers as a static, wrapping row. */
	.tt-bw-ticker__track {
		width: auto;
		animation: none;
	}

	.tt-bw-ticker__group {
		flex-shrink: 1;
		flex-wrap: wrap;
		justify-content: center;
		min-width: 0;
		gap: .5rem 2rem;
		padding: 0 1rem;
	}

	.tt-bw-ticker__group li {
		white-space: normal;
	}

	.tt-bw-ticker__group[aria-hidden="true"] {
		display: none;
	}

	.tt-bw-pulse .wp-block-button__link,
	.tt-bw-pulse.wp-block-button__link {
		animation: none;
	}

	.tt-bw-lift {
		transition: none;
	}
}
