/**
 * Sofisticato Design Theme — custom product gallery (v2.0.0).
 *
 * Static grid replacing the FlexSlider track on single-product ONLY:
 * markup comes from woocommerce/single-product/product-image.php:
 * .sdt-custom-gallery > .sdt-video-block? + .sdt-grid
 * (a.sdt-thumb[data-large] > img). No protagonist — the single variation
 * preview lives in the summary (.sdt-variation-preview).
 *
 * SCOPING RULE (C19): every selector below starts with `.single-product`.
 * Nothing here may touch shop loops, header, footer, or Elementor.
 *
 * Order: 1) video full-width rounded (omitted without gap when absent),
 * 2) grid 2 cols desktop / 2 tablet / 1 mobile, thumbs rounded ~12px,
 * white, taller (200px) object-fit:contain, hover elevate.
 */

/* --- Custom gallery stage --- */
.single-product .sdt-custom-gallery {
	background: var(--sdt-white, #FFFFFF);
	border: 1px solid var(--sdt-cream-dark, #F1E9DC);
	border-radius: var(--sdt-radius, 14px);
	box-shadow: var(--sdt-shadow-sm, 0 4px 14px rgba(43, 29, 20, 0.08));
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-bottom: 1.5rem;
	padding: 1rem;
}

/* --- 1) Video block first: full width, rounded, no gap when absent
 * (PHP omits the node entirely, so no :empty hacks needed). --- */
.single-product .sdt-custom-gallery .sdt-video-block {
	background: #000;
	border-radius: 12px;
	overflow: hidden;
	width: 100%;
}

.single-product .sdt-custom-gallery .sdt-video-inner {
	position: relative;
	width: 100%;
}

.single-product .sdt-custom-gallery .sdt-video-player {
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: 12px;
	display: block;
	object-fit: contain;
	width: 100%;
}

/* Reels: narrow centered 9:16 column; horizontal stays full-width 16:9. */
.single-product .sdt-custom-gallery .sdt-video-block.is-reel {
	margin-inline: auto;
	max-width: min(360px, 100%);
	width: 100%;
}

.single-product .sdt-custom-gallery .sdt-video-block.is-reel .sdt-video-inner {
	margin: 0 auto;
	max-width: 100%;
}

.single-product .sdt-custom-gallery .sdt-video-block.is-reel .sdt-video-player {
	aspect-ratio: 9 / 16;
	max-height: 560px;
}

/* Legacy summary video block (unhooked): never show it if a stale
 * template still prints it — the gallery block owns the player. */
.single-product .sdt-product-video {
	display: none !important;
}

.single-product .sdt-product-video.is-reel {
	margin-inline: auto;
	max-width: min(360px, 100%);
	width: 100%;
}

.single-product .sdt-product-video.is-reel .sdt-video-player {
	aspect-ratio: 9 / 16;
}

.single-product .sdt-product-video:not(.is-reel) .sdt-video-player {
	aspect-ratio: 16 / 9;
	width: 100%;
}

body.rsfv-has-video.single-product .sdt-product-video {
	display: none !important;
}

.single-product .sdt-custom-gallery .video-play-badge {
	align-items: center;
	background: rgba(43, 29, 20, 0.75);
	border: 2px solid var(--sdt-gold, #C9A227);
	border-radius: 50%;
	color: #fff;
	display: flex;
	font-size: 1.1rem;
	height: 56px;
	justify-content: center;
	left: 50%;
	line-height: 1;
	pointer-events: none;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	transition: opacity 0.2s ease;
	width: 56px;
}

.single-product .sdt-custom-gallery .sdt-video-block.is-playing .video-play-badge {
	opacity: 0;
}

.single-product .sdt-custom-gallery .reel-tag {
	background: var(--sdt-gold, #C9A227);
	border-radius: 999px;
	color: #2B1D14;
	font-family: var(--sdt-sans);
	font-size: 0.7rem;
	font-weight: 700;
	left: 0.75rem;
	letter-spacing: 0.12em;
	padding: 0.25rem 0.6rem;
	position: absolute;
	top: 0.75rem;
}

/* --- Protagonist REMOVED: the single variation preview lives in the
 * summary (.sdt-variation-preview). Kept inert so stale cached markup
 * never renders a duplicate — product-image.php emits no figure.sdt-featured. --- */
.single-product .sdt-custom-gallery .sdt-featured,
.single-product .sdt-custom-gallery .sdt-featured-image {
	display: none !important;
}

/* --- 2) Grid: 2 cols desktop / 2 tablet / 1 mobile. Taller thumbs
 * (~200px) so variation images read clearly. --- */
.single-product .sdt-custom-gallery .sdt-grid {
	display: grid;
	gap: 0.9rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.single-product .sdt-custom-gallery .sdt-thumb {
	background: #FFFFFF;
	border: 1px solid var(--sdt-cream-dark, #F1E9DC);
	border-radius: 12px;
	display: block;
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.single-product .sdt-custom-gallery .sdt-thumb:hover,
.single-product .sdt-custom-gallery .sdt-thumb:focus-visible {
	border-color: var(--sdt-gold, #C9A227);
	box-shadow: var(--sdt-shadow-sm, 0 4px 14px rgba(43, 29, 20, 0.08));
	transform: translateY(-3px);
}

.single-product .sdt-custom-gallery .sdt-thumb.is-active {
	border-color: var(--sdt-gold, #C9A227);
	box-shadow: 0 0 0 2px var(--sdt-gold, #C9A227);
}

.single-product .sdt-custom-gallery .sdt-thumb img {
	background: #FFFFFF;
	display: block;
	height: 200px;
	object-fit: contain;
	object-position: center;
	width: 100%;
}

@media (max-width: 900px) {
	.single-product .sdt-custom-gallery .sdt-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.single-product .sdt-custom-gallery .sdt-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.single-product .sdt-custom-gallery {
		padding: 0.75rem;
	}
}
