/**
 * Bloom Product Gallery Sticky — desktop-only split-scroll enhancement.
 *
 * Mobile intentionally stays on the existing Porto gallery.
 */

@media (min-width: 992px) {
	body.bloom-pgs-enhanced #main {
		overflow: visible;
	}

	body.bloom-pgs-enhanced .product-summary-wrap > .row {
		align-items: flex-start;
	}

	body.bloom-pgs-enhanced .bloom-pgs-gallery-col {
		position: sticky;
		top: var(--bloom-pgs-pane-top, 120px);
		height: var(--bloom-pgs-pane-height, calc(100vh - 120px));
		max-height: var(--bloom-pgs-pane-height, calc(100vh - 120px));
		overflow: hidden;
		align-self: flex-start;
		display: flex;
		flex-direction: column;
		min-height: 0;
	}

	body.bloom-pgs-enhanced .product-images,
	body.bloom-pgs-enhanced .product-thumbnails {
		display: none !important;
	}

	body.bloom-pgs-enhanced .bloom-pgs-gallery-col .woocommerce-product-gallery {
		flex: 1 1 auto;
		min-height: 0;
		height: 100%;
		max-height: 100%;
		overflow: hidden;
	}

	body.bloom-pgs-enhanced .bloom-pgs-gallery-col .woocommerce-product-gallery__wrapper,
	body.bloom-pgs-enhanced .bloom-pgs-gallery-col .bloom-pgs-desktop {
		height: 100%;
		max-height: 100%;
		min-height: 0;
		overflow: hidden;
	}

	body.bloom-pgs-enhanced .bloom-pgs-desktop {
		display: flex;
		align-items: flex-start;
		gap: 12px;
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumbs {
		flex: 0 0 56px;
		width: 56px;
		max-height: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		overscroll-behavior: contain;
		scrollbar-width: thin;
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumbs::-webkit-scrollbar {
		width: 4px;
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumbs::-webkit-scrollbar-thumb {
		background: rgba(0, 0, 0, 0.2);
		border-radius: 4px;
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumb {
		display: block;
		width: 56px;
		height: 56px;
		padding: 0;
		margin: 0 0 8px;
		border: 2px solid transparent;
		border-radius: 4px;
		background: #f4f4f4;
		cursor: pointer;
		overflow: hidden;
		transition: border-color 0.2s ease, opacity 0.2s ease;
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumb:last-child {
		margin-bottom: 0;
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumb img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumb:hover {
		border-color: rgba(0, 0, 0, 0.15);
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumb.is-active {
		border-color: var(--porto-primary-color, #d4af7f);
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumb:focus {
		outline: none;
	}

	body.bloom-pgs-enhanced .bloom-pgs-thumb:focus-visible {
		outline: 2px solid var(--porto-primary-color, #d4af7f);
		outline-offset: 2px;
	}

	body.bloom-pgs-enhanced .bloom-pgs-gallery-scroll {
		flex: 1 1 auto;
		min-width: 0;
		min-height: 0;
		height: 100%;
		max-height: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		overscroll-behavior: contain;
		scrollbar-width: thin;
	}

	body.bloom-pgs-enhanced .bloom-pgs-gallery-scroll::-webkit-scrollbar {
		width: 6px;
	}

	body.bloom-pgs-enhanced .bloom-pgs-gallery-scroll::-webkit-scrollbar-thumb {
		background: rgba(0, 0, 0, 0.22);
		border-radius: 6px;
	}

	body.bloom-pgs-enhanced .bloom-pgs-slide {
		margin-bottom: 16px;
	}

	body.bloom-pgs-enhanced .bloom-pgs-slide:last-child {
		margin-bottom: 0;
	}

	body.bloom-pgs-enhanced .bloom-pgs-slide .img-thumbnail {
		padding: 0;
		margin: 0;
	}

	body.bloom-pgs-enhanced .bloom-pgs-slide img {
		display: block;
		width: 100%;
		height: auto;
	}

	body.bloom-pgs-enhanced.bloom-pgs-single-image .bloom-pgs-thumbs {
		display: none;
	}

	body.bloom-pgs-enhanced.bloom-pgs-single-image .bloom-pgs-desktop {
		gap: 0;
	}
}
