.dmg-gallery-wrap {
	width: 100%;
	max-width: none;
	overflow-anchor: none;
}

.dmg-gallery {
	width: 100%;
	max-width: none;
	overflow-anchor: none;
	--gutter: 0.25em;
	gap: var(--gutter, 1em);
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(var(--item-width, 320px), 100%), 1fr));
	grid-template-rows: masonry;
	grid-auto-flow: dense;
}

.dmg-gallery + .dmg-gallery {
	margin-block-start: var(--gutter, 1em);
}

.dmg-gallery.is-masonry-fallback {
	grid-auto-rows: 1px;
	row-gap: 0;
	grid-auto-flow: row;
}

.dmg-item {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--dmg-item-ratio, auto);
	max-height: var(--max-item-height, 420px);
	min-height: 120px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	border-radius: 8px;
	background: transparent;
	cursor: zoom-in;
}

.dmg-image {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.dmg-lazy {
	opacity: 0;
	transition: opacity 180ms ease;
}

.dmg-lazy.is-loaded {
	opacity: 1;
}

.dmg-lazy-video {
	opacity: 0;
	transition: opacity 180ms ease;
}

.dmg-lazy-video.is-loaded {
	opacity: 1;
}

.dmg-video-thumb {
	position: relative;
	z-index: 1;
	aspect-ratio: 16 / 9;
	background: #111;
}

.dmg-video-fallback {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #111;
	color: #bbb;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0;
}

.dmg-play {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 44px;
	transform: translate(-50%, -50%);
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.72);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
	pointer-events: none;
}

.dmg-empty {
	margin: 0;
}

.dmg-gallery-sentinel {
	width: 100%;
	height: 1px;
	overflow-anchor: none;
}

.dmg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, 0.82);
}

.dmg-lightbox.is-open {
	display: flex;
}

.dmg-lightbox__inner {
	position: relative;
	max-width: min(1100px, 100%);
	max-height: 100%;
}

.dmg-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 120px);
	width: auto;
	height: auto;
	margin: 0 auto;
	border-radius: 8px;
}

.dmg-lightbox__video {
	display: none;
	max-width: 100%;
	max-height: calc(100vh - 120px);
	width: min(100%, 1100px);
	height: auto;
	margin: 0 auto;
	border-radius: 8px;
	background: #000;
}

.dmg-lightbox.is-video .dmg-lightbox__image {
	display: none;
}

.dmg-lightbox.is-video .dmg-lightbox__video {
	display: block;
}

.dmg-lightbox__caption {
	max-width: 900px;
	margin: 12px auto 0;
	color: #fff;
	font-size: 16px;
	line-height: 1.45;
	text-align: center;
}

.dmg-lightbox__caption:empty {
	display: none;
}

.dmg-lightbox__close {
	position: absolute;
	top: -14px;
	right: -14px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: #fff;
	color: #111;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

@media (max-width: 600px) {
	.dmg-lightbox {
		padding: 16px;
	}

	.dmg-lightbox__image {
		max-height: calc(100vh - 96px);
	}

	.dmg-lightbox__close {
		top: 8px;
		right: 8px;
	}
}
