/* Bildergalerien: tastatur-/tap-fähige Lightbox ganz ohne JavaScript (CSS :target) */

#galerie {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

#galerie .thumb {
	display: block;
	flex: 0 0 calc(33.333% - 6px);
}

#galerie .thumb img {
	display: block;
	width: 100%;
	height: auto;
	border: 2px solid transparent;
}

#galerie .thumb:hover img,
#galerie .thumb:focus img {
	border-color: #E3004F;
}

.lightbox {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.9);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease;
	z-index: 1000;
	padding: 20px;
}

.lightbox:target {
	opacity: 1;
	visibility: visible;
}

/* Klick auf den dunklen Hintergrund schliesst die Grossansicht wieder,
   genau wie der X-Button oben rechts. */
.lightbox .lb-backdrop {
	position: absolute;
	inset: 0;
	z-index: 0;
}

/* Bild nutzt jetzt die ganze verfügbare Breite (bis zur normalen
   Seitenbreite von 1024px), statt nur seine ursprüngliche Pixelgrösse -
   dadurch wirkt es auf grossen Bildschirmen nicht mehr "klein". */
.lightbox img {
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	max-width: 1024px;
	height: auto;
	max-height: 90vh;
}

/* Schliessen-Button sowie Vorwärts-/Rückwärtspfeile für die Grossansicht -
   alles reine CSS-Links (kein JavaScript), die einfach auf die id des
   vorherigen/nächsten Bildes zeigen (siehe doc.php der jeweiligen Galerie). */
.lightbox .lb-close,
.lightbox .lb-prev,
.lightbox .lb-next {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	text-decoration: none;
	font-size: 2em;
	line-height: 1;
}

.lightbox .lb-close:hover,
.lightbox .lb-prev:hover,
.lightbox .lb-next:hover {
	color: #E3004F;
}

.lightbox .lb-close {
	top: 10px;
	right: 15px;
	width: 44px;
	height: 44px;
}

.lightbox .lb-prev,
.lightbox .lb-next {
	top: 0;
	bottom: 0;
	width: 70px;
	font-size: 2.5em;
}

.lightbox .lb-prev { left: 0; }
.lightbox .lb-next { right: 0; }

.lightbox h6 {
	position: absolute;
	bottom: 20px;
	left: 0;
	right: 0;
	text-align: center;
	color: #ffffff;
	font-weight: normal;
	margin: 0;
	z-index: 1;
}

@media (max-width: 600px) {
	#galerie .thumb { flex: 0 0 calc(50% - 6px); }
}

/* Auf schmalen Bildschirmen (Smartphone) nur eine Spalte statt zwei */
@media (max-width: 480px) {
	#galerie .thumb { flex: 0 0 100%; }

	/* Schmalere Pfeil-Zonen, damit mehr vom Bild selbst sichtbar bleibt */
	.lightbox .lb-prev,
	.lightbox .lb-next {
		width: 44px;
		font-size: 1.8em;
	}
}
