/* Dancephony Galerie 1.0.4
   Farben über CSS-Variablen anpassbar, z. B. im Theme:  .dpg, .dpg-lb { --dpg-accent: #f3b03b; } */

.dpg,
.dpg-lb {
	--dpg-accent: #f3b03b;
	--dpg-accent-rgb: 243,176,59;
	--dpg-radius: 20px;
	--dpg-gap: 16px;
	--dpg-ease: cubic-bezier(.16, .84, .3, 1);
}

/* ---------- Raster ---------- */
.dpg {
	position: relative;
	margin-block: 0;
}
.dpg .dpg-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	/* Fallback ohne JavaScript und im Editor: CSS-Spalten */
	columns: var(--dpg-cols, 3);
	column-gap: var(--dpg-gap);
}
.dpg .dpg-item {
	break-inside: avoid;
	margin: 0 0 var(--dpg-gap);
	padding: 0;
}
.dpg .dpg-item::marker { content: none; }

/* Handy bis 767 px: 1 Spalte · Tablet 768–1024 px (Touch-Tablets bis 1366 px): 2 Spalten · Desktop: eingestellt */
@media (max-width: 1024px), (pointer: coarse) and (max-width: 1366px) {
	.dpg .dpg-grid { columns: min(2, var(--dpg-cols, 3)); }
}
@media (max-width: 767px) {
	.dpg, .dpg-lb { --dpg-gap: 12px; --dpg-radius: 16px; }
	.dpg .dpg-grid { columns: 1; }
}

/* Mit JavaScript: echtes Masonry, absolut positioniert */
.dpg.is-js .dpg-grid {
	columns: auto;
	position: relative;
	height: var(--dpg-h, auto);
}
.dpg.is-js .dpg-item {
	position: absolute;
	top: 0;
	left: 0;
	margin: 0;
	width: var(--dpg-cw);
	transform: translate3d(var(--x, 0), var(--y, 0), 0);
}

.dpg-in {
	perspective: 900px;
}
.dpg.is-js .dpg-in {
	opacity: 0;
	transform: translate3d(0, 46px, 0) rotateX(-16deg) scale(.96);
	transform-origin: 50% 100%;
	transition: opacity .9s var(--dpg-ease), transform 1.1s var(--dpg-ease);
	transition-delay: var(--d, 0s);
}
.dpg.is-js .dpg-item.is-in .dpg-in {
	opacity: 1;
	transform: none;
}

.dpg .dpg-card {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--dpg-radius);
	background: #141414;
	box-shadow: 0 28px 50px -30px rgba(0, 0, 0, .9);
	transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--s, 1));
	transition: transform .5s var(--dpg-ease), box-shadow .5s var(--dpg-ease);
	-webkit-tap-highlight-color: transparent;
	outline: none;
}
.dpg .dpg-card img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 1.2s var(--dpg-ease), opacity .6s ease;
	margin: 0;
	max-width: none;
	border-radius: 0;
}
/* Lichtreflex + Rahmen beim Hover */
.dpg-card::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	border-radius: inherit;
	background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .22), transparent 55%);
	box-shadow: inset 0 0 0 2px var(--dpg-accent);
	opacity: 0;
	transition: opacity .4s;
}
/* Vergrössern-Symbol */
.dpg-card::after {
	content: "";
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: var(--dpg-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 20px no-repeat;
	opacity: 0;
	transform: scale(.6);
	transition: opacity .35s, transform .45s var(--dpg-ease);
}
@media (hover: hover) and (pointer: fine) {
	.dpg-card:hover { --s: 1.03; box-shadow: 0 40px 70px -30px rgba(var(--dpg-accent-rgb), .55); z-index: 2; }
	.dpg-card:hover::before,
	.dpg-card:hover::after { opacity: 1; transform: none; }
	.dpg-card:hover img { transform: scale(1.06); }
}
.dpg-card:focus-visible::before { opacity: 1; }
.dpg-card:focus-visible { box-shadow: 0 0 0 3px var(--dpg-accent); }
.dpg-card:active { --s: .98; }

/* Im Block-Editor keine Links auslösen */
.editor-styles-wrapper .dpg-card { pointer-events: none; }

/* ---------- Lightbox ---------- */
.dpg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	color: #fff;
	background: rgba(0, 0, 0, .94);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	font-family: inherit;
	opacity: 0;
	visibility: hidden;
	transition: opacity .45s var(--dpg-ease), visibility 0s linear .45s;
	-webkit-user-select: none;
	user-select: none;
	overscroll-behavior: contain;
	touch-action: pan-x;
}
.dpg-lb[hidden] { display: none; }
.dpg-lb.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity .45s var(--dpg-ease);
}
.dpg-lb.dpg-lb .dpg-lb__glow {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: radial-gradient(70% 55% at 50% 45%, rgba(var(--dpg-accent-rgb), .32), transparent 70%);
}
.dpg-lb.dpg-lb .dpg-lb__top {
	position: relative;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: max(16px, env(safe-area-inset-top)) 20px 8px;
	min-height: 64px;
}
.dpg-lb.dpg-lb .dpg-lb__count {
	font-weight: 700;
	font-size: 15px;
	color: #ddd;
	font-variant-numeric: tabular-nums;
}

