/* ==========================================================================
   Stupski Gallery — Masonry Grid + Lightbox
   ========================================================================== */

/* --- Grid ---------------------------------------------------------------- */

.stupski-gallery {
	--sg-gap: 8px;
	--sg-cols: 4;
	column-count: var(--sg-cols);
	column-gap: var(--sg-gap);
}

@media (max-width: 767px) {
	.stupski-gallery {
		--sg-cols: 2;
	}
}

.stupski-gallery__item {
	break-inside: avoid;
	margin: 0 0 var(--sg-gap);
	padding: 0;
}

.stupski-gallery__link {
	display: block;
	cursor: zoom-in;
	overflow: hidden;
	border-radius: 4px;
}

.stupski-gallery__img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.stupski-gallery__link:hover .stupski-gallery__img {
	transform: scale(1.03);
	opacity: 0.9;
}

/* --- Lightbox ------------------------------------------------------------ */

.sg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #e8fdfff0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	backdrop-filter: blur(14px);
}

.sg-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.sg-lightbox__inner {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.sg-lightbox__img {
	display: block;
	max-width: 90vw;
	max-height: 80vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 2px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.16);
	transition: opacity 0.2s ease;
}

.sg-lightbox__img.is-loading {
	opacity: 0;
}

.sg-lightbox__caption {
	margin-top: 12px;
	color: #1f3245 !important;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	max-width: 600px;
	min-height: 1.5em;
}

/* Buttons */

.sg-lightbox__btn {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(31, 50, 69, 0.08);
	border: none;
	border-radius: 50%;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #1f3245 !important;
	font-size: 22px;
	line-height: 1;
	transition: background 0.15s ease;
	z-index: 1;
	-webkit-tap-highlight-color: transparent;
}

.sg-lightbox__btn:hover {
	background: rgba(31, 50, 69, 0.18);
}

.sg-lightbox__btn--prev { left: 16px; }
.sg-lightbox__btn--next { right: 16px; }

.sg-lightbox__close {
	position: fixed;
	top: 16px;
	right: 16px;
	background: rgba(31, 50, 69, 0.08);
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #1f3245 !important;
	font-size: 20px;
	line-height: 1;
	transition: background 0.15s ease;
	z-index: 1;
	-webkit-tap-highlight-color: transparent;
}

.sg-lightbox__close:hover {
	background: rgba(31, 50, 69, 0.18);
}

.sg-lightbox__counter {
	position: fixed;
	top: 20px;
	left: 50%;
	transform: translateX(-50%);
	color: #1f3245 !important;
	opacity: 0.55;
	font-size: 13px;
	letter-spacing: 0.05em;
}

@media (max-width: 767px) {
	.sg-lightbox__btn {
		width: 40px;
		height: 40px;
		font-size: 18px;
	}
	.sg-lightbox__btn--prev { left: 8px; }
	.sg-lightbox__btn--next { right: 8px; }
}
