/*
 * RAWW Product Carousel — styles
 * All selectors are prefixed with .raww- to avoid clashing with
 * Astra, Elementor, or WooCommerce default styles.
 */

.raww-product-carousel {
	margin: 2rem 0;
	box-sizing: border-box;
}

.raww-product-carousel *,
.raww-product-carousel *::before,
.raww-product-carousel *::after {
	box-sizing: border-box;
}

.raww-carousel-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

/* Outer carousel: native horizontal scroll + snap, no JS library required */
.raww-carousel-track {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding: 4px 4px 8px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox: hide scrollbar — prev/next buttons + swipe already cover navigation */
	-ms-overflow-style: none; /* old Edge/IE */
}

.raww-carousel-track::-webkit-scrollbar {
	display: none; /* Chrome/Safari: hide scrollbar */
}

.raww-product-card {
	flex: 0 0 calc(25% - 12px); /* Desktop: 4 visible */
	scroll-snap-align: start;
	min-width: 0;
}

@media (max-width: 1024px) {
	.raww-product-card {
		flex: 0 0 calc(33.333% - 11px); /* Tablet: ~3 visible */
	}
}

@media (max-width: 640px) {
	.raww-product-card {
		flex: 0 0 78%; /* Mobile: ~1.2–1.5 visible */
	}
}

/* Outer carousel prev/next buttons */
.raww-carousel-prev,
.raww-carousel-next {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.15) !important;
	background: #fff !important; /* override theme global button color */
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	font-weight: 700;
	line-height: 1;
	z-index: 3;
	padding: 0;
	color: #1a1a1a !important;
}

.raww-carousel-prev:hover,
.raww-carousel-next:hover {
	background: #1a1a1a !important;
	color: #fff !important;
}

.raww-carousel-prev {
	margin-right: 10px;
}

.raww-carousel-next {
	margin-left: 10px;
}

@media (max-width: 640px) {
	/* Mobile relies on swipe/scroll — hide outer arrows to keep UI clean */
	.raww-carousel-prev,
	.raww-carousel-next {
		display: none;
	}
}

/* Inner per-product image gallery */
.raww-product-gallery {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	border-radius: 6px;
	background: #f2f2f2;
	outline-offset: 2px;
}

.raww-gallery-link {
	display: block;
	width: 100%;
	height: 100%;
}

.raww-gallery-images {
	position: relative;
	width: 100%;
	height: 100%;
}

.raww-gallery-image {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important; /* override theme rules like Astra's global img { max-width: 100%; height: auto; } */
	object-fit: cover !important;
	opacity: 0;
	transition: opacity 0.35s ease;
}

.raww-gallery-image.is-active {
	opacity: 1;
}

/* Invisible left/right tap zones for prev/next (tap-only — see PHP comment).
   Sit above the product link so edge taps navigate images instead of
   following the link; the middle third of the image is left uncovered
   so it still links through to the product page. */
.raww-gallery-tap {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 33%;
	background: transparent !important; /* override theme global button color (e.g. Astra's Customizer "Buttons" color) */
	border: 0 !important;
	box-shadow: none !important;
	outline: none !important;
	margin: 0;
	padding: 0;
	cursor: pointer;
	z-index: 1;
	-webkit-tap-highlight-color: transparent;
}

.raww-gallery-tap-prev {
	left: 0;
}

.raww-gallery-tap-next {
	right: 0;
}

.raww-gallery-prev,
.raww-gallery-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none !important;
	background: rgba(255, 255, 255, 0.95) !important; /* override theme global button color */
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
	color: #1a1a1a !important;
	opacity: 0;
	transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
	z-index: 2; /* above .raww-gallery-tap so they stay independently clickable */
	padding: 0;
}

.raww-product-gallery:hover .raww-gallery-prev,
.raww-product-gallery:hover .raww-gallery-next,
.raww-gallery-prev:focus,
.raww-gallery-next:focus {
	opacity: 1;
}

.raww-gallery-prev:hover,
.raww-gallery-next:hover {
	background: #1a1a1a !important;
	color: #fff !important;
}

.raww-gallery-prev {
	left: 8px;
}

.raww-gallery-next {
	right: 8px;
}

/* Touch devices have no hover state to reveal the arrows on, so show them
   permanently there instead — otherwise touch users would have no visible
   way to browse a gallery besides discovering the invisible tap zones. */
@media (hover: none) {
	.raww-gallery-prev,
	.raww-gallery-next {
		opacity: 1;
	}
}

.raww-gallery-dots {
	position: absolute;
	bottom: 8px;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	z-index: 2; /* above .raww-gallery-tap */
}

.raww-dot {
	/* The button itself is the tap target (larger than it looks); the
	   small visible dot is drawn with ::after so hit area and visual
	   size can differ without misleading users about where to tap. */
	width: 28px;
	height: 28px;
	padding: 0;
	border: none !important;
	background: transparent !important; /* override theme global button color */
	box-shadow: none !important;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.raww-dot::after {
	content: '';
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.6);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.raww-dot.is-active::after {
	background: #fff;
}

.raww-product-info {
	padding: 10px 2px 0;
	text-align: center;
}

.raww-product-title {
	display: block;
	font-size: 14px;
	line-height: 1.4;
	text-decoration: none;
	color: inherit;
	margin-bottom: 4px;
}

.raww-product-title:hover {
	text-decoration: underline;
}

.raww-product-price {
	font-size: 14px;
	font-weight: 600;
}

.raww-product-price del {
	opacity: 0.6;
	font-weight: 400;
	margin-right: 4px;
}

/* Respect users who have asked for reduced motion */
@media (prefers-reduced-motion: reduce) {
	.raww-gallery-image {
		transition: none;
	}
	.raww-carousel-track {
		scroll-behavior: auto;
	}
}