.dpg-lb.dpg-lb button {
	font: inherit;
	color: #fff;
	border: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.dpg-lb.dpg-lb .dpg-lb__x,
.dpg-lb.dpg-lb .dpg-lb__nav {
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	padding: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .1);
	box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3);
	transition: background .25s, color .25s, transform .35s var(--dpg-ease);
}
.dpg-lb.dpg-lb .dpg-lb__x:hover,
.dpg-lb.dpg-lb .dpg-lb__nav:hover { background: #fff; color: #000; transform: scale(1.06); }
.dpg-lb.dpg-lb .dpg-lb__x svg,
.dpg-lb.dpg-lb .dpg-lb__nav svg { width: 22px; height: 22px; }
.dpg-lb.dpg-lb button:focus-visible { outline: 3px solid var(--dpg-accent); outline-offset: 3px; }

.dpg-lb.dpg-lb .dpg-lb__stage {
	position: relative;
	z-index: 1;
	flex: 1;
	min-height: 0;
	perspective: 1200px;
	touch-action: none;
	cursor: grab;
}
.dpg-lb.dpg-lb .dpg-lb__stage.is-drag { cursor: grabbing; }
.dpg-lb.dpg-lb .dpg-lb__slide {
	position: absolute;
	top: 0;
	left: 50%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	will-change: transform, opacity;
	pointer-events: none;
}
.dpg-lb.dpg-lb .dpg-lb__fig {
	position: relative;
	margin: 0;
	border-radius: var(--dpg-radius);
	overflow: hidden;
	background: #111;
	box-shadow: 0 50px 100px -40px rgba(var(--dpg-accent-rgb), .55), 0 30px 60px -30px rgba(0, 0, 0, .9);
}
.dpg-lb.dpg-lb .dpg-lb__fig img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	max-width: none;
	margin: 0;
	border-radius: 0;
	opacity: 0;
	transition: opacity .4s ease;
}
.dpg-lb.dpg-lb .dpg-lb__fig img.is-loaded { opacity: 1; }
.dpg-lb.dpg-lb .dpg-lb__fig::before { /* Ladeanimation */
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, .15);
	border-top-color: var(--dpg-accent);
	animation: dpg-spin .9s linear infinite;
}
.dpg-lb.dpg-lb .dpg-lb__fig.is-loaded::before { display: none; }
@keyframes dpg-spin { to { transform: rotate(360deg); } }

.dpg-lb.is-open .dpg-lb__stage { animation: dpg-in .6s var(--dpg-ease) both; }
@keyframes dpg-in { from { opacity: 0; transform: translate3d(0, 30px, 0) scale(.94); } }

.dpg-lb.dpg-lb .dpg-lb__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	margin-top: -26px;
}
.dpg-lb.dpg-lb .dpg-lb__nav--prev { left: 20px; }
.dpg-lb.dpg-lb .dpg-lb__nav--next { right: 20px; }

.dpg-lb.dpg-lb .dpg-lb__cap {
	position: relative;
	z-index: 2;
	min-height: 1.5em;
	margin: 12px auto 0;
	padding: 0 20px;
	max-width: 70ch;
	text-align: center;
	font-size: 15px;
	color: #cfcfcf;
}
.dpg-lb.dpg-lb .dpg-lb__thumbs {
	position: relative;
	z-index: 2;
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: none;
	padding: 14px 20px;
	scroll-behavior: smooth;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
	mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}
.dpg-lb.dpg-lb .dpg-lb__thumbs::-webkit-scrollbar { display: none; }
.dpg-lb.dpg-lb .dpg-lb__thumbs::before,
.dpg-lb.dpg-lb .dpg-lb__thumbs::after { content: ""; flex: 0 0 calc(50% - 30px); }
.dpg-lb.dpg-lb .dpg-lb__thumb {
	flex: none;
	width: 52px;
	height: 52px;
	padding: 0;
	border-radius: 10px;
	overflow: hidden;
	background: #1a1a1a;
	opacity: .45;
	transition: opacity .3s, box-shadow .3s, transform .3s var(--dpg-ease);
}
.dpg-lb.dpg-lb .dpg-lb__thumb:hover { opacity: .8; }
.dpg-lb.dpg-lb .dpg-lb__thumb.is-active { opacity: 1; box-shadow: 0 0 0 2px var(--dpg-accent); transform: scale(1.06); }
.dpg-lb.dpg-lb .dpg-lb__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: none; margin: 0; }

.dpg-lb.dpg-lb .dpg-lb__bar {
	position: relative;
	z-index: 2;
	display: none;
	padding: 4px 20px max(18px, env(safe-area-inset-bottom));
}
.dpg-lb.dpg-lb .dpg-lb__close {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	height: 54px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .1);
	box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3);
	font-weight: 700;
	font-size: 16px;
}
.dpg-lb.dpg-lb .dpg-lb__close svg { width: 18px; height: 18px; }

/* Handy & Touch: Schliessen unten, keine Pfeile */
@media (max-width: 767px), (hover: none) {
	.dpg-lb.dpg-lb .dpg-lb__nav { display: none; }
}
@media (max-width: 767px) {
	.dpg-lb.dpg-lb .dpg-lb__x { display: none; }
	.dpg-lb.dpg-lb .dpg-lb__bar { display: block; }
	.dpg-lb.dpg-lb .dpg-lb__thumb { width: 44px; height: 44px; }
	.dpg-lb.dpg-lb .dpg-lb__thumbs { padding-block: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.dpg *, .dpg-lb, .dpg-lb * { transition: none !important; animation: none !important; }
	.dpg.is-js .dpg-in { opacity: 1; transform: none; }
}
