/**
 * Depeur Masonry — Grid + Custom Lightbox
 *
 * Zwei Namespaces:
 *   .depeur-masonry  — das Grid selbst (Pinterest-Style-Columns)
 *   .dml             — "depeur masonry lightbox", die Popup-Ansicht
 *
 * Die Lightbox orientiert sich am ursprünglichen Depeur-Design:
 * 60/40-Split, Pfeile direkt am Bild-Container (nicht am Viewport),
 * heller Hintergrund, Text in dunkler Palette-3-Farbe.
 */

/* ═════════════════════════════════════════════════════════
   GRID
   ═════════════════════════════════════════════════════════ */

.depeur-masonry {
	column-count: var(--depeur-masonry-columns, 4);
	column-gap: var(--depeur-masonry-gap, 4px);
	margin: 1rem 0;
}

@media (max-width: 1024px) { .depeur-masonry { column-count: 3; } }
@media (max-width: 768px)  { .depeur-masonry { column-count: 2; } }
@media (max-width: 480px)  { .depeur-masonry { column-count: 1; } }

.depeur-masonry__item {
	position: relative;
	display: block;
	width: 100%;
	margin: 0 0 var(--depeur-masonry-gap, 4px) 0;
	overflow: hidden;
	line-height: 0;
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
	cursor: pointer;
}

.depeur-masonry__img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.45s ease;
}

.depeur-masonry__item:hover .depeur-masonry__img,
.depeur-masonry__item:focus-visible .depeur-masonry__img {
	transform: scale(1.04);
}

.depeur-masonry__item:focus-visible {
	outline: 2px solid var(--global-palette3, currentColor);
	outline-offset: 2px;
}

.depeur-masonry__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(0, 0, 0, 0.35);
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.depeur-masonry__item:hover .depeur-masonry__overlay,
.depeur-masonry__item:focus-visible .depeur-masonry__overlay {
	opacity: 1;
}

.depeur-masonry__label {
	color: #fff;
	font-size: 1.1rem;
	font-weight: 500;
	line-height: 1.3;
	text-align: center;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ═════════════════════════════════════════════════════════
   LIGHTBOX
   ═════════════════════════════════════════════════════════ */

/* Body-Scroll-Lock wenn Lightbox offen */
body.dml-lock {
	overflow: hidden;
}

/* Backdrop + Wrapper (fullscreen fixed) */
.dml {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: #fff;
	display: none;
}

.dml--open {
	display: block;
}

/* Inner Flex-Container: [60% Bild] [40% Text] */
.dml__inner {
	position: relative;
	display: flex;
	align-items: stretch;
	width: 100%;
	height: 100%;
	padding: 0;
}

/* ───── Top-right / Top-left Steuer-Buttons ───── */

.dml__btn {
	position: absolute;
	z-index: 10;
	background: transparent;
	border: none;
	padding: 0;
	cursor: pointer;
	color: var(--global-palette3, #33281c);
	line-height: 0;
	transition: opacity 0.2s ease;
}

.dml__btn:hover,
.dml__btn:focus-visible {
	opacity: 0.65;
}

.dml__btn:focus-visible {
	outline: 2px solid var(--global-palette3, #33281c);
	outline-offset: 4px;
}

.dml__btn--fs {
	top: 2rem;
	left: 2rem;
}

.dml__btn--close {
	top: 2rem;
	right: 2rem;
}

/* ───── Linke Seite: Bild + Pfeile ───── */

.dml__left {
	flex: 0 0 60%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4rem 2rem;
	box-sizing: border-box;
	min-width: 0;
}

.dml__imgwrap {
	position: relative;
	width: 100%;
	height: 100%;
	max-height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dml__img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

/* Pfeile innerhalb des imgwrap, vertikal zentriert, dicht am Bild.
   left: 0 / right: 0 positioniert sie an den Rändern der linken Spalte
   — optisch also direkt neben dem Bild, nicht am Viewport-Rand. */
.dml__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 5;
	width: 44px;
	height: 60px;
	padding: 0;
	background: transparent;
	border: none;
	cursor: pointer;
	color: var(--global-palette3, #33281c);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease;
}

.dml__arrow:hover,
.dml__arrow:focus-visible {
	opacity: 0.65;
}

.dml__arrow:focus-visible {
	outline: 2px solid var(--global-palette3, #33281c);
	outline-offset: 4px;
}

.dml__arrow--prev { left: 0; }
.dml__arrow--next { right: 0; }

/* ───── Rechte Seite: Text ───── */

.dml__right {
	flex: 0 0 40%;
	padding: 6rem 3rem 3rem 3rem; /* oben mehr Platz, damit Close-Button nicht auf Text liegt */
	box-sizing: border-box;
	overflow-y: auto;
	color: var(--global-palette3, #33281c);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
}

.dml__title {
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.3;
	margin: 0 0 1.25rem 0;
	color: var(--global-palette3, #33281c);
	text-align: left;
}

.dml__desc {
	font-size: 1rem;
	line-height: 1.6;
	margin: 0 0 1.25rem 0;
	max-width: 427px;
	white-space: pre-line;
	text-align: left;
}

.dml__year {
	font-size: 1rem;
	line-height: 1.6;
	margin: 0;
	text-align: left;
}

/* ═════════════════════════════════════════════════════════
   MOBILE: Bild oben (~60vh), Text darunter
   ═════════════════════════════════════════════════════════ */

@media (max-width: 899px) {
	.dml__inner {
		flex-direction: column;
	}

	.dml__left {
		flex: 0 0 60vh;
		width: 100%;
		padding: 3.5rem 1rem 1rem 1rem;
	}

	.dml__right {
		flex: 1 1 auto;
		width: 100%;
		padding: 1.5rem 1.5rem 2rem 1.5rem;
	}

	.dml__title {
		font-size: 1.25rem;
	}

	.dml__btn--fs,
	.dml__btn--close {
		top: 1rem;
	}
	.dml__btn--fs    { left: 1rem; }
	.dml__btn--close { right: 1rem; }

	/* Pfeile auf Mobile etwas kleiner */
	.dml__arrow {
		width: 36px;
		height: 50px;
	}
}

/* Im Fullscreen-Modus — Browser-FS-API aktiviert. Da nutzen wir den
   vollen Viewport und blenden den FS-Button aus (irritiert sonst). */
.dml:fullscreen {
	background: #fff;
}

/* ═════════════════════════════════════════════════════════
   No-Meta-Modus: Bild nimmt 100% Breite, rechte Spalte aus.
   Wird vom JS gesetzt, wenn ein Bild weder Title, Description
   noch Year hat (z.B. Auto-Lightbox auf Content-Bildern).
   ═════════════════════════════════════════════════════════ */

.dml--no-meta .dml__left {
	flex: 1 1 auto;
	width: 100%;
	padding: 5rem 4rem;
}

.dml--no-meta .dml__right {
	display: none;
}

@media (max-width: 899px) {
	.dml--no-meta .dml__left {
		flex: 1 1 auto;
		padding: 3.5rem 1rem;
	}
}
