/* ==========================================================================
   WC Uniform Gallery — base + desktop.
   The mobile block and every size value are printed inline from the settings
   (see wcug_inline_css() in the main plugin file), so nothing here needs
   editing to change the look. Values below are only fallbacks.
   ========================================================================== */

:root {
	--wcug-ratio: 3 / 4;
	--wcug-thumb-ratio: 3 / 4;
	--wcug-fit: cover;
	--wcug-thumb-w: 86px;
	--wcug-gap: 16px;
	--wcug-radius: 6px;
	--wcug-bg: #f5f4f2;
	--wcug-accent: #2f3438;
	--wcug-slide-w: 88%;
	--wcug-mobile-gap: 10px;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
.wcug {
	display: grid !important;
	grid-template-columns: var(--wcug-thumb-w) minmax(0, 1fr);
	grid-template-areas: "rail stage";
	align-items: stretch;
	gap: var(--wcug-gap);
	position: relative;
	margin-bottom: 1.5em;
}

/* Anything left over from WooCommerce's FlexSlider. */
.wcug .flex-viewport,
.wcug .flex-control-nav,
.wcug .flex-direction-nav {
	display: none !important;
}

.wcug__rail  { grid-area: rail; }
.wcug__stage { grid-area: stage; }

/* --------------------------------------------------------------------------
   Stage and track — one scroll container serves desktop and mobile
   -------------------------------------------------------------------------- */
.wcug__stage {
	position: relative;
	min-width: 0;
}

.wcug .wcug__track {
	display: flex;
	flex-wrap: nowrap;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	outline: none;
}

.wcug .wcug__track::-webkit-scrollbar {
	width: 0;
	height: 0;
	display: none;
}

.wcug .wcug__track > .wcug__slide {
	flex: 0 0 100%;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0;
	scroll-snap-align: center;
	scroll-snap-stop: normal;
	list-style: none;
}

/* The uniform frame. Width is fluid, height comes from the ratio, so every
   slide ends up pixel-identical whatever the source file is.
   !important on these four only: themes routinely ship
   `div.images img { width/height }` rules at higher specificity, and if one of
   them wins the frames stop matching each other. */
.wcug .wcug__track > .wcug__slide img,
.wcug .wcug__track > .wcug__slide a img {
	display: block;
	width: 100% !important;
	height: auto !important;
	aspect-ratio: var(--wcug-ratio) !important;
	object-fit: var(--wcug-fit) !important;
	object-position: center center;
	background: var(--wcug-bg);
	border-radius: var(--wcug-radius);
	margin: 0;
	max-width: none;
	min-height: 0;
	box-shadow: none;
}

.wcug .wcug__track > .wcug__slide a {
	display: block;
	line-height: 0;
	border: 0;
	box-shadow: none;
}

/* --------------------------------------------------------------------------
   Thumbnail rail
   -------------------------------------------------------------------------- */
.wcug__rail {
	display: flex;
	flex-direction: column;
	min-height: 0;
	min-width: 0;
	gap: 6px;
}

.wcug__thumbs {
	display: flex;
	flex-direction: column;
	gap: var(--wcug-mobile-gap);
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	scroll-behavior: smooth;
	overscroll-behavior-y: contain;
	scrollbar-width: none;
	padding: 2px;
	margin: -2px;
}

.wcug__thumbs::-webkit-scrollbar { width: 0; display: none; }

.wcug__thumb {
	flex: 0 0 auto;
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	border-radius: var(--wcug-radius);
	overflow: hidden;
	opacity: 0.62;
	transition: opacity 0.25s ease, box-shadow 0.25s ease;
	-webkit-appearance: none;
	appearance: none;
	line-height: 0;
	min-height: 0;
}

.wcug__thumb:hover { opacity: 0.85; }

.wcug__thumb.is-active {
	opacity: 1;
	box-shadow: 0 0 0 2px var(--wcug-accent);
}

.wcug__thumb:focus-visible {
	outline: 2px solid var(--wcug-accent);
	outline-offset: 2px;
}

.wcug__thumb img,
.wcug__thumbimg {
	display: block;
	width: 100% !important;
	height: auto !important;
	aspect-ratio: var(--wcug-thumb-ratio) !important;
	object-fit: cover !important;
	object-position: center center;
	background: var(--wcug-bg);
	border-radius: var(--wcug-radius);
	margin: 0;
	max-width: none;
	box-shadow: none;
}

/* Up / down chevrons, one above the column and one below it. */
.wcug__railnav {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 24px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	color: inherit;
	opacity: 0.6;
	transition: opacity 0.2s ease;
}

.wcug__railnav:hover { opacity: 1; }
.wcug__railnav[hidden] { display: none; }
.wcug__railnav[disabled] { opacity: 0.2; cursor: default; }

.wcug__railnav svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Zoom trigger
   -------------------------------------------------------------------------- */
.wcug .woocommerce-product-gallery__trigger {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
	color: #222;
	text-indent: 0;
	font-size: 0;
	transition: transform 0.2s ease;
}

.wcug .woocommerce-product-gallery__trigger:hover { transform: scale(1.06); }
.wcug .woocommerce-product-gallery__trigger::before,
.wcug .woocommerce-product-gallery__trigger::after { display: none; }

.wcug__zoom svg {
	width: 19px;
	height: 19px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

/* --------------------------------------------------------------------------
   Stage arrows (desktop, on hover)
   -------------------------------------------------------------------------- */
.wcug__arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
	color: #222;
	cursor: pointer;
	opacity: 0;
	transform: translateY(-50%);
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.wcug__arrow--prev { left: 12px; }
.wcug__arrow--next { right: 12px; }

.wcug__arrow svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.wcug__stage:hover .wcug__arrow,
.wcug__arrow:focus-visible { opacity: 1; pointer-events: auto; }
.wcug__arrow[disabled] { opacity: 0 !important; pointer-events: none; }

/* --------------------------------------------------------------------------
   Dots — hidden on desktop, switched on by the inline mobile block
   -------------------------------------------------------------------------- */
.wcug__dots {
	display: none;
	grid-area: dots;
	justify-content: center;
	align-items: center;
	gap: 8px;
	padding: 12px 0 2px;
}

.wcug__dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wcug-accent);
	opacity: 0.25;
	cursor: pointer;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.wcug__dot.is-active { opacity: 0.9; transform: scale(1.2); }

/* --------------------------------------------------------------------------
   Fallbacks
   -------------------------------------------------------------------------- */
@supports not (aspect-ratio: 1 / 1) {
	.wcug .wcug__track > .wcug__slide,
	.wcug__thumb { position: relative; }

	.wcug .wcug__track > .wcug__slide img,
	.wcug__thumb img {
		position: absolute;
		top: 0;
		left: 0;
		width: 100% !important;
		height: 100% !important;
	}

	.wcug .wcug__track > .wcug__slide::before,
	.wcug__thumb::before { content: ""; display: block; padding-top: 125%; }
}

@media (prefers-reduced-motion: reduce) {
	.wcug .wcug__track,
	.wcug__thumbs { scroll-behavior: auto; }
	.wcug .wcug__track > .wcug__slide img { transition: none; }
}
