/* Moments Gallery — front end. Override the custom properties in your theme to restyle. */
.mg-gallery {
	--mg-accent: #0e6b66;
	--mg-accent-ink: #fff;
	--mg-accent-soft: #e7f2f1;
	--mg-accent-soft-ink: #0b5753;
	--mg-ink: #14181f;
	--mg-muted: #4a5260;
	--mg-line: #e3e6eb;
	--mg-field: #d5d9e0;
	--mg-surface: #fff;
	--mg-subtle: #eef0f3;
	--mg-radius: 16px;
	--mg-gap: 20px;
	--mg-columns: 3;
	color: var(--mg-ink);
	margin: 2rem 0;
}

.mg-gallery *,
.mg-gallery *::before,
.mg-gallery *::after {
	box-sizing: border-box;
}

.mg-gallery__title {
	margin: 0 0 1.25rem;
}

/* Toolbar */
.mg-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px;
	margin-bottom: 18px;
	background: var(--mg-surface);
	border: 1px solid var(--mg-line);
	border-radius: var(--mg-radius);
}

.mg-chips,
.mg-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.mg-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 16px;
	border: 1px solid var(--mg-field);
	border-radius: 999px;
	background: var(--mg-surface);
	color: #2a303a;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.mg-chip:hover {
	border-color: var(--mg-ink);
	color: var(--mg-ink);
}

.mg-chip[aria-current="true"] {
	background: var(--mg-ink);
	border-color: var(--mg-ink);
	color: #fff;
}

.mg-chip__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--mg-subtle);
	color: var(--mg-muted);
	font-size: 12px;
}

.mg-chip[aria-current="true"] .mg-chip__count {
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
}

.mg-search {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	margin: 0;
	padding: 0 14px;
	border: 1px solid var(--mg-field);
	border-radius: 10px;
	background: var(--mg-surface);
	color: var(--mg-muted);
}

.mg-search:focus-within {
	border-color: var(--mg-accent);
	box-shadow: 0 0 0 3px var(--mg-accent-soft);
}

.mg-search input {
	width: 160px;
	border: 0;
	padding: 0;
	background: transparent;
	color: var(--mg-ink);
	font: inherit;
	font-size: 14px;
	outline: 0;
	box-shadow: none;
}

.mg-sort {
	display: flex;
	gap: 2px;
	padding: 4px;
	border-radius: 10px;
	background: var(--mg-subtle);
}

.mg-sort__btn {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 0 14px;
	border-radius: 8px;
	color: var(--mg-muted);
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
}

.mg-sort__btn[aria-current="true"] {
	background: var(--mg-surface);
	color: var(--mg-ink);
	box-shadow: 0 1px 3px rgba(20, 24, 31, 0.12);
}

.mg-status {
	margin: 0 0 16px;
	color: var(--mg-muted);
	font-size: 14px;
}

.mg-status strong {
	color: var(--mg-ink);
}

/* Grid */
.mg-grid {
	margin: 0;
	padding: 0;
	list-style: none;
	transition: opacity 0.2s;
}

.mg-gallery[aria-busy="true"] .mg-grid {
	opacity: 0.55;
}

.mg-layout-masonry .mg-grid {
	column-count: var(--mg-columns);
	column-gap: var(--mg-gap);
}

.mg-layout-masonry .mg-card {
	break-inside: avoid;
	margin-bottom: var(--mg-gap);
}

.mg-layout-grid .mg-grid {
	display: grid;
	grid-template-columns: repeat(var(--mg-columns), minmax(0, 1fr));
	gap: var(--mg-gap);
}

.mg-layout-grid .mg-card__media {
	aspect-ratio: 4 / 3 !important;
}

.mg-card {
	margin: 0;
	padding: 0;
}

.mg-card__open {
	display: block;
	width: 100%;
	padding: 0;
	border: 1px solid var(--mg-line);
	border-radius: var(--mg-radius);
	overflow: hidden;
	background: var(--mg-surface);
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: zoom-in;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mg-card__open:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(20, 24, 31, 0.1);
}

.mg-card__media {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--mg-subtle);
}

.mg-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mg-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	display: inline-flex;
	align-items: center;
	height: 26px;
	padding: 0 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.92);
	color: var(--mg-ink);
	font-size: 12px;
	font-weight: 700;
}

.mg-badge::before {
	content: "";
	width: 8px;
	height: 8px;
	margin-right: 6px;
	border-radius: 50%;
	background: #9a4b12;
}

