/* Rules for the optimised media (see tools/optimize_media.py). Loaded after main.css. */

/* width/height attributes stop layout jumps; let CSS widths keep the aspect ratio. */
:where(img, video) { height: auto; }

/* Gallery tiles that used to be GIFs. */
.gallery2 article .image2 video {
	display: block;
	object-fit: cover;
	width: 100%;
	height: 100%;
}

/* Homepage spotlight that used to be a GIF: the still <img> stays for the template's
   background logic, and the video is shown instead of it. */
.spotlight .image.main.has-video img { display: none; }
.spotlight .image.main.has-video video { display: block; width: 100%; }

@media screen and (min-width: 981px) {
	.spotlight.has-video .image.main.has-video {
		display: block;
		position: absolute;
		inset: 0;
		margin: 0;
		z-index: 0;
	}
	.spotlight.has-video .image.main.has-video video {
		height: 100%;
		object-fit: cover;
	}
	.spotlight.has-video:before { position: relative; z-index: 1; pointer-events: none; }
	.spotlight.has-video .content,
	.spotlight.has-video .goto-next { z-index: 2; }
}
