/**
 * TTW Product Gallery V3
 * Version 3.0.0
 */

/*
 * The replacement is hidden until JavaScript has found and loaded
 * at least the first valid product image.
 */
.ttw-product-carousel {
	display: none;
}

/* =========================================================
   ACTIVATED GALLERY
   ========================================================= */

.single-product
.woocommerce-product-gallery.ttw-gallery-v3-active {
	position: relative !important;
	overflow: visible !important;
	opacity: 1 !important;
}

/*
 * Hide all native gallery children only after the replacement
 * carousel has loaded successfully.
 *
 * The native elements remain in the document for variations,
 * image data and WooCommerce lightbox functionality.
 */
.single-product
.woocommerce-product-gallery.ttw-gallery-v3-active
> *:not(.ttw-product-carousel) {
	position: absolute !important;
	top: 0 !important;
	left: -100000px !important;
	width: 100% !important;
	height: 1px !important;
	max-height: 1px !important;
	overflow: hidden !important;
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

.single-product
.woocommerce-product-gallery.ttw-gallery-v3-active
> .ttw-product-carousel {
	position: relative !important;
	top: auto !important;
	left: auto !important;
	display: block !important;
	width: 100% !important;
	height: auto !important;
	max-height: none !important;
	overflow: visible !important;
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
}

/* =========================================================
   SHARED CAROUSEL
   ========================================================= */

.ttw-product-carousel {
	position: relative;
	width: 100%;
	margin: 0;
	padding: 0;
	background: #f8f5f0;
	line-height: 0;
}

.ttw-product-carousel__viewport {
	position: relative;
	width: 100%;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	touch-action: pan-x pinch-zoom;
}

.ttw-product-carousel__viewport::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.ttw-product-carousel__track {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	width: max-content;
	min-width: 100%;
	margin: 0;
	padding: 0;
	gap: 0;
	line-height: 0;
}

.ttw-product-carousel__slide {
	position: relative;
	display: block;
	margin: 0;
	padding: 0;
	overflow: hidden;
	aspect-ratio: 3 / 4;
	border: 0;
	border-radius: 0;
	background: #f8f5f0;
	color: inherit;
	line-height: 0;
	box-shadow: none;
	cursor: zoom-in;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	appearance: none;
	-webkit-appearance: none;
}

.ttw-product-carousel__slide:hover,
.ttw-product-carousel__slide:focus,
.ttw-product-carousel__slide:active {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #f8f5f0;
	box-shadow: none;
}

.ttw-product-carousel__slide:focus-visible {
	z-index: 4;
	outline: 3px solid rgba(107, 44, 145, 0.72);
	outline-offset: -3px;
}

/*
 * Oversize each image by 6%.
 *
 * This removes thin embedded borders and reduces excess space
 * around the model without changing the uploaded image.
 */
.ttw-product-carousel__slide img {
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	object-position: center center;
	transform: translate(-50%, -50%) scale(1.06);
	transform-origin: center center;
}

/* Navigation arrows */

.ttw-product-carousel__arrow {
	position: absolute;
	top: 50%;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(44, 24, 16, 0.1);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	box-shadow: 0 3px 14px rgba(44, 24, 16, 0.14);
	color: #2c1810;
	cursor: pointer;
	transform: translateY(-50%);
	transition:
		background-color 160ms ease,
		color 160ms ease,
		opacity 160ms ease,
		box-shadow 160ms ease;
}

.ttw-product-carousel__arrow--previous {
	left: 16px;
}

.ttw-product-carousel__arrow--next {
	right: 16px;
}

.ttw-product-carousel__arrow:hover,
.ttw-product-carousel__arrow:focus-visible {
	border-color: #6b2c91;
	background: #6b2c91;
	color: #ffffff;
	outline: none;
}

.ttw-product-carousel__arrow:focus-visible {
	box-shadow:
		0 0 0 3px rgba(212, 175, 55, 0.45),
		0 3px 14px rgba(44, 24, 16, 0.14);
}

.ttw-product-carousel__arrow:disabled {
	opacity: 0.25;
	cursor: default;
	pointer-events: none;
}

.ttw-product-carousel__arrow svg {
	display: block;
	width: 19px;
	height: 19px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Counter */

.ttw-product-carousel__counter {
	position: absolute;
	right: 14px;
	bottom: 14px;
	z-index: 20;
	display: block;
	padding: 6px 10px;
	border: 1px solid rgba(44, 24, 16, 0.08);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.94);
	box-shadow: 0 2px 8px rgba(44, 24, 16, 0.08);
	color: #2c1810;
	font-family: Montserrat, Arial, sans-serif;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.02em;
	pointer-events: none;
}

/* Mobile zoom control */

.ttw-product-carousel__zoom {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 20;
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(44, 24, 16, 0.1);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	box-shadow: 0 3px 12px rgba(44, 24, 16, 0.12);
	color: #2c1810;
	cursor: pointer;
}

.ttw-product-carousel__zoom svg {
	display: block;
	width: 19px;
	height: 19px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ttw-product-carousel--single
.ttw-product-carousel__arrow,

.ttw-product-carousel--single
.ttw-product-carousel__counter {
	display: none !important;
}

/* =========================================================
   DESKTOP
   ========================================================= */

@media (min-width: 1024px) {

	/*
	 * Approximately 60% gallery and 36% product information,
	 * leaving room for the column gutter.
	 */
	.single-product div.product .woocommerce-product-gallery {
		width: 60% !important;
		max-width: 60% !important;
	}

	.single-product div.product .summary,
	.single-product div.product .entry-summary {
		width: 36% !important;
		max-width: 36% !important;
	}

	/*
	 * Two complete images with no centre gap.
	 */
	.ttw-product-carousel__slide {
		flex: 0 0 50%;
		width: 50%;
		max-width: 50%;
	}

	.ttw-product-carousel--single
	.ttw-product-carousel__slide {
		flex-basis: 100%;
		width: 100%;
		max-width: 100%;
	}
}

/* =========================================================
   MOBILE AND TABLET
   ========================================================= */

@media (max-width: 1023px) {

	.single-product div.product .woocommerce-product-gallery {
		width: 100% !important;
		max-width: 100% !important;
	}

	.single-product div.product .summary,
	.single-product div.product .entry-summary {
		width: 100% !important;
		max-width: 100% !important;
	}

	/*
	 * Make the replacement carousel edge-to-edge.
	 */
	.single-product .ttw-product-carousel {
		width: 100vw;
		max-width: 100vw;
		margin-left: calc(50% - 50vw);
		margin-right: calc(50% - 50vw);
	}

	/*
	 * Main image uses 80% of the viewport.
	 * Approximately 20% of the next image remains visible.
	 */
	.ttw-product-carousel__slide {
		flex: 0 0 80vw;
		width: 80vw;
		max-width: 80vw;
	}

	.ttw-product-carousel--single
	.ttw-product-carousel__slide {
		flex-basis: 100vw;
		width: 100vw;
		max-width: 100vw;
	}

	/*
	 * Mobile uses touch swipe, so large arrows are unnecessary.
	 */
	.ttw-product-carousel__arrow {
		display: none !important;
	}

	.ttw-product-carousel__zoom {
		display: flex;
	}

	.ttw-product-carousel__counter {
		right: 12px;
		bottom: 12px;
		padding: 5px 9px;
		font-size: 10px;
	}
}
/* =========================================================
   V3.0.2 MOBILE SWIPE AND SPACING FIX
   ========================================================= */

@media (max-width: 1023px) {

	/*
	 * Remove the unused space beneath the mobile header.
	 */
	.single-product .ttw-product-carousel {
		margin-top: -28px;
	}

	/*
	 * Vertical gestures remain available to the browser.
	 * Horizontal dragging is handled by the gallery JavaScript.
	 */
	.single-product .ttw-product-carousel__viewport {
		overflow-x: scroll !important;
		overflow-y: hidden !important;
		touch-action: pan-y pinch-zoom !important;
		-webkit-overflow-scrolling: touch !important;
		scroll-snap-type: x mandatory !important;
	}

	.single-product .ttw-product-carousel__track,
	.single-product button.ttw-product-carousel__slide {
		touch-action: pan-y pinch-zoom !important;
	}

	/*
	 * Temporarily disable snapping while the customer is
	 * actively dragging the carousel.
	 */
	.single-product
	.ttw-product-carousel__viewport.ttw-is-dragging {
		scroll-behavior: auto !important;
		scroll-snap-type: none !important;
		cursor: grabbing;
	}

	.single-product .ttw-product-carousel__slide img {
		pointer-events: none !important;
		user-select: none !important;
		-webkit-user-select: none !important;
		-webkit-user-drag: none !important;
	}

	.single-product button.ttw-product-carousel__slide {
		-webkit-tap-highlight-color: transparent;
	}
}
