/* Mobile product gallery: one square main image + single thumb row.
   Hides Woo/OceanWP flex-control-thumbs (the 4-column grid). Desktop unchanged. */

@media (max-width: 768px) {
	.sb-pdp-has-gallery .elementor-widget-woocommerce-product-images,
	.sb-pdp-has-gallery .elementor-widget-woocommerce-product-images .elementor-widget-container {
		width: 100% !important;
		max-width: 100% !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery.sb-pdp-gallery-on {
		display: flex !important;
		flex-direction: column !important;
		width: 100% !important;
		max-width: none !important;
		overflow: hidden !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery.sb-pdp-gallery-on .flex-viewport,
	.sb-pdp-has-gallery .woocommerce-product-gallery.sb-pdp-gallery-on .woocommerce-product-gallery__wrapper {
		order: 1 !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery.sb-pdp-gallery-on .sb-pdp-gallery-strip {
		order: 2 !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery .flex-control-thumbs,
	.sb-pdp-has-gallery .woocommerce-product-gallery ol.flex-control-nav,
	.sb-pdp-has-gallery .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs,
	.sb-pdp-has-gallery .woocommerce-product-gallery .flex-direction-nav {
		display: none !important;
		height: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
		overflow: hidden !important;
		order: 3 !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery.sb-pdp-gallery-on .flex-viewport,
	.sb-pdp-has-gallery .woocommerce-product-gallery__wrapper,
	.sb-pdp-has-gallery figure.woocommerce-product-gallery__wrapper {
		display: block !important;
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
		padding: 0 !important;
		float: none !important;
		left: 0 !important;
		transform: none !important;
		-webkit-transform: none !important;
		columns: auto !important;
		column-count: 1 !important;
		grid-template-columns: none !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery__image:not(:first-child) {
		display: none !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery__image:first-child {
		display: block !important;
		opacity: 1 !important;
		visibility: visible !important;
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		float: none !important;
		aspect-ratio: 1 / 1;
		overflow: hidden;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery__image:first-child a,
	.sb-pdp-has-gallery .woocommerce-product-gallery__image:first-child img {
		display: block !important;
		width: 100% !important;
		height: 100% !important;
		max-width: none !important;
		aspect-ratio: 1 / 1;
		object-fit: cover !important;
	}

	.sb-pdp-gallery-strip {
		box-sizing: border-box;
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		gap: 8px;
		width: 100% !important;
		max-width: none !important;
		margin: 8px 0 4px;
		padding: 8px 4px;
		background: #fff;
		border: 1px solid #ececec;
		border-radius: 12px;
	}

	.sb-pdp-gallery-arrow,
	.sb-pdp-gallery-arrow:hover,
	.sb-pdp-gallery-arrow:active,
	.sb-pdp-gallery-arrow:focus,
	.sb-pdp-gallery-arrow:focus-visible {
		flex: 0 0 28px;
		width: 28px;
		height: 28px;
		padding: 0 !important;
		border: 0 !important;
		border-radius: 50% !important;
		background: #ededed !important;
		color: #555 !important;
		box-shadow: none !important;
		outline: none !important;
		cursor: pointer;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		z-index: 2;
	}

	.sb-pdp-gallery-arrow svg {
		width: 16px;
		height: 16px;
		display: block;
	}

	.sb-pdp-gallery-thumbs {
		flex: 1 1 auto;
		min-width: 0;
		display: flex;
		flex-wrap: nowrap;
		gap: 8px;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		-ms-overflow-style: none;
		touch-action: pan-x;
	}

	.sb-pdp-gallery-thumbs::-webkit-scrollbar {
		display: none;
	}

	.sb-pdp-gallery-thumb {
		box-sizing: border-box;
		flex: 0 0 calc((100% - 16px) / 3);
		width: calc((100% - 16px) / 3);
		height: auto;
		aspect-ratio: 1 / 1;
		padding: 0;
		margin: 0;
		border: 2px solid transparent;
		border-radius: 6px;
		overflow: hidden;
		background: #fff;
		opacity: 0.65;
		cursor: pointer;
		scroll-snap-align: start;
		pointer-events: auto;
		-webkit-appearance: none;
		appearance: none;
	}

	.sb-pdp-gallery-thumb img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
		pointer-events: none;
	}

	.sb-pdp-gallery-thumb[aria-current="true"] {
		opacity: 1;
		border-color: #222 !important;
		box-shadow: none !important;
		outline: none !important;
	}

	.sb-pdp-gallery-thumb:hover,
	.sb-pdp-gallery-thumb:active,
	.sb-pdp-gallery-thumb:focus,
	.sb-pdp-gallery-thumb:focus-visible {
		background: #fff !important;
		box-shadow: none !important;
		outline: none !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery__trigger {
		display: none !important;
	}

	.sb-pdp-has-gallery .woocommerce-product-gallery .zoomImg {
		display: none !important;
		pointer-events: none !important;
	}
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
	.sb-pdp-gallery-thumbs {
		scroll-behavior: auto;
	}
}
