/*
 * Denisurf product gallery pre-init styles (audit item 9/P3, epic #188).
 *
 * Static half of the LCP/CLS fix that previously lived inline in the forked
 * WooCommerce `single-product/product-image.php` template; the template
 * override is removed and these rules ship instead, enqueued only on single
 * product pages (inc/assets.php, per the section 2.1 asset policy). The
 * per-product dynamic values (main-image aspect-ratio cap and the
 * thumbnail-strip padding reservation) are appended as inline styles by
 * inc/assets.php, so they travel with this handle and never leak sitewide.
 *
 * WooCommerce's unmodified template ships `style="opacity: 0"` on the
 * gallery wrapper (removed only at gallery JS init), which held the page's
 * LCP image hostage until the deferred gallery script ran at DOM-ready
 * (measured: LCP 24.4 s while the image bytes were ready at 12 s). The
 * `!important` override below defeats that inline gate from first paint,
 * replacing the template's old `opacity: 1` delta; WooCommerce's noscript
 * `opacity: 1 !important` rule stays compatible.
 *
 * This file is owned first-party code (docs/frontend-quality.md) and must
 * pass stylelint.frontend.
 */

.woocommerce-product-gallery {
	opacity: 1 !important;
}

.denisurf-gallery-preinit .woocommerce-product-gallery__wrapper {
	position: relative;
}

/*
 * Extra slides (all after the main image, tagged by
 * inc/assets.php via the `woocommerce_single_product_image_thumbnail_html`
 * filter) are taken out of flow and hidden until the carousel exists, so no
 * raw-stacked slide pile is ever painted.
 */

.denisurf-gallery-preinit .denisurf-slide-extra {
	position: absolute !important;
	top: 0;
	left: 0;
	width: 100%;
	visibility: hidden;
}

/*
 * Transient cap on the flexslider viewport while the carousel constructs:
 * `aspect-ratio` is added per product by inc/assets.php inline styles.
 */

.denisurf-gallery-preinit .flex-viewport {
	height: auto !important;
	contain: size;
	overflow: hidden;
}
