.azdg-gallery {
	--azdg-gap: 14px;
	--azdg-row-height: 270px;
	--azdg-lightbox-button-size: 48px;
	--azdg-lightbox-icon-size: 24px;
	--azdg-lightbox-button-bg: rgba(255, 255, 255, .1);
	--azdg-lightbox-button-color: #fff;
	--azdg-lightbox-button-bg-hover: rgba(255, 255, 255, .22);
	--azdg-lightbox-button-color-hover: #fff;
	display: flex;
	flex-direction: column;
	gap: var(--azdg-gap);
	width: 100%;
	background: #000;
	box-sizing: border-box;
	overflow: hidden;
}

.azdg-row {
	display: flex;
	gap: var(--azdg-gap);
	width: 100%;
	height: var(--azdg-row-height);
	min-height: 0;
}

.azdg-gallery[data-vary-rows="yes"] .azdg-row:nth-child(3n + 2) {
	height: calc(var(--azdg-row-height) + 26px);
}

.azdg-gallery[data-vary-rows="yes"] .azdg-row:nth-child(3n + 3) {
	height: calc(var(--azdg-row-height) - 18px);
}

.azdg-item {
	position: relative;
	display: block;
	flex: var(--azdg-grow, 1) 1 0;
	min-width: 0;
	height: 100%;
	overflow: hidden;
	background: #111;
	text-decoration: none;
	isolation: isolate;
	-webkit-tap-highlight-color: transparent;
}

.azdg-gallery .azdg-item > .azdg-image {
	--azdg-brightness: 58%;
	--azdg-hover-brightness: 100%;
	--azdg-hover-scale: 1.045;
	--azdg-duration: 380ms;
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	min-width: 100%;
	min-height: 100%;
	max-width: none !important;
	max-height: none !important;
	object-fit: cover !important;
	object-position: center center;
	filter: brightness(var(--azdg-brightness));
	transform: scale(1.001);
	transition:
		transform var(--azdg-duration) cubic-bezier(.2, .7, .2, 1),
		filter var(--azdg-duration) ease;
	will-change: transform, filter;
}

.azdg-item:hover > .azdg-image,
.azdg-item:focus-visible > .azdg-image {
	filter: brightness(var(--azdg-hover-brightness));
	transform: scale(var(--azdg-hover-scale));
}

.azdg-item:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -3px;
}

.azdg-empty {
	padding: 24px;
	border: 1px dashed #a7a7a7;
	text-align: center;
}

/* Lightbox */
.azdg-lightbox[hidden] {
	display: none !important;
}

.azdg-lightbox {
	--azdg-lightbox-button-size: 48px;
	--azdg-lightbox-icon-size: 24px;
	--azdg-lightbox-button-bg: rgba(255, 255, 255, .1);
	--azdg-lightbox-button-color: #fff;
	--azdg-lightbox-button-bg-hover: rgba(255, 255, 255, .22);
	--azdg-lightbox-button-color-hover: #fff;
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	place-items: center;
	padding: 28px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 220ms ease, visibility 220ms ease;
}

.azdg-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.azdg-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .92);
	backdrop-filter: blur(4px);
}

.azdg-lightbox__dialog {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	width: min(94vw, 1500px);
	height: min(90vh, 980px);
	pointer-events: none;
}

.azdg-lightbox__figure {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
	min-width: 0;
	min-height: 0;
	pointer-events: auto;
}

.azdg-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
	opacity: 0;
	transform: scale(.985);
	transition: opacity 180ms ease, transform 220ms ease;
}

.azdg-lightbox__image.is-loaded {
	opacity: 1;
	transform: scale(1);
}

.azdg-lightbox__button {
	position: relative;
	z-index: 2;
	display: inline-grid;
	place-items: center;
	width: var(--azdg-lightbox-button-size);
	height: var(--azdg-lightbox-button-size);
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--azdg-lightbox-button-bg);
	color: var(--azdg-lightbox-button-color);
	font: inherit;
	cursor: pointer;
	pointer-events: auto;
	transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.azdg-lightbox__button:hover,
.azdg-lightbox__button:focus-visible {
	background: var(--azdg-lightbox-button-bg-hover);
	color: var(--azdg-lightbox-button-color-hover);
	transform: scale(1.06);
	outline: none;
}

.azdg-lightbox__button svg {
	width: var(--azdg-lightbox-icon-size);
	height: var(--azdg-lightbox-icon-size);
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.azdg-lightbox__close {
	position: absolute;
	top: 18px;
	right: 18px;
}

.azdg-lightbox__prev {
	margin-right: 18px;
}

.azdg-lightbox__next {
	margin-left: 18px;
}

body.azdg-lightbox-open {
	overflow: hidden;
}

@media (max-width: 767px) {
	.azdg-gallery[data-vary-rows="yes"] .azdg-row:nth-child(3n + 2) {
		height: calc(var(--azdg-row-height) + 12px);
	}

	.azdg-gallery[data-vary-rows="yes"] .azdg-row:nth-child(3n + 3) {
		height: calc(var(--azdg-row-height) - 8px);
	}

	.azdg-lightbox {
		padding: 12px;
	}

	.azdg-lightbox__dialog {
		grid-template-columns: 1fr;
		width: 100%;
		height: 88vh;
	}

	.azdg-lightbox__prev,
	.azdg-lightbox__next {
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		margin: 0;
	}

	.azdg-lightbox__prev:hover,
	.azdg-lightbox__prev:focus-visible,
	.azdg-lightbox__next:hover,
	.azdg-lightbox__next:focus-visible {
		transform: translateY(-50%) scale(1.06);
	}

	.azdg-lightbox__prev {
		left: 8px;
	}

	.azdg-lightbox__next {
		right: 8px;
	}

	.azdg-lightbox__close {
		top: 10px;
		right: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.azdg-gallery .azdg-item > .azdg-image,
	.azdg-lightbox,
	.azdg-lightbox__image,
	.azdg-lightbox__button {
		transition: none !important;
	}
}
