/* ==========================================================
   Masonry Galerie – Grundlayout
   ========================================================== */
.mge-gallery {
	column-count: 4;
	column-gap: 12px;
	width: 100%;
}

.mge-item {
	position: relative;
	display: block;
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	margin: 0 0 12px;
	overflow: hidden;
	border-radius: 8px;
	background: #f2f2f2;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.mge-item img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
	transition: transform 0.4s ease;
}

.mge-item a {
	display: block;
	line-height: 0;
}

/* Größenvarianten – steuern die Mindesthöhe, echte Höhe ergibt
   sich zusätzlich immer aus dem tatsächlichen Bildseitenverhältnis */
.mge-item.mge-size-small img {
	aspect-ratio: 1 / 1;
	object-fit: cover;
	height: 100%;
}

.mge-item.mge-size-medium img {
	aspect-ratio: 3 / 4;
	object-fit: cover;
	height: 100%;
}

.mge-item.mge-size-large img {
	aspect-ratio: 3 / 5;
	object-fit: cover;
	height: 100%;
}

.mge-item.mge-size-xlarge img {
	aspect-ratio: 4 / 7;
	object-fit: cover;
	height: 100%;
}

/* Hover-Zoom */
.mge-hover-zoom .mge-item:hover img {
	transform: scale(1.06);
}

/* Beschriftung */
.mge-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 10px 12px;
	font-size: 13px;
	line-height: 1.3;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}

.mge-item:hover .mge-caption {
	opacity: 1;
	transform: translateY(0);
}

/* Responsive Fallback, falls keine eigenen Breakpoints gesetzt wurden */
@media ( max-width: 1024px ) {
	.mge-gallery {
		column-count: 3;
	}
}

@media ( max-width: 600px ) {
	.mge-gallery {
		column-count: 1;
	}
}

/* ==========================================================
   Lightbox
   ========================================================== */
.mge-lightbox-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 10, 10, 0.92);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease;
}

.mge-lightbox-overlay.mge-active {
	opacity: 1;
	visibility: visible;
}

.mge-lb-content {
	position: relative;
	max-width: 88vw;
	max-height: 86vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.mge-lb-image {
	max-width: 88vw;
	max-height: 80vh;
	width: auto;
	height: auto;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transform: scale(0.98);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.mge-lb-image.mge-lb-visible {
	opacity: 1;
	transform: scale(1);
}

.mge-lb-caption {
	margin-top: 12px;
	color: #f2f2f2;
	font-size: 14px;
	text-align: center;
	max-width: 80vw;
}

.mge-lb-counter {
	margin-top: 4px;
	color: #999;
	font-size: 12px;
	letter-spacing: 0.04em;
}

.mge-lb-close,
.mge-lb-prev,
.mge-lb-next {
	position: fixed;
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	opacity: 0.8;
	transition: opacity 0.2s ease;
	z-index: 1000000;
}

.mge-lb-close:hover,
.mge-lb-prev:hover,
.mge-lb-next:hover {
	opacity: 1;
}

.mge-lb-close {
	top: 20px;
	right: 24px;
	font-size: 34px;
	line-height: 1;
}

.mge-lb-prev,
.mge-lb-next {
	top: 50%;
	transform: translateY(-50%);
	font-size: 22px;
	padding: 12px 16px;
}

.mge-lb-prev {
	left: 12px;
}

.mge-lb-next {
	right: 12px;
}

@media ( max-width: 600px ) {
	.mge-lb-prev,
	.mge-lb-next {
		font-size: 18px;
		padding: 8px 10px;
	}

	.mge-lb-close {
		top: 12px;
		right: 14px;
		font-size: 28px;
	}
}
