/**
 * "Takeover" image style (core/image): a campaign graphic (presale, Black
 * Friday, …) laid over the middle of its gallery, uncropped, deliberately in
 * the way. Registered in resources/theme_functions/webexpo_blocks.php.
 * `figure` and the :not(#individual-image) id match outrank core's gallery
 * rules, as in the hero collage.
 */

.wp-block-gallery.has-nested-images:has(> .is-style-takeover) {
	position: relative;
}

figure.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-takeover:not(#individual-image) {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	width: min(80%, 720px);
	height: auto;
	margin: 0;
	transform: translate(-50%, -50%);
}

/* Width: Fill */
figure.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-takeover.has-takeover-fill:not(#individual-image) {
	width: 100%;
}

/* Oversize grows the graphic from one side (--wx-takeover-origin) without
   moving the centred box. */
figure.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-takeover:not(#individual-image) img {
	/* !important beats the inline width/height a resized image block saves;
	   the takeover box (Width: Auto / Fill) decides the size. */
	width: 100% !important;
	height: auto !important;
	object-fit: contain;
	transform: scale(var(--wx-takeover-oversize, 1));
	transform-origin: var(--wx-takeover-origin, left center);
}

/* No caption, and none of core's caption blur. */
figure.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-takeover::before,
figure.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-takeover figcaption {
	display: none;
}
