.hr-entry-content .wp-block-gallery.has-nested-images > figure.wp-block-image {
	/* site.css already supplies the 4/2-column grid. Core's flex-gallery
	 * percentage width must not shrink an item a second time inside its cell. */
	width: 100% !important;
}

/* Figma gallery note: keep two caption lines even when an item has no caption.
 * This is an empty decorative slot, not invented editorial content. */
.hr-entry-content .c-gallery .gallery-images > li:not(:has(figcaption))::after,
.hr-entry-content .wp-block-gallery.has-nested-images > figure:not(:has(figcaption))::after {
	content: "";
	display: block;
	min-height: 44px;
	margin-top: 8px;
	flex-shrink: 0;
}

/* A gallery needs the whole reading area. The gate participates in flow,
 * keeping intro text clear and allowing the photographs to start beneath it. */
.hr-page:has(.c-gallery .gallery-images > li, .wp-block-gallery img) > .hr-entry-content {
	max-width: none;
}

.hr-page:has(.c-gallery .gallery-images > li, .wp-block-gallery img) > .hr-page__illustration {
	position: static;
	width: min(100%, 24rem);
	height: auto;
	margin: 0 auto 2rem;
	opacity: 1;
}

/* Widen the photo grid, not the surrounding prose (which may be nested inside
 * legacy builder wrappers). Empty retired gallery markup is not a gallery. */
.hr-page:has(.c-gallery .gallery-images > li, .wp-block-gallery img) > .hr-entry-content :is(p, ul:not(.gallery-images), ol, blockquote) {
	max-width: 70ch;
}

.hr-page:has(.c-gallery .gallery-images > li, .wp-block-gallery img) > .hr-entry-content :is(h2, h3, h4) {
	clear: none;
}

.hr-page .hr-entry-content :is(.c-gallery, .wp-block-gallery) {
	clear: both;
}

@media (min-width: 60rem) {
	.hr-page:has(.c-gallery .gallery-images > li, .wp-block-gallery img) > .hr-page__illustration {
		float: right;
		width: 38%;
		max-width: 31rem;
		margin: 0 0 2rem 2rem;
	}

}

/* The base theme restores the absolute gate at 768px, not 960px. Empty
 * gallery remnants must reserve its track from that exact breakpoint. */
@media (min-width: 48rem) {
	.hr-page:has(.c-gallery):not(:has(.c-gallery .gallery-images > li, .wp-block-gallery img)) > .hr-entry-content {
		max-width: min(57%, var(--hr-reading));
	}
}
