/* Amazon-style: one large main image + horizontal thumb strip. */

.wpsm-thumb-gallery,
.wpsm-thumb-gallery * {
	box-sizing: border-box;
}

.wpsm-thumb-gallery {
	display: block;
	width: 100%;
	margin: 10px 0 0;
	padding: 0;
	clear: both;
}

.wpsm-thumb-gallery__track {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: flex-start !important;
	justify-content: flex-start !important;
	gap: 10px;
	width: 100%;
	margin: 0 !important;
	padding: 0 !important;
	overflow-x: auto;
	list-style: none !important;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.wpsm-thumb-gallery__item {
	display: block !important;
	flex: 0 0 auto;
	width: auto;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.wpsm-thumb-gallery__button {
	appearance: none;
	-webkit-appearance: none;
	display: flex !important;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 72px;
	height: 72px;
	min-width: 72px;
	min-height: 72px;
	max-width: 72px;
	max-height: 72px;
	margin: 0;
	padding: 0;
	border: 2px solid #d5d9d9;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	overflow: hidden;
	line-height: 0;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wpsm-thumb-gallery__button:hover {
	border-color: #a2a6a6;
}

.wpsm-thumb-gallery__item.is-active .wpsm-thumb-gallery__button {
	border-color: #007185;
	box-shadow: 0 0 0 1px #007185 inset;
}

.wpsm-thumb-gallery__media {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.wpsm-thumb-gallery__img {
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	object-fit: cover;
	object-position: center;
}

.wpsm-thumb-gallery__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.72);
}

.wpsm-thumb-gallery__play::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 54%;
	width: 0;
	height: 0;
	margin: -6px 0 0 -5px;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
	border-left: 9px solid #fff;
}

/* Flatsome uses .slide.first; standard Woo / page builder use .wpsm-main-stage on the featured image. */
body.wpsm-has-thumb-gallery .product-gallery-slider .slide:not(.first),
body.wpsm-has-thumb-gallery .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:not(.first):not(.wpsm-main-stage) {
	display: none !important;
}

body.wpsm-has-thumb-gallery .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image.wpsm-main-stage {
	display: block !important;
}

body.wpsm-has-thumb-gallery .product-gallery-slider .flickity-prev-next-button,
body.wpsm-has-thumb-gallery .product-gallery-slider .flickity-page-dots {
	display: none !important;
}

body.wpsm-has-thumb-gallery .wpsm-main-stage img.wp-post-image,
body.wpsm-has-thumb-gallery .product-gallery-slider .slide.first img,
body.wpsm-has-thumb-gallery .woocommerce-product-gallery__image.wpsm-main-stage img {
	width: 100%;
	height: auto;
	max-width: 100%;
}

/* Zoom / lightbox controls: main image only, on hover or focus. */
body.wpsm-has-thumb-gallery .wpsm-main-image-tools,
body.wpsm-has-thumb-gallery .wpsm-main-stage .image-tools,
body.wpsm-has-thumb-gallery .slide.first .image-tools {
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	z-index: 5;
}

body.wpsm-has-thumb-gallery .wpsm-main-stage:hover .image-tools,
body.wpsm-has-thumb-gallery .wpsm-main-stage:focus-within .image-tools,
body.wpsm-has-thumb-gallery .wpsm-main-stage.wpsm-stage-active .image-tools,
body.wpsm-has-thumb-gallery .slide.first:hover .image-tools,
body.wpsm-has-thumb-gallery .slide.first:focus-within .image-tools,
body.wpsm-has-thumb-gallery .slide.first.wpsm-stage-active .image-tools {
	opacity: 1;
	pointer-events: auto;
}

body.wpsm-has-thumb-gallery .wpsm-thumb-gallery {
	position: relative;
	z-index: 6;
	margin-top: 14px;
}

.wpsm-main-stage__video {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: var(--wpsm-stage-height, 320px);
	height: var(--wpsm-stage-height, 320px);
	background-color: #111;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	overflow: hidden;
}

.wpsm-video-stage-backdrop {
	position: absolute;
	inset: 0;
	background-color: inherit;
	background-image: inherit;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	filter: blur(14px) brightness(0.45);
	transform: scale(1.08);
}

.wpsm-video-stage-inner {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	max-height: var(--wpsm-stage-height, 320px);
}

.wpsm-main-stage__video .wpsm-video-embed {
	position: relative;
	width: min(100%, calc(var(--wpsm-stage-height, 320px) * 1.7778));
	max-width: 100%;
	height: auto;
	padding-top: 0;
	aspect-ratio: 16 / 9;
	max-height: var(--wpsm-stage-height, 320px);
	margin: 0 auto;
	background: transparent;
}

.wpsm-main-stage__video .wpsm-video-embed iframe,
.wpsm-main-stage__video .wpsm-video-embed embed,
.wpsm-main-stage__video .wpsm-video-embed object {
	position: relative;
	top: auto;
	left: auto;
	width: 100%;
	height: 100%;
	border: 0;
}

.wpsm-main-stage__video .wpsm-submedia-video {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: var(--wpsm-stage-height, 320px);
	margin: 0 auto;
	background: transparent;
	object-fit: contain;
}

body.wpsm-has-thumb-gallery .product-thumbnails,
body.wpsm-has-thumb-gallery .product-gallery-thumbnails,
body.wpsm-has-thumb-gallery .product-gallery-stacked-thumbnails,
body.wpsm-has-thumb-gallery .woocommerce-product-gallery__trigger {
	display: none !important;
}
