/**
 * Mbica front-end styles — ECO Design Studio.
 * Layout variables (--mb-cols, --mb-gap) are set inline per gallery.
 *
 * Brand tokens sit in one block so the plugin can be re-skinned in one edit.
 * Values follow the ECO palette: deep evergreen, warm paper, near-black ink,
 * brass accent, sage mist. Replace the hex values to match an exact brand sheet.
 */

:root {
	--mbica-evergreen: #12352c;
	--mbica-ink: #14161a;
	--mbica-paper: #f5f2ea;
	--mbica-brass: #b4894a;
	--mbica-sage: #c9d6cb;
}

.mb-gallery {
	--mb-cols: 3;
	--mb-gap: 12px;
	--mb-radius: 3px;
	--mb-veil: rgba(18, 53, 44, 0.42);
	--mb-veil: color-mix(in srgb, var(--mbica-evergreen) 62%, transparent);
	margin: 0 0 1.5em;
}

.mb-gallery.mb-is-source {
	display: none !important;
}

.mb-item {
	position: relative;
	margin: 0;
	padding: 0;
}

.mb-item__link {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--mb-radius);
	box-shadow: none;
	text-decoration: none;
	line-height: 0;
	background: rgba(201, 214, 203, 0.4);
	background: color-mix(in srgb, var(--mbica-sage) 40%, transparent);
}

.mb-item__link:focus-visible {
	outline: 3px solid var(--mbica-brass);
	outline-offset: 3px;
}

.mb-gallery .mb-img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	border-radius: inherit;
}

/* Grid: equal tiles, cropped. */
.mb-layout-grid {
	display: grid;
	grid-template-columns: repeat(var(--mb-cols), minmax(0, 1fr));
	gap: var(--mb-gap);
}

.mb-layout-grid .mb-item__link {
	aspect-ratio: 4 / 3;
}

.mb-layout-grid .mb-img {
	height: 100%;
	object-fit: cover;
}

/* Masonry: natural ratios in CSS columns. */
.mb-layout-masonry {
	column-count: var(--mb-cols);
	column-gap: var(--mb-gap);
}

.mb-layout-masonry .mb-item {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	margin-bottom: var(--mb-gap);
}

/* Carousel: one row, snap scrolling. */
.mb-carousel {
	position: relative;
}

.mb-layout-carousel {
	display: flex;
	gap: var(--mb-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	padding-bottom: 6px;
}

.mb-layout-carousel .mb-item {
	flex: 0 0 calc((100% - (var(--mb-cols) - 1) * var(--mb-gap)) / var(--mb-cols));
	scroll-snap-align: start;
}

.mb-layout-carousel .mb-item__link {
	aspect-ratio: 4 / 3;
}

.mb-layout-carousel .mb-img {
	height: 100%;
	object-fit: cover;
}

.mb-carousel__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--mbica-paper);
	color: var(--mbica-evergreen);
	box-shadow: 0 2px 10px rgba(18, 53, 44, 0.22);
	cursor: pointer;
}

.mb-carousel__nav--prev {
	left: -14px;
}

.mb-carousel__nav--next {
	right: -14px;
}

.mb-carousel__nav[hidden] {
	display: none;
}

.mb-carousel__nav .mb-icon {
	width: 20px;
	height: 20px;
}

/* Hover veil and expand icon. */
.mb-item__veil {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: #fff;
	background: var(--mb-veil);
	opacity: 0;
	transition: opacity 0.18s ease;
}

.mb-item__link:hover .mb-item__veil,
.mb-item__link:focus-visible .mb-item__veil {
	opacity: 1;
}

.mb-item__veil .mb-icon {
	width: 26px;
	height: 26px;
}

/* Captions. */
.mb-item__caption {
	margin: 0.45em 0 0;
	font-size: 0.85em;
	line-height: 1.4;
	opacity: 0.75;
}

.mb-captions-none .mb-item__caption {
	display: none;
}

.mb-captions-hover .mb-item__caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	margin: 0;
	padding: 1.6em 0.75em 0.6em;
	color: #fff;
	opacity: 0;
	background: linear-gradient(to top, rgba(11, 26, 22, 0.86), rgba(11, 26, 22, 0));
	border-radius: 0 0 var(--mb-radius) var(--mb-radius);
	transition: opacity 0.18s ease;
	pointer-events: none;
}

.mb-captions-hover .mb-item:hover .mb-item__caption,
.mb-captions-hover .mb-item:focus-within .mb-item__caption {
	opacity: 1;
}

/* Album covers. */
.mb-album__meta {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75em;
	margin: 0.5em 0 0;
	font-size: 0.9em;
}

.mb-album__title {
	font-weight: 600;
}

.mb-album__count {
	opacity: 0.6;
	font-size: 0.85em;
	white-space: nowrap;
}

/* Responsive column steps. */
@media (max-width: 1024px) {
	.mb-layout-grid,
	.mb-album.mb-layout-grid {
		grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	}

	.mb-layout-masonry {
		column-count: 2;
	}
}

