/* =====================================================================
   Woo Elementor Gallery Carousel
   - Main image locked to 4:3
   - Thumbnails locked to 4:3, 4 visible at a time, carousel navigation
   ===================================================================== */

/* ---------- Main image ---------- */
.woocommerce-product-gallery .woocommerce-product-gallery__image,
.woocommerce-product-gallery .woocommerce-product-gallery__image--placeholder,
.woocommerce-product-gallery .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	position: relative;
}

.woocommerce-product-gallery .woocommerce-product-gallery__image a,
.woocommerce-product-gallery .woocommerce-product-gallery__image > a {
	display: block;
	width: 100%;
	height: 100%;
}

.woocommerce-product-gallery .woocommerce-product-gallery__image img,
.woocommerce-product-gallery .woocommerce-product-gallery__image a img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
	object-position: center center;
	display: block;
}

/* Elementor wraps the gallery; make sure nothing stretches it */
.elementor-widget-woocommerce-product-images .woocommerce-product-gallery {
	width: 100%;
}

/* ---------- Thumbnail carousel wrapper ---------- */
.weg-thumbs-wrapper {
	position: relative;
	margin-top: 12px;
	padding: 0 44px; /* room for arrows */
	box-sizing: border-box;
}

/* When there are 4 or fewer thumbs we add .weg-no-nav and remove arrow padding */
.weg-thumbs-wrapper.weg-no-nav {
	padding: 0;
}

/* The list that originally came from WooCommerce (flex-control-thumbs) */
.woocommerce-product-gallery .flex-control-thumbs,
.woocommerce-product-gallery ol.flex-control-nav.flex-control-thumbs {
	display: flex !important;
	flex-wrap: nowrap !important;
	gap: 10px;
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
}

.woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar {
	display: none; /* Chrome / Safari */
}

.woocommerce-product-gallery .flex-control-thumbs li {
	flex: 0 0 calc((100% - 30px) / 4); /* 4 visible, 3 gaps of 10px */
	max-width: calc((100% - 30px) / 4);
	margin: 0 !important;
	padding: 0 !important;
	width: auto !important;
	list-style: none !important;
	scroll-snap-align: start;
	cursor: pointer;
}

.woocommerce-product-gallery .flex-control-thumbs li img {
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	object-position: center center;
	display: block;
	border-radius: 4px;
	opacity: 0.75;
	transition: opacity 0.2s ease, outline-color 0.2s ease;
	outline: 2px solid transparent;
	outline-offset: -2px;
	box-sizing: border-box;
}

.woocommerce-product-gallery .flex-control-thumbs li img:hover {
	opacity: 1;
}

.woocommerce-product-gallery .flex-control-thumbs li img.flex-active,
.woocommerce-product-gallery .flex-control-thumbs li.weg-active img {
	opacity: 1;
	outline-color: currentColor;
}

/* ---------- Main image nav wrapper ---------- */
.weg-main-wrapper {
	position: relative;
}

/* ---------- Navigation arrows (shared base) ---------- */
/* High-specificity selectors + !important to beat theme button styles */
.weg-thumbs-wrapper button.weg-nav,
.weg-main-wrapper button.weg-nav,
.woocommerce .weg-thumbs-wrapper button.weg-nav,
.woocommerce .weg-main-wrapper button.weg-nav,
.woocommerce-page .weg-thumbs-wrapper button.weg-nav,
.woocommerce-page .weg-main-wrapper button.weg-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	min-width: 0;
	min-height: 0;
	border-radius: 0 !important;
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border: 0 !important;
	box-shadow: none !important;
	cursor: pointer;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
	margin: 0 !important;
	color: #F28D65 !important;
	font-size: 0;
	line-height: 1;
	text-shadow: none;
	text-transform: none;
	letter-spacing: 0;
	transition: transform 0.15s ease, opacity 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.weg-thumbs-wrapper button.weg-nav:hover,
.weg-main-wrapper button.weg-nav:hover,
.woocommerce .weg-thumbs-wrapper button.weg-nav:hover,
.woocommerce .weg-main-wrapper button.weg-nav:hover,
.woocommerce-page .weg-thumbs-wrapper button.weg-nav:hover,
.woocommerce-page .weg-main-wrapper button.weg-nav:hover {
	background: transparent !important;
	background-color: transparent !important;
	color: #F28D65 !important;
	transform: translateY(-50%) scale(1.12);
	box-shadow: none !important;
}

.weg-thumbs-wrapper button.weg-nav:focus,
.weg-thumbs-wrapper button.weg-nav:active,
.weg-main-wrapper button.weg-nav:focus,
.weg-main-wrapper button.weg-nav:active {
	background: transparent !important;
	background-color: transparent !important;
	color: #F28D65 !important;
	outline: none;
	box-shadow: none !important;
}

.weg-thumbs-wrapper button.weg-nav:focus-visible,
.weg-main-wrapper button.weg-nav:focus-visible {
	outline: 2px solid #F28D65;
	outline-offset: 2px;
}

.weg-nav-prev { left: 0; }
.weg-nav-next { right: 0; }

.weg-nav svg {
	width: 24px;
	height: 24px;
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---------- Main image nav: larger size ---------- */
.weg-main-wrapper button.weg-nav,
.woocommerce .weg-main-wrapper button.weg-nav,
.woocommerce-page .weg-main-wrapper button.weg-nav {
	width: 56px;
	height: 56px;
	z-index: 10;
}

.weg-main-wrapper .weg-nav-prev { left: 12px; }
.weg-main-wrapper .weg-nav-next { right: 12px; }

.weg-main-wrapper .weg-nav svg {
	width: 36px;
	height: 36px;
	stroke-width: 3;
}

/* ---------- Responsive: fewer thumbs on small screens ---------- */
@media (max-width: 767px) {
	.woocommerce-product-gallery .flex-control-thumbs li {
		flex-basis: calc((100% - 20px) / 3); /* 3 visible on tablet */
		max-width: calc((100% - 20px) / 3);
	}
}

@media (max-width: 479px) {
	.woocommerce-product-gallery .flex-control-thumbs li {
		flex-basis: calc((100% - 20px) / 3); /* keep 3 on mobile */
		max-width: calc((100% - 20px) / 3);
	}
	.weg-thumbs-wrapper {
		padding: 0 36px;
	}
	.weg-thumbs-wrapper button.weg-nav {
		width: 32px;
		height: 32px;
	}
	.weg-thumbs-wrapper .weg-nav svg {
		width: 20px;
		height: 20px;
	}
	.weg-main-wrapper button.weg-nav {
		width: 44px;
		height: 44px;
	}
	.weg-main-wrapper .weg-nav svg {
		width: 28px;
		height: 28px;
	}
	.weg-main-wrapper .weg-nav-prev { left: 6px; }
	.weg-main-wrapper .weg-nav-next { right: 6px; }
}
