/**
 * Product gallery — main image, thumbnail strip, nav buttons
 * Matches Figma: MedievalExtreme product page gallery
 */

.product_layout_classic .product-images-wrapper .woocommerce-product-gallery {
	--mx-gallery-border: #e5e5e5;
	--mx-gallery-radius: 12px;
	--mx-gallery-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	--mx-gallery-divider: #e0e0e0;
	--mx-gallery-nav-size: 40px;
	--mx-gallery-nav-inset: 16px;
	--mx-gallery-nav-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

@media (min-width: 992px) {
	.product_layout_classic .product-images-wrapper .woocommerce-product-gallery {
		align-items: flex-start;
		gap: 12px;
	}

	.product_layout_classic .product-images-wrapper .woocommerce-product-gallery ol.flex-control-thumbs {
		display: flex !important;
		flex-direction: column;
		align-items: stretch;
		order: 1;
		flex: 0 0 16%;
		box-sizing: border-box;
		width: 16% !important;
		max-height: none !important;
		margin: 0 !important;
		padding: 12px 0 !important;
		list-style: none;
		background: #fff;
		border: 1px solid var(--mx-gallery-border);
		border-radius: var(--mx-gallery-radius);
		box-shadow: var(--mx-gallery-shadow);
		overflow-x: hidden;
		overflow-y: auto;
	}

	.product_layout_classic .product-images-wrapper .woocommerce-product-gallery ol.flex-control-thumbs li {
		position: relative;
		width: 100% !important;
		padding: 0 12px !important;
		margin: 0 !important;
		box-sizing: border-box;
		flex: 0 0 auto;
	}

	.product_layout_classic .product-images-wrapper .woocommerce-product-gallery ol.flex-control-thumbs li:not(:last-child) {
		padding-bottom: 0 !important;
	}

	.product_layout_classic .product-images-wrapper .woocommerce-product-gallery ol.flex-control-thumbs li:not(:last-child)::after {
		content: "";
		display: block;
		height: 1px;
		margin: 12px 8px;
		background: var(--mx-gallery-divider);
	}

	.product_layout_classic .product-images-wrapper .woocommerce-product-gallery ol.flex-control-thumbs li img {
		display: block;
		width: 100%;
		height: auto;
		border-radius: 4px;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage {
		position: relative;
		order: 2;
		box-sizing: border-box;
		flex: 1 1 0;
		width: auto !important;
		min-width: 0;
		aspect-ratio: 1 / 1;
		height: auto !important;
		background: #fff;
		border: 1px solid var(--mx-gallery-border);
		border-radius: var(--mx-gallery-radius);
		box-shadow: var(--mx-gallery-shadow);
		overflow: hidden;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .flex-viewport {
		position: absolute !important;
		top: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		left: 0 !important;
		width: 100% !important;
		height: 100% !important;
		margin: 0 !important;
		border: 0 !important;
		border-radius: 0 !important;
		box-shadow: none !important;
		overflow: hidden !important;
		background: #fff;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__wrapper {
		height: 100% !important;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__image {
		position: relative !important;
		height: 100% !important;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__image > a {
		display: block;
		position: relative;
		width: 100%;
		height: 100%;
		overflow: hidden;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__image img.wp-post-image,
	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__image > a > img:not(.zoomImg) {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		display: block;
		width: 100%;
		height: 100%;
		max-width: none;
		margin: 0;
		object-fit: contain;
		object-position: center;
	}

	/* Keep zoom layered, but do NOT lock top/left — jquery.zoom moves them */
	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .zoomImg,
	.product_layout_classic .product-images-wrapper .woocommerce-product-gallery__wrapper .zoomImg {
		position: absolute !important;
		z-index: 2 !important;
		max-width: none !important;
		max-height: none !important;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .easyzoom-flyout {
		z-index: 2 !important;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage.is-nav-hover .zoomImg,
	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage.is-nav-hover .easyzoom-flyout {
		opacity: 0 !important;
		visibility: hidden !important;
		pointer-events: none !important;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav {
		position: absolute;
		top: 50%;
		z-index: 300;
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: var(--mx-gallery-nav-size);
		height: var(--mx-gallery-nav-size);
		padding: 0;
		margin: 0;
		border: 1px solid var(--mx-gallery-border);
		border-radius: 50%;
		background: #fff;
		box-shadow: var(--mx-gallery-nav-shadow);
		color: #000;
		cursor: pointer;
		pointer-events: auto;
		transform: translateY(-50%);
		transition: opacity 0.2s ease, box-shadow 0.2s ease;
		-webkit-appearance: none;
		appearance: none;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav:hover,
	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav:focus {
		opacity: 1;
		outline: none;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav:focus-visible {
		outline: 2px solid #000;
		outline-offset: 2px;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav--prev {
		left: var(--mx-gallery-nav-inset);
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav--next {
		right: var(--mx-gallery-nav-inset);
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav svg {
		display: block;
		width: 14px;
		height: 14px;
		pointer-events: none;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav[disabled],
	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav.is-disabled {
		opacity: 0.35;
		cursor: default;
		pointer-events: none;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav.is-hidden {
		display: none !important;
	}
}

@media (max-width: 991px) {
	.product_layout_classic .product-images-wrapper .woocommerce-product-gallery.mx-gallery-mobile {
		display: flex;
		flex-direction: column;
		align-items: stretch;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage {
		position: relative;
		order: 0;
		box-sizing: border-box;
		width: 100% !important;
		aspect-ratio: 1 / 1;
		height: auto !important;
		background: #fff;
		border: 1px solid var(--mx-gallery-border, #e5e5e5);
		border-radius: var(--mx-gallery-radius, 12px);
		box-shadow: var(--mx-gallery-shadow, 0 4px 20px rgba(0, 0, 0, 0.08));
		overflow: hidden;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .flex-viewport {
		position: absolute !important;
		top: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		left: 0 !important;
		width: 100% !important;
		height: 100% !important;
		margin: 0 !important;
		overflow: hidden !important;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__wrapper,
	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__image,
	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__image > a {
		height: 100% !important;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__image img.wp-post-image,
	.product_layout_classic .product-images-wrapper .mx-product-gallery-stage .woocommerce-product-gallery__image > a > img:not(.zoomImg) {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 100%;
		object-fit: contain;
		object-position: center;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav {
		position: absolute;
		top: 50%;
		z-index: 300;
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: var(--mx-gallery-nav-size, 40px);
		height: var(--mx-gallery-nav-size, 40px);
		padding: 0;
		margin: 0;
		border: 1px solid var(--mx-gallery-border, #e5e5e5);
		border-radius: 50%;
		background: #fff;
		box-shadow: var(--mx-gallery-nav-shadow, 0 4px 8px rgba(0, 0, 0, 0.1));
		color: #000;
		cursor: pointer;
		pointer-events: auto;
		transform: translateY(-50%);
		-webkit-appearance: none;
		appearance: none;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav--prev {
		left: 12px;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav--next {
		right: 12px;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav svg {
		display: block;
		width: 14px;
		height: 14px;
		pointer-events: none;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav[disabled],
	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav.is-disabled {
		opacity: 0.35;
		pointer-events: none;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-nav.is-hidden {
		display: none !important;
	}

	/* Bullets under the photo */
	.product_layout_classic .product-images-wrapper .mx-product-gallery-pager {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		align-items: center;
		gap: 8px;
		width: 100%;
		margin: 14px 0 0;
		padding: 0;
		order: 1;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-pager.is-hidden {
		display: none;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-pager__dot {
		width: 8px;
		height: 8px;
		padding: 0;
		margin: 0;
		border: 0;
		border-radius: 50%;
		background: #cfcfcf;
		cursor: pointer;
		-webkit-appearance: none;
		appearance: none;
	}

	.product_layout_classic .product-images-wrapper .mx-product-gallery-pager__dot.is-active,
	.product_layout_classic .product-images-wrapper .mx-product-gallery-pager__dot:hover,
	.product_layout_classic .product-images-wrapper .mx-product-gallery-pager__dot:focus {
		background: #000;
		outline: none;
	}

	/* Prefer custom controls; hide lightSlider native ones to avoid duplicates */
	.product_layout_classic .product-images-wrapper .lSAction,
	.product_layout_classic .product-images-wrapper .lSSlideOuter .lSPager.lSpg {
		display: none !important;
	}

	.product_layout_classic .product-images-wrapper .lSSlideWrapper.mx-product-gallery-stage,
	.product_layout_classic .product-images-wrapper .lSSlideWrapper {
		position: relative;
		width: 100%;
		aspect-ratio: 1 / 1;
		background: #fff;
		border: 1px solid #e5e5e5;
		border-radius: 12px;
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
		overflow: hidden;
	}
}