@media (max-width: 600px) {
	.mb-layout-grid,
	.mb-album.mb-layout-grid {
		grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	}

	.mb-layout-masonry {
		column-count: 1;
	}

	.mb-layout-carousel .mb-item {
		flex-basis: 78%;
	}

	.mb-carousel__nav {
		display: none;
	}
}

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

.mb-lightbox {
	--mb-lb-bg: rgba(9, 22, 18, 0.95);
	--mb-lb-fg: var(--mbica-paper);
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	background: var(--mb-lb-bg);
	color: var(--mb-lb-fg);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mb-lightbox--light {
	--mb-lb-bg: rgba(245, 242, 234, 0.97);
	--mb-lb-fg: var(--mbica-ink);
}

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

.mb-lightbox__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.75rem 1rem;
	font: 500 0.85rem/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
	letter-spacing: 0.02em;
}

.mb-lightbox__counter {
	opacity: 0.65;
	font-variant-numeric: tabular-nums;
}

.mb-lightbox__stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 clamp(0.5rem, 4vw, 4rem);
}

.mb-lightbox__figure {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
}

.mb-lightbox__img {
	max-width: 100%;
	max-height: 78vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 2px;
	opacity: 0;
	transition: opacity 0.2s ease;
	cursor: zoom-in;
}

.mb-lightbox__img.is-loaded {
	opacity: 1;
}

.mb-lightbox.is-zoomed .mb-lightbox__img {
	max-height: none;
	max-width: none;
	cursor: zoom-out;
}

.mb-lightbox.is-zoomed .mb-lightbox__stage {
	overflow: auto;
	align-items: flex-start;
	justify-content: flex-start;
}

.mb-lightbox__caption {
	max-width: 62ch;
	margin: 0;
	text-align: center;
	font: 400 0.9rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
	opacity: 0.75;
}

.mb-lightbox__btn {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.mb-lightbox__btn:hover,
.mb-lightbox__btn:focus-visible {
	background: rgba(128, 128, 128, 0.22);
}

.mb-lightbox__btn:focus-visible {
	outline: 2px solid var(--mbica-brass);
	outline-offset: 2px;
}

.mb-lightbox__btn .mb-icon {
	width: 24px;
	height: 24px;
}

.mb-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	background: rgba(201, 214, 203, 0.18);
	background: color-mix(in srgb, var(--mbica-sage) 18%, transparent);
}

.mb-lightbox__nav--prev {
	left: clamp(0.25rem, 2vw, 1.5rem);
}

.mb-lightbox__nav--next {
	right: clamp(0.25rem, 2vw, 1.5rem);
}

.mb-lightbox__nav[hidden] {
	display: none;
}

.mb-lightbox__spinner {
	position: absolute;
	width: 26px;
	height: 26px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	opacity: 0.5;
	animation: mb-spin 0.7s linear infinite;
}

.mb-lightbox__spinner[hidden] {
	display: none;
}

@keyframes mb-spin {
	to {
		transform: rotate(360deg);
	}
}

.mb-lightbox__strip {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding: 0.75rem 1rem 1rem;
	scrollbar-width: thin;
}

.mb-lightbox__strip[hidden] {
	display: none;
}

.mb-lightbox__thumb {
	flex: 0 0 auto;
	width: 62px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 2px;
	overflow: hidden;
	background: none;
	cursor: pointer;
	opacity: 0.45;
	transition: opacity 0.15s ease;
}

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

.mb-lightbox__thumb:hover,
.mb-lightbox__thumb:focus-visible {
	opacity: 0.85;
}

.mb-lightbox__thumb.is-current {
	opacity: 1;
	box-shadow: inset 0 0 0 2px var(--mbica-brass);
}

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

@media (prefers-reduced-motion: reduce) {
	.mb-lightbox,
	.mb-lightbox__img,
	.mb-item__veil,
	.mb-item__caption,
	.mb-layout-carousel {
		transition: none;
		scroll-behavior: auto;
	}

	.mb-lightbox__spinner {
		animation: none;
	}
}

/* Breadcrumb — album » gallery, sits above the page title. */

.mb-crumbs {
	margin: 0 0 0.85em;
	font-size: 0.95em;
	line-height: 1.4;
}

.mb-crumbs--hoisted {
	margin-bottom: 0.4em;
}

.mb-crumbs__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.45em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mb-crumbs__item {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mb-crumbs__item::marker {
	content: "";
}

.mb-crumbs__item + .mb-crumbs__item::before {
	content: "\00bb";
	color: var(--mbica-ink);
	opacity: 0.45;
}

.mb-crumbs__link {
	color: var(--mbica-brass);
	text-decoration: none;
	box-shadow: none;
}

.mb-crumbs__link:hover,
.mb-crumbs__link:focus-visible {
	text-decoration: underline;
}

.mb-crumbs__link:focus-visible {
	outline: 2px solid var(--mbica-brass);
	outline-offset: 2px;
}

.mb-crumbs__current,
.mb-crumbs__text {
	color: var(--mbica-ink);
	opacity: 0.85;
}
