.mmg-gallery {
	display: grid;
	grid-template-columns: repeat(var(--mmg-columns, 3), minmax(0, 1fr));
	gap: 1.25rem;
	margin: 1.5rem 0;
}

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

@media (max-width: 480px) {
	.mmg-gallery.mmg-columns-2,
	.mmg-gallery.mmg-columns-3,
	.mmg-gallery.mmg-columns-4 {
		grid-template-columns: 1fr;
	}
}

.mmg-gallery .mmg-item {
	margin: 0;
}

.mmg-gallery .mmg-item-trigger {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	text-align: left;
	text-decoration: none;
	color: inherit;
}

.mmg-gallery .mmg-thumb {
	position: relative;
	display: block;
	aspect-ratio: var(--mmg-aspect-ratio, 4 / 3);
	overflow: hidden;
	border-radius: var(--mmg-thumb-radius, 0px);
	background: #e8e8e8;
}

.mmg-gallery .mmg-thumb img,
.mmg-gallery .mmg-thumb .mmg-teaser {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.mmg-gallery .mmg-item-trigger:hover .mmg-thumb img,
.mmg-gallery .mmg-item-trigger:focus-visible .mmg-thumb img,
.mmg-gallery .mmg-item-trigger:hover .mmg-thumb .mmg-teaser,
.mmg-gallery .mmg-item-trigger:focus-visible .mmg-thumb .mmg-teaser {
	transform: scale(1.04);
}

.mmg-gallery .mmg-thumb-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #6b6b6b;
}

.mmg-gallery .mmg-thumb-fallback .dashicons {
	font-size: 48px;
	width: 48px;
	height: 48px;
}

.mmg-gallery .mmg-media-badge {
	position: absolute;
	right: 0.6rem;
	bottom: 0.6rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
}

.mmg-gallery .mmg-media-badge .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
}

.mmg-gallery .mmg-caption {
	margin-top: 0.55rem;
}

.mmg-gallery .mmg-caption-title {
	display: block;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
}

.mmg-gallery .mmg-caption-text {
	display: block;
	margin-top: 0.2rem;
	opacity: 0.8;
	font-size: 0.925em;
	line-height: 1.4;
}

/* Title overlay on hover */
.mmg-gallery.mmg-title-hover .mmg-media-badge {
	top: 0.6rem;
	bottom: auto;
}

.mmg-gallery .mmg-title-overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 33.333%;
	display: flex;
	align-items: flex-end;
	padding: 0.9rem 1rem 1rem;
	box-sizing: border-box;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.35s ease;
}

.mmg-gallery .mmg-title-overlay .mmg-caption-title {
	color: #fff;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.35;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
	transform: translateY(0.55rem);
	opacity: 0;
	transition: transform 0.35s ease, opacity 0.35s ease;
}

.mmg-gallery.mmg-title-hover .mmg-item-trigger:hover .mmg-title-overlay,
.mmg-gallery.mmg-title-hover .mmg-item-trigger:focus-visible .mmg-title-overlay,
.mmg-gallery.mmg-title-hover .mmg-item:focus-within .mmg-title-overlay {
	opacity: 1;
}

.mmg-gallery.mmg-title-hover .mmg-item-trigger:hover .mmg-title-overlay .mmg-caption-title,
.mmg-gallery.mmg-title-hover .mmg-item-trigger:focus-visible .mmg-title-overlay .mmg-caption-title,
.mmg-gallery.mmg-title-hover .mmg-item:focus-within .mmg-title-overlay .mmg-caption-title {
	transform: translateY(0);
	opacity: 1;
}

@media (hover: none) {
	.mmg-gallery.mmg-title-hover .mmg-title-overlay,
	.mmg-gallery.mmg-title-hover .mmg-title-overlay .mmg-caption-title {
		opacity: 1;
		transform: none;
	}
}

/* Lightbox */
html.mmg-lightbox-open,
html.mmg-lightbox-open body {
	overflow: hidden;
}

.mmg-lightbox[hidden] {
	display: none !important;
}

.mmg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.mmg-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 10, 0.86);
}

.mmg-lightbox-dialog {
	position: relative;
	z-index: 1;
	width: min(1100px, 100%);
	max-height: calc(100vh - 3rem);
	display: flex;
	flex-direction: column;
	align-items: center;
}

.mmg-lightbox-content {
	max-width: 100%;
	max-height: calc(100vh - 7rem);
	display: flex;
	align-items: center;
	justify-content: center;
}

.mmg-lightbox-content img,
.mmg-lightbox-content video {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 7rem);
	height: auto;
	width: auto;
	background: #000;
}

.mmg-lightbox-embed {
	position: relative;
	width: min(960px, 92vw);
	aspect-ratio: 16 / 9;
	background: #000;
}

.mmg-lightbox-embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.mmg-lightbox-audio {
	min-width: min(420px, 90vw);
	padding: 2rem;
	background: #111;
	border-radius: 8px;
}

.mmg-lightbox-audio audio {
	width: 100%;
}

.mmg-lightbox-caption {
	margin-top: 0.85rem;
	color: #f5f5f5;
	text-align: center;
	max-width: 40rem;
	line-height: 1.45;
}

.mmg-lightbox-detail {
	display: inline-block;
	margin-top: 0.85rem;
	padding: 0.55rem 1.35rem;
	border: 1px solid #fff;
	border-radius: 0;
	background: transparent;
	color: #fff;
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.3;
	text-decoration: none;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.mmg-lightbox-detail:hover,
.mmg-lightbox-detail:focus-visible {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	outline: none;
}

.mmg-lightbox-close,
.mmg-lightbox-prev,
.mmg-lightbox-next {
	position: absolute;
	border: 0;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	line-height: 1;
}

.mmg-lightbox-close {
	top: -0.25rem;
	right: -0.25rem;
	width: 2.5rem;
	height: 2.5rem;
	font-size: 1.75rem;
	border-radius: 4px;
}

.mmg-lightbox-prev,
.mmg-lightbox-next {
	top: 50%;
	transform: translateY(-50%);
	width: 2.75rem;
	height: 2.75rem;
	font-size: 1.35rem;
	border-radius: 999px;
}

.mmg-lightbox-prev {
	left: -0.5rem;
}

.mmg-lightbox-next {
	right: -0.5rem;
}

.mmg-lightbox-close:hover,
.mmg-lightbox-prev:hover,
.mmg-lightbox-next:hover,
.mmg-lightbox-close:focus-visible,
.mmg-lightbox-prev:focus-visible,
.mmg-lightbox-next:focus-visible {
	background: rgba(255, 255, 255, 0.24);
	outline: none;
}

@media (max-width: 782px) {
	.mmg-lightbox-prev {
		left: 0.25rem;
	}

	.mmg-lightbox-next {
		right: 0.25rem;
	}

	.mmg-lightbox-close {
		right: 0.25rem;
		top: 0.25rem;
	}
}
