/**
 * Overdrive — Core Web Vitals stability contract (mobile-first).
 *
 * This layer intentionally does not style, move, hide or resize advertising.
 * Ad inventory and reservation geometry stay owned by inc/ads/ so RPM tests are
 * isolated from CWV work.
 */

/* Video embeds know their box before the remote iframe paints. */
body.single-post .go-article__content :is(
	.wp-block-embed-youtube,
	.wp-block-embed-vimeo,
	.wp-block-video
) .wp-block-embed__wrapper {
	position: relative;
	inline-size: 100%;
	aspect-ratio: 16 / 9;
	min-block-size: 0;
	overflow: hidden;
}

body.single-post .go-article__content :is(
	.wp-block-embed-youtube,
	.wp-block-embed-vimeo,
	.wp-block-video
) .wp-block-embed__wrapper > iframe {
	position: absolute;
	inset: 0;
	inline-size: 100%;
	block-size: 100%;
	border: 0;
}

/* SpeechSynthesis support is detected by deferred JS. Keep the reader-tool cell
 * reserved while that detection runs so enabling "Ouvir matéria" does not
 * reflow the metadata/share toolbar after first paint. */
body.single-post [data-go-article-audio][hidden] {
	display: block !important;
	visibility: hidden !important;
	min-inline-size: 132px;
	min-block-size: 36px;
	pointer-events: none;
}

/* On phones EM ALTA is normal document flow. Collapsing max-height on scroll
 * moves the entire article and becomes post-load CLS in field data. Keep that
 * rail geometrically stable on the mobile audience; the desktop behavior is
 * unchanged. */
@media (max-width: 768px) {
	body.go-verge .go-header--editorial + .go-latest-bar.is-hidden,
	body.go-verge .go-latest-bar.is-hidden {
		max-height: none !important;
		overflow: hidden !important;
		opacity: 1 !important;
		visibility: visible !important;
		pointer-events: auto !important;
		transition: none !important;
	}
}

/* Legacy/raw video embeds may not have a Gutenberg wrapper. Reserve their
 * responsive box too. The selector is host-specific so ad/CMP iframes are
 * deliberately untouched. */
body.single-post .go-article__content iframe[src*="youtube.com"],
body.single-post .go-article__content iframe[src*="youtube-nocookie.com"],
body.single-post .go-article__content iframe[src*="player.vimeo.com"] {
	display: block;
	inline-size: 100%;
	max-inline-size: 100%;
	aspect-ratio: 16 / 9;
	block-size: auto;
	min-block-size: 0;
	border: 0;
}

