.mpg-gallery-shortcode {
	--mpg-gap: 10px;
	--mpg-accent: #3c81a8;
	--mpg-navy: #0c1a2b;
	--mpg-thumbnail-ratio: 4 / 3;
	position: relative;
}

.mpg-gallery-shortcode .woocommerce-product-gallery {
	width: 100% !important;
	float: none !important;
}

.mpg-gallery-shortcode ol.flex-control-thumbs.flex-control-nav {
	display: flex !important;
	grid-template-columns: none !important;
	grid-template-rows: none !important;
	grid-auto-flow: initial !important;
	flex-wrap: nowrap !important;
	gap: var(--mpg-gap) !important;
	overflow-x: auto !important;
	overflow-y: hidden !important;
	margin: 12px 0 0 !important;
	padding: 0 !important;
	scroll-behavior: auto;
	scrollbar-width: none !important;
	-ms-overflow-style: none !important;
	touch-action: pan-x;
	-webkit-overflow-scrolling: touch;
}

.mpg-gallery-shortcode ol.flex-control-thumbs.flex-control-nav::-webkit-scrollbar {
	display: none !important;
}

.mpg-gallery-shortcode ol.flex-control-thumbs.flex-control-nav > li {
	display: block !important;
	flex: 0 0 calc((100% - (var(--mpg-gap) * 3)) / 4) !important;
	width: calc((100% - (var(--mpg-gap) * 3)) / 4) !important;
	max-width: calc((100% - (var(--mpg-gap) * 3)) / 4) !important;
	aspect-ratio: var(--mpg-thumbnail-ratio);
	margin: 0 !important;
	float: none !important;
	clear: none !important;
	list-style: none !important;
}

.mpg-gallery-shortcode ol.flex-control-thumbs.flex-control-nav img {
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	aspect-ratio: var(--mpg-thumbnail-ratio);
	object-fit: cover;
	box-sizing: border-box;
	border: 2px solid #e2e6e9;
	border-radius: 4px;
	opacity: 1 !important;
	cursor: pointer;
	transition: border-color 160ms ease;
}

.mpg-gallery-shortcode ol.flex-control-thumbs.flex-control-nav img:hover,
.mpg-gallery-shortcode ol.flex-control-thumbs.flex-control-nav img.flex-active {
	border-color: var(--mpg-accent);
	opacity: 1 !important;
}

.mpg-gallery-shortcode .flex-viewport {
	position: relative !important;
}

/* Disable WooCommerce's zoom and lightbox controls for this gallery. */
.mpg-gallery-shortcode .woocommerce-product-gallery__trigger,
.mpg-gallery-shortcode .zoomImg {
	display: none !important;
}

.mpg-gallery-shortcode .woocommerce-product-gallery__image,
.mpg-gallery-shortcode .woocommerce-product-gallery__image a,
.mpg-gallery-shortcode .woocommerce-product-gallery__image img {
	cursor: default !important;
}

.mpg-gallery-arrow {
	position: absolute;
	top: 50%;
	z-index: 40;
	display: grid !important;
	place-items: center;
	width: 44px;
	height: 52px;
	padding: 0;
	border: 1px solid rgba(12, 26, 43, 0.12);
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.94);
	color: var(--mpg-navy);
	box-shadow: 0 4px 16px rgba(12, 26, 43, 0.16);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.mpg-gallery-arrow svg {
	display: block;
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
}

.mpg-gallery-arrow:hover,
.mpg-gallery-arrow:focus-visible {
	background: var(--mpg-accent);
	border-color: var(--mpg-accent);
	color: #fff;
	box-shadow: 0 5px 18px rgba(60, 129, 168, 0.3);
}

.mpg-gallery-previous {
	left: 14px;
}

.mpg-gallery-next {
	right: 14px;
}

@media (max-width: 767px) {
	.mpg-gallery-shortcode ol.flex-control-thumbs.flex-control-nav > li {
		flex-basis: calc((100% - (var(--mpg-gap) * 2)) / 3) !important;
		width: calc((100% - (var(--mpg-gap) * 2)) / 3) !important;
		max-width: calc((100% - (var(--mpg-gap) * 2)) / 3) !important;
	}

	.mpg-gallery-arrow {
		width: 40px;
		height: 46px;
	}

	.mpg-gallery-previous {
		left: 8px;
	}

	.mpg-gallery-next {
		right: 8px;
	}
}
