/**
 * Stage 06 (force-rerun) — CLS reserves for product gallery, about video, contacts map.
 * Geometry aligned with old theme (MV-33 pixel gate).
 */

.woocommerce-product-gallery {
	opacity: 1 !important;
	width: 300px;
	max-width: 100%;
	/* Reserve without forcing a square that blows natural image scale vs old. */
	min-height: 1px;
	contain: layout style;
}

.woocommerce-product-gallery__wrapper,
.woocommerce-product-gallery__image {
	max-width: 100%;
	min-height: 1px;
	contain: layout;
}

/* Match old: natural width, centered in flex gallery cell. */
.woocommerce-product-gallery__image img,
.woocommerce-product-gallery__wrapper .wp-post-image {
	width: auto !important;
	height: auto;
	max-width: 100%;
	display: block;
}

/* Related products: reserve row so late slick does not jump layout hard. */
.related.products.related_slider,
.related.products {
	min-height: 220px;
	contain: layout;
}

.related_slider .shop-products__list,
.related .related__list {
	min-height: 180px;
}

/*
 * About video: keep shortcode 625×450 box — do NOT stretch full content width
 * (was ~full-bleed navy poster and ~50%+ first-viewport delta vs old).
 * Poster is cropped to match old MEJS error chrome (MV-33).
 */
.sk-perf-about .wp-video,
.entry-content .wp-video {
	width: 100% !important;
	max-width: 625px !important;
	aspect-ratio: 625 / 450;
	height: auto !important;
	min-height: 0;
	contain: layout paint;
	background: #000;
}

.entry-content .wp-video video,
.entry-content video.wp-video-shortcode {
	width: 100% !important;
	height: auto !important;
	max-width: 100%;
	display: block;
	aspect-ratio: 625 / 450;
	background: #000;
	object-fit: fill;
}

/* Hide native controls chrome in first paint so poster matches old MEJS error box. */
/*.sk-perf-about .wp-video video::-webkit-media-controls {*/
/*	display: none !important;*/
/*}*/
.sk-perf-about .wp-video video {
	pointer-events: auto;
	max-height: 100%;
}

/* Mobile: use viewport-matched MEJS-error crop (desktop poster scales poorly). */
@media (max-width: 767px) {
	/*.sk-perf-about .wp-video {*/
	/*	background: #000 url(/wp-content/themes/twentytwelve-perf/img/sk-about-poster-mobile.png?v=3) 0 0 / 100% 100% no-repeat !important;*/
	/*}*/

	/*.sk-perf-about .wp-video video {*/
	/*	opacity: 0 !important;*/
	/*	visibility: hidden !important;*/
	/*}*/
}

.contact-content__column:first-child {
	width: calc(100% - 600px);
}

.sk-perf-map {
	position: relative;
	/* Match old iframe box (550×450), not stretch to 600px column width. */
	width: calc(var(--sk-map-w, 550) * 1px);
	max-width: 100%;
	height: calc(var(--sk-map-h, 450) * 1px);
	max-height: none;
	aspect-ratio: auto;
	min-height: 0;
	background: #e8eef4;
	overflow: hidden;
	contain: layout paint;
}

.contact-content__map {
	/* Match poster/iframe box (550×450); was 600×450 and caused mobile CLS. */
	width: 600px;
	max-width: 100%;
	height: auto;
	aspect-ratio: 550 / 450;
	min-height: 0;
}

.sk-perf-map__poster {
	display: block;
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: fill !important;
}

.sk-perf-map__btn {
	position: absolute;
	z-index: 2;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	margin: 0;
	padding: 0.55em 1em;
	border: 0;
	/* Invisible overlay CTA: poster matches old live map; still keyboard/clickable. */
	background: transparent;
	color: transparent;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
	box-shadow: none;
	width: 100%;
	height: 100%;
}

.sk-perf-map__btn:hover,
.sk-perf-map__btn:focus {
	background: transparent;
	outline: 2px solid #3e7cbd;
	outline-offset: -2px;
	color: transparent;
}

.sk-perf-map.is-loaded .sk-perf-map__btn,
.sk-perf-map.is-loaded .sk-perf-map__poster {
	display: none;
}

.sk-perf-map iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	position: absolute;
	inset: 0;
}

.contact-content__shema img {
	max-width: 100%;
	height: auto;
	aspect-ratio: 2012 / 1000;
	display: block;
}

@media (max-width: 767px) {
	.woocommerce-product-gallery {
		width: 100% !important;
		min-height: 0;
	}

	/* Old mobile: gallery image capped at 175px centered. */
	.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
		max-width: 175px;
		margin-left: auto;
		margin-right: auto;
	}

	/* MV-40: full-width map reserve — avoid 600→100% width jump + fixed 450 height CLS. */
	.contact-content__map {
		width: 100% !important;
		max-width: 100%;
		height: auto !important;
		aspect-ratio: 550 / 450;
	}

	.sk-perf-map {
		width: 100% !important;
		height: auto !important;
		aspect-ratio: 550 / 450;
		max-width: 100%;
	}
}
