/**
 * Facility gallery — dense mixed-size tile grid + lightbox.
 */

.sg-gallery { width: 100%; }

/* ------------------------------------------------------------- filters */

.sg-gallery__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 28px;
}

.sg-gallery__filter {
	font-family: var(--sg-font-body);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--sg-steel);
	background: transparent;
	border: 1px solid var(--sg-line);
	border-radius: 999px;
	padding: 9px 16px;
	cursor: pointer;
	transition: color .15s ease, border-color .15s ease, background-color .15s ease;
	min-height: 0;
}

.sg-gallery__filter:hover {
	color: var(--sg-ink);
	border-color: var(--sg-steel);
	background: transparent;
}

.sg-gallery__filter.is-active {
	color: #fff;
	background-color: var(--sg-red);
	border-color: var(--sg-red);
}

.sg-dark .sg-gallery__filter { color: rgba(255,255,255,.62); border-color: var(--sg-line-dark); }
.sg-dark .sg-gallery__filter:hover { color: #fff; border-color: rgba(255,255,255,.4); }

/* ---------------------------------------------------------------- grid */

.sg-gallery__grid {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	grid-auto-rows: 172px;
	grid-auto-flow: dense;
	gap: 12px;
}

.sg-tile {
	position: relative;
	overflow: hidden;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: var(--sg-radius);
	background-color: var(--sg-graphite);
	cursor: zoom-in;
	min-height: 0;
	display: block;
	/* grid children stretch, so the image can fill any span */
	grid-column: span 1;
	grid-row: span 1;
}

.sg-tile--c1 { grid-column: span 1; }
.sg-tile--c2 { grid-column: span 2; }
.sg-tile--c3 { grid-column: span 3; }
.sg-tile--r1 { grid-row: span 1; }
.sg-tile--r2 { grid-row: span 2; }
.sg-tile--r3 { grid-row: span 3; }

/* A <button> does not pass a percentage height to its child, so the image is
   positioned to fill the tile. The selector is weighted to beat Elementor's
   global `img { height: auto }`, which otherwise wins on load order. */
.sg-gallery .sg-gallery__grid .sg-tile img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	display: block;
	transition: transform .55s cubic-bezier(.2,.7,.3,1);
}

.sg-gallery .sg-gallery__grid .sg-tile:hover img { transform: scale(1.06); }

.sg-tile__veil {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(15,18,22,0) 45%, rgba(15,18,22,.82) 100%);
	opacity: 0;
	transition: opacity .3s ease;
}

.sg-tile:hover .sg-tile__veil { opacity: 1; }

.sg-tile__label {
	position: absolute;
	left: 14px;
	right: 14px;
	bottom: 12px;
	font-family: var(--sg-font-mono);
	font-size: 10.5px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: #fff;
	text-align: left;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .3s ease, transform .3s ease;
	pointer-events: none;
}

.sg-tile:hover .sg-tile__label { opacity: 1; transform: none; }

.sg-tile[hidden] { display: none; }

/* ---------------------------------------------------------- responsive */

@media (max-width: 1100px) {
	.sg-gallery__grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 158px; }
	.sg-tile--c3 { grid-column: span 2; }
	.sg-tile--r3 { grid-row: span 2; }
}

@media (max-width: 700px) {
	.sg-gallery__grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 132px; gap: 8px; }
	.sg-tile--c2, .sg-tile--c3 { grid-column: span 2; }
	.sg-tile--r3 { grid-row: span 2; }
	.sg-tile__label { display: none; }
}

/* ------------------------------------------------------------ lightbox */

.sg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: rgba(9, 11, 14, .94);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 72px;
}

.sg-lightbox[hidden] { display: none; }

.sg-lightbox__figure {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.sg-lightbox__figure img {
	max-width: 100%;
	max-height: calc(100vh - 140px);
	object-fit: contain;
	border-radius: var(--sg-radius);
	display: block;
}

.sg-lightbox__figure figcaption {
	font-family: var(--sg-font-mono);
	font-size: 11px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: rgba(255,255,255,.7);
	text-align: center;
}

.sg-lightbox__close,
.sg-lightbox__nav {
	position: absolute;
	background: rgba(255,255,255,.08);
	border: 1px solid rgba(255,255,255,.22);
	color: #fff;
	cursor: pointer;
	border-radius: 50%;
	width: 46px;
	height: 46px;
	min-height: 0;
	display: grid;
	place-items: center;
	font-size: 26px;
	line-height: 1;
	padding: 0;
	transition: background-color .15s ease;
}

.sg-lightbox__close:hover,
.sg-lightbox__nav:hover { background: rgba(255,255,255,.2); color: #fff; }

.sg-lightbox__close { top: 24px; right: 24px; font-size: 30px; }
.sg-lightbox__nav--prev { left: 20px; }
.sg-lightbox__nav--next { right: 20px; }

@media (max-width: 700px) {
	.sg-lightbox { padding: 20px 12px 64px; }
	.sg-lightbox__nav { bottom: 14px; top: auto; }
	.sg-lightbox__nav--prev { left: calc(50% - 56px); }
	.sg-lightbox__nav--next { right: calc(50% - 56px); }
}