.mg-badge--drive::before {
	background: var(--mg-accent);
}

.mg-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px 16px;
}

.mg-card__title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.mg-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	color: #5a6270;
	font-size: 13px;
}

.mg-pill {
	display: inline-flex;
	align-items: center;
	height: 24px;
	padding: 0 10px;
	border-radius: 999px;
	background: var(--mg-accent-soft);
	color: var(--mg-accent-soft-ink);
	font-weight: 600;
}

.mg-empty {
	padding: 48px 16px;
	border: 1px dashed var(--mg-field);
	border-radius: var(--mg-radius);
	color: var(--mg-muted);
	text-align: center;
}

.mg-more {
	display: flex;
	justify-content: center;
	margin-top: 12px;
}

.mg-more[hidden] {
	display: none;
}

.mg-btn {
	min-height: 48px;
	padding: 0 28px;
	border: 1px solid #c9ced6;
	border-radius: 12px;
	background: var(--mg-surface);
	color: var(--mg-ink);
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}

.mg-btn:hover {
	border-color: var(--mg-ink);
}

.mg-gallery a:focus-visible,
.mg-gallery button:focus-visible {
	outline: 3px solid var(--mg-accent);
	outline-offset: 2px;
}

/* Viewer */
.mg-no-scroll {
	overflow: hidden;
}

.mg-lightbox {
	width: 100vw;
	max-width: 100vw;
	height: 100vh;
	max-height: 100vh;
	height: 100dvh;
	max-height: 100dvh;
	margin: 0;
	padding: 0;
	border: 0;
	background: #0f1217;
	color: #f2f4f7;
}

.mg-lightbox[open] {
	display: flex;
	flex-direction: column;
}

.mg-lightbox::backdrop {
	background: rgba(15, 18, 23, 0.9);
}

.mg-lightbox__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	color: #b4bac5;
	font-size: 14px;
}

.mg-lightbox__actions {
	display: flex;
	gap: 8px;
}

.mg-icon-btn {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid #2b313b;
	border-radius: 10px;
	background: #171b22;
	color: #f2f4f7;
	cursor: pointer;
}

.mg-icon-btn:hover {
	border-color: #f2f4f7;
}

.mg-icon-btn--round {
	width: 52px;
	height: 52px;
	border-radius: 50%;
}

.mg-lightbox__stage {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 20px;
	min-height: 0;
	padding: 0 20px 24px;
}

.mg-lightbox__figure {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	height: 100%;
	min-width: 0;
	margin: 0;
}

.mg-lightbox__figure img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 12px;
}

.mg-lightbox__info {
	flex: none;
	width: 280px;
}

.mg-lightbox__title {
	margin: 0 0 10px;
	color: #f2f4f7;
	font-size: 22px;
	line-height: 1.25;
}

.mg-lightbox__caption {
	margin: 0 0 16px;
	color: #b4bac5;
	font-size: 14px;
	line-height: 1.6;
}

.mg-lightbox__meta {
	display: grid;
	grid-template-columns: 90px 1fr;
	row-gap: 10px;
	margin: 0 0 16px;
	font-size: 14px;
}

.mg-lightbox__meta dt {
	color: #8a92a0;
}

.mg-lightbox__meta dd {
	margin: 0;
}

.mg-lightbox__drive {
	color: #8fd3cc;
	font-weight: 700;
}

/* Responsive */
@media (max-width: 1000px) {
	.mg-gallery {
		--mg-columns: 2 !important;
	}

	.mg-lightbox__stage {
		flex-wrap: wrap;
		overflow-y: auto;
	}

	.mg-lightbox__figure {
		flex-basis: 100%;
		height: 60vh;
		order: -1;
	}

	.mg-lightbox__info {
		flex: 1;
		width: auto;
	}
}

@media (max-width: 600px) {
	.mg-gallery {
		--mg-columns: 1 !important;
	}

	.mg-tools,
	.mg-search {
		width: 100%;
	}

	.mg-search input {
		flex: 1;
		width: auto;
	}

	.mg-chips {
		flex-wrap: nowrap;
		overflow-x: auto;
		width: 100%;
		padding-bottom: 4px;
	}

	.mg-chip {
		flex: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mg-card__open,
	.mg-grid {
		transition: none;
	}

	.mg-card__open:hover {
		transform: none;
	}
}
