/* ==========================================================================
 * Product gallery + zoom/lightbox (wpb-theme)
 * Template-rendered from image IDs. Zero JS dependencies.
 * ========================================================================== */

.wpb-gallery {
	width: 100%;
}

.wpb-gallery-main {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--bg-alt);
	cursor: zoom-in;
}

.wpb-gallery-img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--radius);
}

/* Zoom result panel — only shown on hover-capable pointers. */
.wpb-gallery-zoom {
	position: absolute;
	top: 0;
	left: calc(100% + 12px);
	width: 320px;
	height: 320px;
	background-repeat: no-repeat;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow-md);
	z-index: 40;
	pointer-events: none;
}

/* Thumbnail strip. */
.wpb-gallery-thumbs {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	margin-top: 12px;
	overflow-x: auto;
	padding-bottom: 4px;
	-webkit-overflow-scrolling: touch;
}

.wpb-gallery-thumb {
	flex: 0 0 auto;
	padding: 0;
	border: 2px solid transparent;
	border-radius: var(--radius);
	background: none;
	cursor: pointer;
	line-height: 0;
	overflow: hidden;
	opacity: 0.72;
	transition: opacity .15s ease, border-color .15s ease;
}

.wpb-gallery-thumb img {
	display: block;
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: calc(var(--radius) - 2px);
}

.wpb-gallery-thumb:hover {
	opacity: 1;
}

.wpb-gallery-thumb[data-active="true"] {
	border-color: var(--brand);
	opacity: 1;
}

/* ==========================================================================
 * Lightbox (touch / tap-to-zoom)
 * ========================================================================== */
.wpb-lightbox {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(17, 15, 13, 0.92);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease, visibility .2s ease;
}

.wpb-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.wpb-lightbox img {
	display: block;
	max-width: 92vw;
	max-height: 82vh;
	object-fit: contain;
	border-radius: var(--radius);
	user-select: none;
}

.wpb-lightbox-close,
.wpb-lightbox-prev,
.wpb-lightbox-next {
	position: absolute;
	border: 0;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpb-lightbox-close { top: 16px; right: 16px; }
.wpb-lightbox-prev  { left: 12px; top: 50%; transform: translateY(-50%); }
.wpb-lightbox-next  { right: 12px; top: 50%; transform: translateY(-50%); }

.wpb-lightbox-prev:hover,
.wpb-lightbox-next:hover,
.wpb-lightbox-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

.wpb-lightbox-counter {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, 0.85);
	font-size: 13px;
}

/* Zoom lens only makes sense on hover-capable pointers. */
@media (hover: hover) and (pointer: fine) {
	.wpb-gallery-main:hover .wpb-gallery-zoom {
		display: block;
	}
}
