/* ---------- Masonry grid ---------- */

/* Tag filter menu: sits on top of the gallery, same width, wraps on small screens */
.mmg-wrap .mmg-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 18px;
	box-sizing: border-box;
	width: 100%;
	margin: 0 0 20px;
	padding: 0;
}

.mmg-wrap .mmg-filter .mmg-tag {
	display: inline-block;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 6px 2px;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var(--mmg-tag-color, #008bdc);
	font-family: inherit;
	font-size: var(--mmg-tag-size, 20px);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-underline-offset: 3px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.mmg-wrap .mmg-filter .mmg-tag:hover,
.mmg-wrap .mmg-filter .mmg-tag:focus,
.mmg-wrap .mmg-filter .mmg-tag:active {
	background: none;
	color: var(--mmg-tag-color, #008bdc);
	box-shadow: none;
	text-decoration: underline;
}

.mmg-wrap .mmg-filter .mmg-tag.mmg-active {
	text-decoration: underline;
}

.mmg-wrap .mmg-filter .mmg-tag:focus-visible {
	outline: 2px solid var(--mmg-tag-color, #008bdc);
	outline-offset: 2px;
}

/* Fallback before JavaScript runs: CSS columns */
/* 10px on both sides so the menu and images never touch the edge of the page */
.mmg-wrap {
	box-sizing: border-box;
	margin: 1.5em 0;
	padding: 0 10px;
}

.mmg-gallery {
	column-count: 4;
	column-gap: var(--mmg-gap, 10px);
	margin: 0;
}

@media (max-width: 1024px) {
	.mmg-gallery { column-count: 3; }
}

@media (max-width: 600px) {
	.mmg-gallery { column-count: 2; }
}

.mmg-item {
	display: block;
	margin: 0 0 var(--mmg-gap, 10px);
	break-inside: avoid;
}

/* Once JavaScript has built the columns (keeps newest-first reading order) */
.mmg-gallery.mmg-ready {
	display: flex;
	align-items: flex-start;
	column-count: auto;
	gap: var(--mmg-gap, 10px);
}

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

.mmg-col {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	gap: var(--mmg-gap, 10px);
	min-width: 0;
}

.mmg-gallery .mmg-link {
	display: block;
	line-height: 0;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: none;
	text-decoration: none;
}

.mmg-gallery .mmg-img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	border-radius: 6px;
}

/* Caption: small, left aligned, inherits the theme's font and colors */
.mmg-gallery .mmg-caption {
	margin: 6px 0 0;
	font-size: var(--mmg-cap-size, 0.85em);
	line-height: 1.4;
	text-align: left;
	color: var(--mmg-cap-color, inherit);
}

.mmg-gallery .mmg-caption a {
	color: inherit;
	text-decoration: underline;
}

/* ---------- Like heart ---------- */

.mmg-gallery .mmg-media {
	position: relative;
}

.mmg-gallery .mmg-media .mmg-like {
	position: absolute;
	right: 4px;
	bottom: 4px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 8px;
	border: 0;
	border-radius: 999px;
	background: none;
	box-shadow: none;
	color: #fff;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.mmg-gallery .mmg-media .mmg-like:hover,
.mmg-gallery .mmg-media .mmg-like:focus,
.mmg-gallery .mmg-media .mmg-like:active {
	background: none;
	color: #fff;
	box-shadow: none;
}

.mmg-gallery .mmg-media .mmg-like:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 0;
}

.mmg-gallery .mmg-like .mmg-heart {
	width: 22px;
	height: 22px;
	fill: #fff;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
	transition: fill 0.15s ease, transform 0.15s ease;
}

.mmg-gallery .mmg-like:hover .mmg-heart {
	transform: scale(1.12);
}

.mmg-gallery .mmg-like.mmg-liked {
	cursor: default;
}

.mmg-gallery .mmg-like.mmg-liked .mmg-heart {
	fill: #e11d48;
	animation: mmg-pop 0.35s ease;
}

@keyframes mmg-pop {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.35); }
	100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.mmg-gallery .mmg-like.mmg-liked .mmg-heart {
		animation: none;
	}
}

/* ---------- Lightbox ---------- */

.mmg-lightbox .mmg-lb-media {
	position: relative;
	display: block;
	line-height: 0;
}

/* Like heart inside the lightbox: same look as in the grid */
.mmg-lightbox .mmg-lb-media .mmg-like {
	position: absolute;
	right: 4px;
	bottom: 4px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 8px;
	border: 0;
	border-radius: 999px;
	background: none;
	box-shadow: none;
	color: #fff;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.mmg-lightbox .mmg-lb-media .mmg-like[hidden] {
	display: none;
}

.mmg-lightbox .mmg-lb-media .mmg-like:hover,
.mmg-lightbox .mmg-lb-media .mmg-like:focus,
.mmg-lightbox .mmg-lb-media .mmg-like:active {
	background: none;
	color: #fff;
	box-shadow: none;
}

.mmg-lightbox .mmg-lb-media .mmg-like:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 0;
}

.mmg-lightbox .mmg-like .mmg-heart {
	width: 22px;
	height: 22px;
	fill: #fff;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
	transition: fill 0.15s ease, transform 0.15s ease;
}

.mmg-lightbox .mmg-like:hover .mmg-heart {
	transform: scale(1.12);
}

.mmg-lightbox .mmg-like.mmg-liked {
	cursor: default;
}

.mmg-lightbox .mmg-like.mmg-liked .mmg-heart {
	fill: #e11d48;
	animation: mmg-pop 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
	.mmg-lightbox .mmg-like.mmg-liked .mmg-heart {
		animation: none;
	}
}

.mmg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.94);
	opacity: 0;
	transition: opacity 0.2s ease;
}

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

.mmg-lightbox.mmg-open {
	opacity: 1;
}

.mmg-lightbox .mmg-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	overflow: hidden;
	touch-action: pan-y;
}

.mmg-lightbox .mmg-lb-figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 94vw;
	margin: 0;
	will-change: transform;
}

.mmg-lightbox .mmg-lb-img {
	display: block;
	width: auto;
	height: auto;
	max-width: 94vw;
	max-height: 80vh;
	max-height: 80dvh;
	margin: 0;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

.mmg-lightbox .mmg-lb-caption {
	max-width: min(90vw, 720px);
	margin: 12px 0 0;
	color: #f1f1f1;
	font-size: 0.95rem;
	line-height: 1.45;
	text-align: center;
}

.mmg-lightbox .mmg-lb-caption:empty {
	display: none;
}

.mmg-lightbox .mmg-lb-caption a {
	color: #fff;
	text-decoration: underline;
}

.mmg-lightbox .mmg-close {
	position: absolute;
	top: max(12px, env(safe-area-inset-top));
	right: max(12px, env(safe-area-inset-right));
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	cursor: pointer;
	box-shadow: none;
}

.mmg-lightbox .mmg-close:hover,
.mmg-lightbox .mmg-close:focus-visible {
	background: rgba(255, 255, 255, 0.3);
	color: #fff;
}

.mmg-lightbox .mmg-close svg {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
}

html.mmg-lb-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.mmg-lightbox {
		transition: none;
	}
}
