/*
 * La Galga Gris · ugc-grid.css
 * Grid masonry tipo "Instagram editorial" con lightbox.
 */

.lgg-ugc {
	padding-block: clamp(3rem, 6vw, 5rem);
}

.lgg-ugc__head {
	max-width: var(--container-default);
	margin: 0 auto var(--sp-6);
	padding-inline: var(--container-pad-x);
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	align-items: center;
}
.lgg-ugc__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: clamp(1.75rem, 3vw, 2.75rem);
	font-weight: var(--fw-medium);
	line-height: 1.1;
	letter-spacing: var(--ls-display);
}
.lgg-ugc__lead { margin: 0; max-width: 56ch; }

/* ── Grid ──────────────────────────────────────────────────────── */
.lgg-ugc__grid {
	list-style: none;
	margin: 0;
	padding: 0 var(--container-pad-x);
	max-width: var(--container-wide);
	margin-inline: auto;

	display: grid;
	grid-template-columns: repeat(2, 1fr);
	grid-auto-rows: 130px;
	gap: var(--sp-2);
}
@media (min-width: 640px) {
	.lgg-ugc__grid {
		grid-template-columns: repeat(3, 1fr);
		grid-auto-rows: 160px;
		gap: var(--sp-3);
	}
}
@media (min-width: 1024px) {
	.lgg-ugc__grid {
		grid-template-columns: repeat(4, 1fr);
		grid-auto-rows: 180px;
	}
}
@media (min-width: 1280px) {
	.lgg-ugc__grid {
		grid-template-columns: repeat(5, 1fr);
		grid-auto-rows: 200px;
	}
}

.lgg-ugc__item                 { grid-row: span 1; }
.lgg-ugc__item--span-2         { grid-row: span 2; }
.lgg-ugc__item--span-3         { grid-row: span 2; }
@media (min-width: 1024px) {
	.lgg-ugc__item--span-3     { grid-row: span 3; }
}

/* ── Tile button ────────────────────────────────────────────────── */
.lgg-ugc__btn {
	position: relative;
	width: 100%;
	height: 100%;
	display: block;
	overflow: hidden;
	border: 0;
	background: var(--color-bg-subtle);
	cursor: pointer;
	border-radius: var(--radius-md);
	padding: 0;
	color: var(--color-ink-inverse);
}
.lgg-ugc__btn:focus-visible {
	outline: 2px solid var(--color-focus-ring);
	outline-offset: 3px;
}

.lgg-ugc__img {
	position: absolute;
	inset: 0;
	width: 100%; height: 100%;
	object-fit: cover;
	transition: transform var(--dur-slow) var(--ease-emphasized),
				filter var(--dur-base) var(--ease-standard);
}
.lgg-ugc__btn:hover .lgg-ugc__img { transform: scale(1.06); filter: brightness(0.85); }
@media (prefers-reduced-motion: reduce) {
	.lgg-ugc__btn:hover .lgg-ugc__img { transform: none; filter: none; }
}

.lgg-ugc__img--placeholder {
	background: linear-gradient(135deg, var(--color-secondary-soft) 0%, var(--color-secondary) 100%);
}

/* Overlay + handle */
.lgg-ugc__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-ink-inverse);
	background: color-mix(in srgb, var(--color-ink-primary) 30%, transparent);
	opacity: 0;
	transition: opacity var(--dur-base) var(--ease-standard);
}
.lgg-ugc__btn:hover .lgg-ugc__overlay,
.lgg-ugc__btn:focus-visible .lgg-ugc__overlay { opacity: 1; }

.lgg-ugc__handle {
	position: absolute;
	left: var(--sp-3); bottom: var(--sp-3);
	font-family: var(--font-body);
	font-size: var(--fz-micro);
	font-weight: var(--fw-semibold);
	letter-spacing: 0.04em;
	padding: 4px 8px;
	background: color-mix(in srgb, var(--color-ink-primary) 60%, transparent);
	color: var(--color-ink-inverse);
	border-radius: var(--radius-pill);
	backdrop-filter: blur(4px);
}

/* CTA opcional bajo el grid */
.lgg-ugc__cta {
	text-align: center;
	margin-top: var(--sp-6);
}

/* ── Lightbox ───────────────────────────────────────────────────── */
.lgg-ugc-lightbox {
	position: fixed;
	inset: 0;
	z-index: var(--z-modal);
	display: flex;
	align-items: center;
	justify-content: center;
}
.lgg-ugc-lightbox[hidden] { display: none; }

.lgg-ugc-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--color-ink-primary) 88%, transparent);
	backdrop-filter: blur(8px);
}
.lgg-ugc-lightbox__figure {
	position: relative;
	z-index: 2;
	max-width: min(900px, 92vw);
	max-height: 86vh;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--sp-3);
}
.lgg-ugc-lightbox__img {
	max-width: 100%;
	max-height: 78vh;
	object-fit: contain;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	background: var(--color-bg-subtle);
}
.lgg-ugc-lightbox__caption {
	color: color-mix(in srgb, var(--color-ink-inverse) 80%, transparent);
	font-size: var(--fz-small);
	text-align: center;
}

.lgg-ugc-lightbox__close,
.lgg-ugc-lightbox__nav {
	position: absolute;
	z-index: 3;
	width: 44px; height: 44px;
	border-radius: 50%;
	border: 0;
	background: color-mix(in srgb, var(--color-ink-inverse) 18%, transparent);
	color: var(--color-ink-inverse);
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	transition: background var(--dur-fast) var(--ease-standard);
}
.lgg-ugc-lightbox__close:hover,
.lgg-ugc-lightbox__nav:hover { background: var(--color-accent); }

.lgg-ugc-lightbox__close { top: var(--sp-5); right: var(--sp-5); }
.lgg-ugc-lightbox__nav--prev { left: var(--sp-3); top: 50%; transform: translateY(-50%); }
.lgg-ugc-lightbox__nav--next { right: var(--sp-3); top: 50%; transform: translateY(-50%); }
@media (min-width: 768px) {
	.lgg-ugc-lightbox__nav--prev { left: var(--sp-5); }
	.lgg-ugc-lightbox__nav--next { right: var(--sp-5); }
}
