/**
 * Große Ansicht eines Bilds aus Neuigkeiten und Veranstaltungen (assets/bild-gross.js, inc/bild-gross.php).
 * Aufbau wie die Bildansicht des Freizeitheims: ganzer Bildschirm, dunkler Schleier aus Logo-Schwarz, das Bild so groß, wie
 * Höhe und Breite es erlauben, darunter der Titel und bei einem PDF „PDF öffnen“. Farben, Radien aus theme.json.
 *
 *   dialog.fhd-bildgross > div.fhd-bildgross__innen > button.fhd-bildgross__zu
 *     + figure.fhd-bildgross__figur > img.fhd-bildgross__bild
 *       + figcaption.fhd-bildgross__unten > span.fhd-bildgross__titel + a.fhd-bildgross__datei
 */

html.fhd-bildgross-offen {
	overflow: hidden;
}

dialog.fhd-bildgross {
	width: 100vw;
	max-width: none;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--auf-dunkel, #f0f0ec);
	overflow: hidden;
}

dialog.fhd-bildgross::backdrop {
	/* fast deckend: Schrift der Seite darunter (etwa der Cookie-Hinweis) stand sonst als Schatten unter Titel und Knopf */
	background: color-mix(in srgb, var(--wp--preset--color--espresso, #1b1e15) 96%, transparent);
}

.fhd-bildgross__innen {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	padding: 68px 16px 20px;
}

.fhd-bildgross__figur {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	min-width: 0;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
}

/* Der Kasten hat die Form des Bilds, bevor es geladen ist (--fhd-bild-seite: Breite durch Höhe, aus dem kleinen Bild), danach
   begrenzt --fhd-bild-breite ihn auf die Breite der Datei. Weißer Grund: Plakate sind meist weiß, ein durchsichtiges PNG
   stünde sonst auf dem dunklen Schleier. */
.fhd-bildgross__bild {
	--fhd-bild-hoehe: calc(100dvh - 160px);

	display: block;
	aspect-ratio: var(--fhd-bild-seite, 0.7);
	width: min(100%, var(--fhd-bild-breite, 100%), calc(var(--fhd-bild-hoehe) * var(--fhd-bild-seite, 0.7)));
	max-width: 100%;
	height: auto;
	max-height: var(--fhd-bild-hoehe);
	object-fit: contain;
	border-radius: var(--wp--custom--radius--klein, 6px);
	background: #fff;
}

.fhd-bildgross__unten {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px 20px;
	max-width: 60ch;
	text-align: center;
}

.fhd-bildgross__titel {
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.35;
}

.fhd-bildgross__datei {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 18px;
	border: 1px solid var(--wp--preset--color--auf-dunkel-leise, #b4b5ad);
	border-radius: var(--wp--custom--radius--gross, 10px);
	color: var(--wp--preset--color--auf-dunkel, #f0f0ec);
	font-weight: 600;
	text-decoration: none;
}

/* hidden gegen display: inline-flex durchsetzen (bei einem Bild gibt es keinen Link auf die Datei) */
.fhd-bildgross__datei[hidden] {
	display: none;
}

.fhd-bildgross__zu {
	position: absolute;
	top: 12px;
	right: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--wp--custom--radius--gross, 10px);
	background: var(--wp--preset--color--papier, #fcfcfb);
	color: var(--wp--preset--color--espresso, #1b1e15);
	cursor: pointer;
}

.fhd-bildgross__zu svg {
	width: 22px;
	height: 22px;
}

/* Nur mit Zeiger: Auf Touch bliebe die getippte Fläche sonst grau. */
@media (hover: hover) {
	.fhd-bildgross__zu:hover {
		background: var(--wp--preset--color--flaeche, #f4f4f2);
	}

	.fhd-bildgross__datei:hover {
		border-color: var(--wp--preset--color--auf-dunkel, #f0f0ec);
	}
}

.fhd-bildgross__zu:focus-visible,
.fhd-bildgross__datei:focus-visible {
	outline: 3px solid var(--wp--preset--color--amber, #f49e02);
	outline-offset: 3px;
}
