/**
 * WPMozo Products Ticker — front-end styles.
 * Default skin: light surface, horizontal marquee, sale accents.
 */

.wpmozo-pt-bar {
	--wpmozo-pt-speed: 40px;
	--wpmozo-pt-surface: #ffffff;
	--wpmozo-pt-border: #e6e6e6;
	--wpmozo-pt-text: #1a1a1a;
	--wpmozo-pt-muted: #6b6b6b;
	--wpmozo-pt-accent-bg: #eef4ff;
	--wpmozo-pt-accent-fg: #1c4fa3;
	--wpmozo-pt-sale-bg: #fdecec;
	--wpmozo-pt-sale-fg: #b3261e;

	position: relative;
	overflow: hidden;
	background: var(--wpmozo-pt-surface);
	border: 1px solid var(--wpmozo-pt-border);
	border-radius: 10px;
	color: var(--wpmozo-pt-text);
	line-height: 1.3;
}

.wpmozo-pt-bar:focus-visible {
	outline: 2px solid var(--wpmozo-pt-accent-fg);
	outline-offset: 2px;
}

/* Left promo flag */
.wpmozo-pt-flag {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	padding: 0 16px;
	background: var(--wpmozo-pt-flag-bg, var(--wpmozo-pt-accent-bg));
	color: var(--wpmozo-pt-flag-color, var(--wpmozo-pt-accent-fg));
	font-size: var(--wpmozo-pt-flag-size, 13px);
	font-weight: 600;
	white-space: nowrap;
}

.wpmozo-pt-viewport {
	overflow: hidden;
}

.wpmozo-pt-viewport.wpmozo-pt-has-flag {
	padding-left: 120px;
}

/* The moving track — duplicated in JS for a seamless loop */
.wpmozo-pt-track {
	display: flex;
	width: max-content;
	will-change: transform;
	animation: wpmozo-pt-scroll-left linear infinite;
	/* Duration is set inline by JS based on content width + speed. */
}

.wpmozo-pt-dir-right .wpmozo-pt-track {
	animation-name: wpmozo-pt-scroll-right;
}

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

/* Individual product (the whole item is a link) */
.wpmozo-pt-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 20px;
	border-right: 1px solid var(--wpmozo-pt-border);
	text-decoration: none;
	color: inherit;
	white-space: nowrap;
	flex: 0 0 auto;
}

.wpmozo-pt-item:hover .wpmozo-pt-name {
	text-decoration: underline;
}

.wpmozo-pt-thumb {
	width: var(--wpmozo-pt-thumb-size, 46px);
	height: var(--wpmozo-pt-thumb-height, 46px);
	max-width: 100%;
	flex-shrink: 0;
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.05);
}

.wpmozo-pt-thumb .wpmozo-pt-thumb-img,
.wpmozo-pt-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.wpmozo-pt-info {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 3px;
}

/* Portrait layout: thumbnail on top, text centred below, narrow upright items. */
.wpmozo-pt-layout-portrait .wpmozo-pt-item {
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	width: var(--wpmozo-pt-item-width, 160px);
	padding: 10px;
	/* Override the base nowrap so long names wrap instead of spilling over neighbours. */
	white-space: normal;
}

.wpmozo-pt-layout-portrait .wpmozo-pt-info {
	align-items: center;
	max-width: 100%;
}

.wpmozo-pt-layout-portrait .wpmozo-pt-name {
	overflow-wrap: anywhere;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}

/* Keep the price on one line even though the item allows wrapping. */
.wpmozo-pt-layout-portrait .wpmozo-pt-price-row {
	justify-content: center;
}

.wpmozo-pt-layout-portrait .wpmozo-pt-prices {
	white-space: nowrap;
}

.wpmozo-pt-name {
	font-size: var(--wpmozo-pt-title-size, 13px);
	color: var(--wpmozo-pt-title-color, inherit);
	font-weight: 600;
}

/* Price + sale badge on one line. */
.wpmozo-pt-price-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wpmozo-pt-prices {
	font-size: var(--wpmozo-pt-regular-size, 13px);
	color: var(--wpmozo-pt-regular-color, var(--wpmozo-pt-text));
}

.wpmozo-pt-prices del {
	color: var(--wpmozo-pt-regular-color, var(--wpmozo-pt-muted));
	margin-right: 6px;
	font-weight: 400;
}

.wpmozo-pt-prices ins {
	text-decoration: none;
	color: var(--wpmozo-pt-sale-price-color, inherit);
	font-size: var(--wpmozo-pt-sale-price-size, inherit);
	font-weight: 600;
}

.wpmozo-pt-badge {
	padding: 2px 8px;
	border-radius: 20px;
	font-size: var(--wpmozo-pt-sale-size, 11px);
	font-weight: 600;
	vertical-align: middle;
}

.wpmozo-pt-badge.wpmozo-pt-sale {
	background: var(--wpmozo-pt-sale-bg);
	color: var(--wpmozo-pt-sale-fg);
}

.wpmozo-pt-empty {
	padding: 12px 16px;
	border: 1px dashed #c9c9c9;
	border-radius: 8px;
	color: #6b6b6b;
	font-size: 13px;
}

/* Editor preview only: disable product links so clicks select the block.
   The wrapper class is added by the block's edit.js and never appears on the
   front end, so this rule is inert there. */
.wpmozo-pt-editor-preview .wpmozo-pt-item {
	pointer-events: none;
	cursor: default;
}

@keyframes wpmozo-pt-scroll-left {
	from {
		transform: translateX(0);
	}

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

@keyframes wpmozo-pt-scroll-right {
	from {
		transform: translateX(-50%);
	}

	to {
		transform: translateX(0);
	}
}

/* Accessibility: honour reduced-motion by stopping the scroll */
@media (prefers-reduced-motion: reduce) {
	.wpmozo-pt-track {
		animation: none !important;
		flex-wrap: wrap;
	}
}

/* Dark theme opt-in via a wrapper/body class */
.wpmozo-pt-bar.wpmozo-pt-skin-dark,
body.wpmozo-pt-dark .wpmozo-pt-bar {
	--wpmozo-pt-surface: #1c1c1e;
	--wpmozo-pt-border: #333336;
	--wpmozo-pt-text: #f2f2f2;
	--wpmozo-pt-muted: #a1a1a6;
	--wpmozo-pt-accent-bg: #23324d;
	--wpmozo-pt-accent-fg: #8fb4ff;
	--wpmozo-pt-sale-bg: #3a2020;
	--wpmozo-pt-sale-fg: #ff8f8a;
}

.wpmozo-pt-bar.wpmozo-pt-skin-dark .wpmozo-pt-thumb,
body.wpmozo-pt-dark .wpmozo-pt-thumb {
	background: rgba(255, 255, 255, 0.06);
}