/* ==========================================================================
   Simple Grid Gallery - estilos del front-end
   ========================================================================== */

.sgg-gallery {
	display: grid;
	gap: var(--sgg-gap, 12px);
	margin: 1.5em 0;
}

.sgg-item {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: 6px;
	background: #eee;
}

.sgg-item a.sgg-link {
	display: block;
	width: 100%;
	height: 100%;
	cursor: zoom-in;
}

.sgg-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .25s ease;
}

.sgg-item a.sgg-link:hover img {
	transform: scale(1.03);
}

.sgg-caption {
	padding: 6px 2px 2px;
	font-size: 13px;
	color: #555;
	text-align: center;
}

.sgg-item.sgg-hidden {
	display: none;
}

/* --- Barra de filtro por categorias ------------------------------------ */

.sgg-filter-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px;
}

.sgg-filter-btn {
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 20px;
	padding: 6px 16px;
	font-size: 13px;
	color: #333;
	cursor: pointer;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.sgg-filter-btn:hover {
	background: #e2e2e2;
}

.sgg-filter-btn.is-active {
	background: #222;
	border-color: #222;
	color: #fff;
}

/* --- Layout: grilla uniforme ------------------------------------------- */

.sgg-layout-grid {
	grid-template-columns: repeat(var(--sgg-cols, 4), 1fr);
}

.sgg-layout-grid .sgg-item {
	aspect-ratio: 1 / 1;
}

/* --- Layout: creativo (mosaico tipo Modula) ----------------------------- */

.sgg-layout-creative {
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	grid-auto-rows: 160px;
	grid-auto-flow: dense;
}

.sgg-layout-creative .sgg-item {
	grid-column: span 1;
	grid-row: span 1;
}

.sgg-layout-creative .sgg-size-wide {
	grid-column: span 2;
}

.sgg-layout-creative .sgg-size-tall {
	grid-row: span 2;
}

.sgg-layout-creative .sgg-size-big {
	grid-column: span 2;
	grid-row: span 2;
}

/* En mobile, el mosaico creativo se simplifica a 2 columnas uniformes
   para que ninguna foto quede demasiado chica o deformada. */
@media (max-width: 600px) {
	.sgg-layout-creative {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: 140px;
	}
	.sgg-layout-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.sgg-lightbox-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .9);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease;
	padding: 20px;
	box-sizing: border-box;
}

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

.sgg-lightbox-figure {
	position: relative;
	max-width: 92vw;
	max-height: 86vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.sgg-lightbox-figure img {
	max-width: 92vw;
	max-height: 80vh;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.sgg-lightbox-caption {
	margin-top: 12px;
	color: #f0f0f0;
	font-size: 14px;
	text-align: center;
	max-width: 92vw;
}

.sgg-lightbox-close,
.sgg-lightbox-prev,
.sgg-lightbox-next {
	position: fixed;
	background: rgba(255, 255, 255, .08);
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background .15s ease;
}

.sgg-lightbox-close:hover,
.sgg-lightbox-prev:hover,
.sgg-lightbox-next:hover {
	background: rgba(255, 255, 255, .22);
}

.sgg-lightbox-close {
	top: 18px;
	right: 18px;
	width: 42px;
	height: 42px;
	font-size: 22px;
	line-height: 1;
}

.sgg-lightbox-prev,
.sgg-lightbox-next {
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	font-size: 26px;
}

.sgg-lightbox-prev {
	left: 18px;
}

.sgg-lightbox-next {
	right: 18px;
}

.sgg-lightbox-counter {
	position: fixed;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	color: #ddd;
	font-size: 13px;
	background: rgba(0, 0, 0, .4);
	padding: 4px 10px;
	border-radius: 20px;
}

@media (max-width: 600px) {
	.sgg-lightbox-prev,
	.sgg-lightbox-next {
		width: 42px;
		height: 42px;
		font-size: 20px;
	}
	.sgg-lightbox-close {
		width: 36px;
		height: 36px;
		font-size: 18px;
		top: 10px;
		right: 10px;
	}
	.sgg-lightbox-prev {
		left: 6px;
	}
	.sgg-lightbox-next {
		right: 6px;
	}
}

body.sgg-lightbox-active {
	overflow: hidden;
}
