.mcg-gallery {
	--mcg-gap: 12px;
	display: grid;
	grid-template-columns: repeat(var(--mcg-cols, 4), minmax(0, 1fr));
	gap: var(--mcg-gap);
	margin: 1.5em 0;
}

@media (max-width: 782px) {
	.mcg-gallery {
		grid-template-columns: repeat(min(var(--mcg-cols, 4), 3), minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	.mcg-gallery {
		grid-template-columns: repeat(min(var(--mcg-cols, 4), 2), minmax(0, 1fr));
	}
}

.mcg-gallery .mcg-item {
	margin: 0;
	display: flex;
	flex-direction: column;
}

.mcg-gallery .mcg-link {
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f5f5f5;
}

.mcg-gallery .mcg-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	transition: transform 0.25s ease;
}

.mcg-gallery.mcg-fit-contain .mcg-img {
	object-fit: contain;
}

.mcg-gallery.mcg-fit-cover .mcg-img {
	object-fit: cover;
}

.mcg-gallery .mcg-link:hover .mcg-img,
.mcg-gallery .mcg-link:focus-visible .mcg-img {
	transform: scale(1.03);
}

.mcg-gallery .mcg-caption {
	margin-top: 6px;
	font-size: 0.875em;
	line-height: 1.4;
	text-align: center;
}

/* Lightbox */
.mcg-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.9);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s, visibility 0.2s;
}

.mcg-lb.is-open {
	opacity: 1;
	visibility: visible;
}

.mcg-lb-figure {
	margin: 0;
	max-width: 92vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.mcg-lb-img {
	display: block;
	max-width: 92vw;
	max-height: 82vh;
	width: auto;
	height: auto;
	object-fit: contain;
}

.mcg-lb-caption {
	margin-top: 10px;
	color: #fff;
	font-size: 0.95rem;
	text-align: center;
	max-width: 80ch;
}

.mcg-lb-counter {
	position: absolute;
	top: 16px;
	left: 20px;
	color: rgba(255, 255, 255, 0.8);
	font-size: 0.875rem;
}

.mcg-lb button {
	position: absolute;
	border: 0;
	background: transparent;
	color: #fff;
	cursor: pointer;
	padding: 10px;
	line-height: 1;
	font-family: inherit;
	opacity: 0.8;
}

.mcg-lb button:hover,
.mcg-lb button:focus-visible {
	opacity: 1;
}

.mcg-lb-close {
	top: 8px;
	right: 12px;
	font-size: 36px;
}

.mcg-lb-prev,
.mcg-lb-next {
	top: 50%;
	transform: translateY(-50%);
	font-size: 48px;
}

.mcg-lb-prev {
	left: 8px;
}

.mcg-lb-next {
	right: 8px;
}

.mcg-lb.is-single .mcg-lb-prev,
.mcg-lb.is-single .mcg-lb-next,
.mcg-lb.is-single .mcg-lb-counter {
	display: none;
}

body.mcg-lb-lock {
	overflow: hidden;
}
