/* ─── Core-Galerie: Bildunterschrift UNTER dem Bild ─────────────────────
   Der WP-Galerie-Block legt die figcaption als weisses Overlay mit
   Verlauf AUF die Bild-Unterkante. Hausregel seit 16.08.2026: Titel unter
   dem Foto (wie Bilder-Slider und Lightbox), Fotos 16:10 (siehe
   docs/60-konventionen.md). Geladen von SAR\Lightbox (Frontend + Editor). */

.wp-block-gallery.has-nested-images figure.wp-block-image {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: flex-start;
	align-self: flex-start;
	position: relative;
}

/* Verlauf, den WP seit 6.5 per :has(figcaption)::before ueber das Bild
   legt, abschalten. */
.wp-block-gallery.has-nested-images figure.wp-block-image::before {
	content: none;
}

/* Bild: 16:10, aspect-ratio ist an einem <img> auch in Safari sicher
   (das Element hat ein intrinsisches Verhaeltnis; die Flex-Falle betrifft
   nur Boxen ohne Inhalt). */
/* Der Core setzt bei is-cropped `height: 100%; flex: 1 0 0%` mit hoeherer
   Spezifitaet (.has-nested-images.is-cropped). Ohne den Overlay-Aufbau
   ist die figure so hoch wie ihr Inhalt, height:100% waere dann 0 und
   die Bilder verschwinden (passiert am 16.08.2026). Deshalb hier mit
   is-cropped-Selektoren UND !important fuer die Hoehe. */
.wp-block-gallery.has-nested-images figure.wp-block-image img,
.wp-block-gallery.has-nested-images figure.wp-block-image a img,
.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image img,
.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image a img {
	flex: 0 0 auto !important;
	width: 100% !important;
	height: auto !important;
	max-width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	display: block;
}

/* Link-Wrapper (Link auf Mediendatei) darf nicht wachsen/zentrieren. */
.wp-block-gallery.has-nested-images figure.wp-block-image > a,
.wp-block-gallery.has-nested-images figure.wp-block-image > div {
	flex: 0 0 auto;
	display: block;
	width: 100%;
	margin: 0;
}

.wp-block-gallery.has-nested-images figure.wp-block-image figcaption,
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption.wp-element-caption {
	position: static;
	bottom: auto;
	width: auto;
	max-height: none;
	margin: 0;
	padding: 6px 2px 0;
	background: none;
	color: inherit;
	font-size: 13px;
	line-height: 1.4;
	text-align: left;
	text-shadow: none;
	-webkit-mask-image: none;
	mask-image: none;
	box-sizing: border-box;
	overflow: visible;
	flex-grow: 0;
	scrollbar-width: auto;
}

/* WP setzt bei abgerundeten/leeren Captions eigene Regeln, hier neutral. */
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a {
	color: inherit;
}
