/**
 * Multibrand Glass — mb/ugc (community photo feed).
 * Uses the shared design tokens from assets/blocks.css.
 */

.mb-ugc,
.mb-ugc *,
.mb-ugc-lightbox,
.mb-ugc-lightbox * {
	box-sizing: border-box;
}

.mb-ugc {
	padding: 84px 0 64px;
	background: var(--mb-white, #fff);
	font-family: var(--mb-font-body, 'DM Sans', sans-serif);
}
.mb-ugc__inner {
	max-width: var(--mb-max-width, 1344px);
	margin: 0 auto;
	padding: 0 48px;
}

/* The photo strip lives outside .mb-ugc__inner (see render.php) so it spans the
   full section width. Done in markup rather than with a 100vw breakout, which
   overflows by the scrollbar width and produces a horizontal scroll. */
.mb-ugc__track {
	--mb-ugc-gap: 6px;
	padding: 0 var(--mb-ugc-gap);
}

/* ── Head ─────────────────────────────────────────────────────────────────── */
/* One line: handle left, heading centred, arrows right. The 1fr side columns
   are equal, so the middle stays optically centred whether or not the side
   slots hold anything. */
.mb-ugc__head {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: end;
	gap: 16px;
	padding-bottom: 30px;
}
.mb-ugc__head-start { justify-self: start; }
.mb-ugc__head-text  { text-align: center; }
/* Bottom-right, sitting on the baseline of the last line of the subtitle. */
.mb-ugc__head-end   { justify-self: end; }
.mb-ugc__eyebrow {
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--mb-gray-400, #999);
	margin: 0 0 10px;
}
.mb-ugc__title {
	font-family: var(--mb-font-display, 'Bebas Neue', sans-serif);
	font-size: 40px;
	font-weight: 400;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1;
	color: var(--mb-black, #111);
	margin: 0;
}
.mb-ugc__subtitle {
	margin-left: auto;
	margin-right: auto;
	font-size: 13px;
	letter-spacing: 0.02em;
	color: var(--mb-gray-500, #777);
	margin: 10px 0 0;
	max-width: 46ch;
}
.mb-ugc__controls {
	display: flex;
	align-items: center;
	gap: 8px;
}
.mb-ugc__handle {
	font-size: 10px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--mb-gray-500, #777);
	text-decoration: none;
	border: 1px solid var(--mb-gray-200, #ccc);
	border-radius: 999px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	padding: 0 20px;
	transition: color .25s, border-color .25s, background .25s;
}
a.mb-ugc__handle:hover {
	color: var(--mb-white, #fff);
	background: var(--mb-black, #111);
	border-color: var(--mb-black, #111);
}
.mb-ugc__controls {
	display: flex;
	gap: 8px;
}
.mb-ugc__arrow {
	width: 40px;
	height: 40px;
	border: 1px solid var(--mb-gray-200, #ccc);
	border-radius: 50%;
	background: none;
	color: var(--mb-black, #111);
	font-size: 18px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background .25s, color .25s, border-color .25s, opacity .25s;
}
.mb-ugc__arrow:hover {
	background: var(--mb-black, #111);
	color: var(--mb-white, #fff);
	border-color: var(--mb-black, #111);
}
.mb-ugc__arrow:disabled {
	opacity: .25;
	cursor: default;
	background: none;
	color: var(--mb-black, #111);
	border-color: var(--mb-gray-200, #ccc);
}

/* ── Track ────────────────────────────────────────────────────────────────── */
.mb-ugc__track--grid {
	display: grid;
	grid-template-columns: repeat(var(--mb-ugc-cols, 4), minmax(0, 1fr));
	gap: var(--mb-ugc-gap, 6px);
}
.mb-ugc__track--scroll {
	display: flex;
	gap: var(--mb-ugc-gap, 6px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.mb-ugc__track--scroll::-webkit-scrollbar { display: none; }
.mb-ugc__track--scroll .mb-ugc__item {
	scroll-snap-align: start;
	flex: 0 0 calc(
		(100% - (var(--mb-ugc-cols, 4) - 1) * var(--mb-ugc-gap, 6px))
		/ var(--mb-ugc-cols, 4)
	);
	min-width: 180px;
}

/* ── Item ─────────────────────────────────────────────────────────────────── */
.mb-ugc__item {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.mb-ugc__media {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: var(--mb-gray-50, #f5f5f5);
	aspect-ratio: 1 / 1;
	overflow: hidden;
	cursor: pointer;
}
.mb-ugc__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .8s ease;
}
.mb-ugc__media:hover .mb-ugc__img { transform: scale(1.04); }
.mb-ugc__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(transparent 55%, rgba(0, 0, 0, .34));
	opacity: 0;
	transition: opacity .3s;
	pointer-events: none;
}
.mb-ugc__overlay { opacity: 1; }
.mb-ugc__media:hover .mb-ugc__overlay { opacity: 1; }
/* Handle + shop pill sit on the photo and fade in together on hover. The
   caption and the real shop link live in the lightbox, so nothing here needs
   to be clickable — the whole tile opens the lightbox. */
.mb-ugc__hover {
	position: absolute;
	left: 16px;
	right: 16px;
	bottom: 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	pointer-events: none;
}
.mb-ugc__author {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--mb-white, #fff);
	text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
.mb-ugc__tag {
	flex: 0 0 auto;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .3s, transform .3s;
	padding: 8px 15px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .95);
	color: var(--mb-black, #111);
	font-size: 9px;
	font-weight: 500;
	letter-spacing: .18em;
	text-transform: uppercase;
	white-space: nowrap;
}

.mb-ugc__media:hover .mb-ugc__tag,
.mb-ugc__media:focus-visible .mb-ugc__tag {
	opacity: 1;
	transform: translateY(0);
}

/* Touch devices have no hover — show the pill outright. */
@media (hover: none) {
	.mb-ugc__tag {
		opacity: 1;
		transform: none;
	}
	.mb-ugc__overlay { opacity: 1; }
}

/* ── Foot CTA ─────────────────────────────────────────────────────────────── */
.mb-ugc__foot {
	display: flex;
	justify-content: center;
	padding-top: 36px;
}
.mb-ugc__cta {
	height: 40px;
	display: inline-flex;
	align-items: center;
	padding: 0 30px;
	border: 1px solid var(--mb-black, #111);
	border-radius: 999px;
	font-size: 10px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--mb-black, #111);
	transition: background .25s, color .25s;
}
.mb-ugc__cta:link,
.mb-ugc__cta:visited,
.mb-ugc__cta:focus,
.mb-ugc__cta:active {
	color: var(--mb-black, #111);
}
.mb-ugc__cta:hover {
	background: var(--mb-black, #111);
	color: var(--mb-white, #fff);
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */
.mb-ugc-lightbox {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	background: rgba(17, 17, 17, .82);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s, visibility .3s;
	font-family: var(--mb-font-body, 'DM Sans', sans-serif);
}
.mb-ugc-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}
.mb-ugc-lightbox__dialog {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
	background: var(--mb-white, #fff);
	max-width: 1080px;
	width: 100%;
	max-height: 90vh;
	overflow: hidden;
}
.mb-ugc-lightbox__figure {
	position: relative;
	background: var(--mb-gray-50, #f5f5f5);
	min-height: 0;
}
.mb-ugc-lightbox__img {
	width: 100%;
	height: 100%;
	max-height: 90vh;
	object-fit: cover;
	display: block;
}
.mb-ugc-lightbox__body {
	padding: 40px 36px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	overflow-y: auto;
}
.mb-ugc-lightbox__author {
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--mb-black, #111);
	margin: 0;
}
.mb-ugc-lightbox__caption {
	font-size: 15px;
	line-height: 1.6;
	color: var(--mb-gray-700, #444);
	margin: 0;
}
.mb-ugc-lightbox__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: auto;
	padding-top: 16px;
}
.mb-ugc-lightbox__btn {
	height: 40px;
	display: inline-flex;
	align-items: center;
	padding: 0 22px;
	border-radius: 999px;
	font-size: 10px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	text-decoration: none;
	border: 1px solid var(--mb-black, #111);
	background: var(--mb-black, #111);
	color: var(--mb-white, #fff);
	transition: background .25s, color .25s;
}
/* The theme paints every focused link grey (a:focus in main.css outranks a bare
   class), so after a click the label vanished into the black pill. Pin the
   colours for every link state the theme reaches for. */
.mb-ugc-lightbox__btn:link,
.mb-ugc-lightbox__btn:visited,
.mb-ugc-lightbox__btn:focus,
.mb-ugc-lightbox__btn:active {
	color: var(--mb-white, #fff);
}
.mb-ugc-lightbox__btn:hover {
	background: var(--mb-white, #fff);
	color: var(--mb-black, #111);
}
.mb-ugc-lightbox__btn--ghost,
.mb-ugc-lightbox__btn--ghost:link,
.mb-ugc-lightbox__btn--ghost:visited,
.mb-ugc-lightbox__btn--ghost:focus,
.mb-ugc-lightbox__btn--ghost:active {
	background: none;
	color: var(--mb-black, #111);
	border-color: var(--mb-gray-200, #ccc);
}
.mb-ugc-lightbox__btn--ghost:hover {
	background: var(--mb-black, #111);
	color: var(--mb-white, #fff);
	border-color: var(--mb-black, #111);
}
.mb-ugc-lightbox__close,
.mb-ugc-lightbox__nav {
	position: absolute;
	width: 40px;
	height: 40px;
	border: 1px solid var(--mb-gray-200, #ccc);
	border-radius: 50%;
	background: rgba(255, 255, 255, .95);
	color: var(--mb-black, #111);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	transition: background .25s, color .25s, border-color .25s;
	z-index: 2;
}
.mb-ugc-lightbox__close:hover,
.mb-ugc-lightbox__nav:hover {
	background: var(--mb-black, #111);
	color: var(--mb-white, #fff);
	border-color: var(--mb-black, #111);
}
.mb-ugc-lightbox__close { top: 12px; right: 12px; }
.mb-ugc-lightbox__nav--prev { top: 50%; left: 12px; right: auto; transform: translateY(-50%); }
.mb-ugc-lightbox__nav--next { top: 50%; left: auto; right: 12px; transform: translateY(-50%); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
	.mb-ugc__track--grid { grid-template-columns: repeat(min(var(--mb-ugc-cols, 4), 3), minmax(0, 1fr)); }
	.mb-ugc__inner { padding: 0 24px; }
}

@media (max-width: 767px) {
	.mb-ugc { padding: 52px 0 44px; }
	.mb-ugc__inner { padding: 0 16px; }
	.mb-ugc__head {
		align-items: flex-start;
		padding-bottom: 20px;
	}
	.mb-ugc__title { font-size: 30px; }
	.mb-ugc__subtitle { font-size: 12px; }
	.mb-ugc__track--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.mb-ugc__track--scroll .mb-ugc__item { flex: 0 0 68%; min-width: 0; }
	.mb-ugc__caption { display: none; }

}

@media (prefers-reduced-motion: reduce) {
	.mb-ugc__img,
	.mb-ugc__overlay,
	.mb-ugc__tag,
	.mb-ugc-lightbox { transition: none; }
	.mb-ugc__media:hover .mb-ugc__img { transform: none; }
}


/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
	/* Scroller arrows are redundant next to a swipeable strip, and at this
	   width they crowd the heading. */
	.mb-ugc__controls { display: none; }

	.mb-ugc__head {
		grid-template-columns: 1fr;
		gap: 12px;
	}
	.mb-ugc__head-start,
	.mb-ugc__head-end { justify-self: center; }
	.mb-ugc__head-end:empty { display: none; }

	.mb-ugc-lightbox { padding: 16px; }

	/* Stack image over text and let the dialog shrink to its content — the
	   grid used to stretch the text pane to full height, which is where the
	   large empty white area came from. */
	.mb-ugc-lightbox__dialog {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
		align-content: start;
		width: 100%;
		max-width: 400px;
		height: auto;
		max-height: 88vh;
		overflow-y: auto;
		border-radius: 6px;
	}
	.mb-ugc-lightbox__figure { aspect-ratio: 1 / 1; }
	.mb-ugc-lightbox__img {
		height: 100%;
		max-height: none;
	}
	.mb-ugc-lightbox__body {
		padding: 20px 18px 22px;
		gap: 10px;
		text-align: center;
		overflow: visible;
	}
	.mb-ugc-lightbox__caption { font-size: 14px; }

	/* margin-top:auto pushes the buttons to the bottom of a stretched pane;
	   with the dialog sized to content that would reopen the gap. */
	.mb-ugc-lightbox__actions {
		margin-top: 0;
		padding-top: 6px;
		justify-content: center;
	}
	.mb-ugc-lightbox__btn {
		height: 46px;
		padding: 0 24px;
		font-size: 11px;
	}
	.mb-ugc-lightbox__nav { width: 36px; height: 36px; }
}
