/**
 * SRBINSIDE Galerija — layout and lightbox.
 * Works with NextGEN Gallery's basic thumbnail markup.
 */

.srb-gallery-site {
	--srb-gallery-cols: 4;
	--srb-gallery-cols-tablet: 3;
	--srb-gallery-cols-mobile: 2;
	--srb-gallery-gap: 14px;
	--srb-gallery-radius: 4px;
	--srb-gallery-ratio: 3 / 2;
	--srb-gallery-fit: cover;
}

/* --------------------------------------------------------------------------
 * Grid
 * ----------------------------------------------------------------------- */
.srb-gallery-site .ngg-galleryoverview {
	display: grid !important;
	grid-template-columns: repeat(var(--srb-gallery-cols, 4), minmax(0, 1fr)) !important;
	gap: var(--srb-gallery-gap, 14px) !important;
	width: 100% !important;
	max-width: 100% !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: visible !important;
	clear: none !important;
}

.srb-gallery-site .ngg-galleryoverview br {
	display: none !important;
}

.srb-gallery-site .ngg-gallery-thumbnail-box {
	display: block !important;
	float: none !important;
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.srb-gallery-site .ngg-gallery-thumbnail {
	position: relative !important;
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	text-align: left !important;
}

.srb-gallery-site .ngg-gallery-thumbnail a {
	position: relative !important;
	display: block !important;
	width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	border: 0 !important;
	border-radius: var(--srb-gallery-radius, 4px) !important;
	background: #eef1f5 !important;
	box-shadow: none !important;
	text-decoration: none !important;
	aspect-ratio: var(--srb-gallery-ratio, 3 / 2) !important;
	cursor: zoom-in;
}

.srb-gallery-site .ngg-gallery-thumbnail a,
.srb-gallery-site .ngg-gallery-thumbnail a:hover,
.srb-gallery-site .ngg-gallery-thumbnail a:focus {
	border-bottom: 0 !important;
	text-decoration: none !important;
}

.srb-gallery-site .ngg-gallery-thumbnail img {
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	object-fit: var(--srb-gallery-fit, cover) !important;
	object-position: center 30% !important;
	transition: transform 450ms ease !important;
}

.srb-gallery-site .ngg-gallery-thumbnail span {
	display: block !important;
	margin: 8px 2px 0 !important;
	padding: 0 !important;
	color: #667085;
	font-family: inherit;
	font-size: 0.76rem !important;
	font-weight: 500;
	line-height: 1.4 !important;
	text-align: left;
}

.srb-gallery-site .ngg-gallery-thumbnail span:empty {
	display: none !important;
}

/* --------------------------------------------------------------------------
 * Captions
 * ----------------------------------------------------------------------- */
.srb-gallery-site.srb-gallery-captions-hidden .ngg-gallery-thumbnail span {
	display: none !important;
}

.srb-gallery-site.srb-gallery-captions-overlay .ngg-gallery-thumbnail span {
	position: absolute !important;
	right: 0 !important;
	bottom: 0 !important;
	left: 0 !important;
	z-index: 2 !important;
	display: -webkit-box !important;
	margin: 0 !important;
	padding: 2.4rem 0.9rem 0.8rem !important;
	overflow: hidden !important;
	background: linear-gradient(180deg, transparent 0%, rgba(4, 20, 37, 0.15) 28%, rgba(4, 20, 37, 0.88) 100%) !important;
	color: #fff !important;
	font-size: 0.72rem !important;
	font-weight: 500 !important;
	line-height: 1.35 !important;
	letter-spacing: 0.005em;
	text-align: left;
	pointer-events: none;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.srb-gallery-site.srb-gallery-captions-overlay .ngg-gallery-thumbnail span:empty {
	display: none !important;
}

/* --------------------------------------------------------------------------
 * Hover
 * ----------------------------------------------------------------------- */
.srb-gallery-site.srb-gallery-hover .ngg-gallery-thumbnail a:hover img,
.srb-gallery-site.srb-gallery-hover .ngg-gallery-thumbnail a:focus-visible img {
	transform: scale(1.045) !important;
}

.srb-gallery-site .ngg-gallery-thumbnail a:focus-visible {
	outline: 3px solid var(--srb-red, #c8102e);
	outline-offset: 3px;
}

/* --------------------------------------------------------------------------
 * Natural ratio
 * ----------------------------------------------------------------------- */
.srb-gallery-ratio-natural .ngg-gallery-thumbnail a {
	aspect-ratio: auto !important;
}

.srb-gallery-ratio-natural .ngg-gallery-thumbnail img {
	height: auto !important;
}

/* --------------------------------------------------------------------------
 * Masonry
 * ----------------------------------------------------------------------- */
.srb-gallery-layout-masonry .ngg-galleryoverview {
	display: block !important;
	columns: var(--srb-gallery-cols, 4) !important;
	column-gap: var(--srb-gallery-gap, 14px) !important;
}

.srb-gallery-layout-masonry .ngg-gallery-thumbnail-box {
	display: inline-block !important;
	width: 100% !important;
	margin: 0 0 var(--srb-gallery-gap, 14px) !important;
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
}

.srb-gallery-layout-masonry .ngg-gallery-thumbnail a {
	aspect-ratio: auto !important;
}

.srb-gallery-layout-masonry .ngg-gallery-thumbnail img {
	height: auto !important;
}

/* --------------------------------------------------------------------------
 * Mosaic
 * ----------------------------------------------------------------------- */
.srb-gallery-layout-mosaic .ngg-galleryoverview {
	grid-auto-rows: clamp(140px, 15vw, 240px);
	grid-auto-flow: dense;
}

.srb-gallery-layout-mosaic .ngg-gallery-thumbnail-box {
	height: 100%;
}

.srb-gallery-layout-mosaic .ngg-gallery-thumbnail-box:first-child {
	grid-column: span 2;
	grid-row: span 2;
}

.srb-gallery-layout-mosaic .ngg-gallery-thumbnail {
	display: flex !important;
	flex-direction: column;
	height: 100% !important;
}

.srb-gallery-layout-mosaic .ngg-gallery-thumbnail a {
	flex: 1 1 auto;
	min-height: 0;
	aspect-ratio: auto !important;
}

.srb-gallery-layout-mosaic .ngg-gallery-thumbnail img {
	height: 100% !important;
}

/* --------------------------------------------------------------------------
 * Wide gallery on pages
 * ----------------------------------------------------------------------- */
@media (min-width: 768px) {
	body.page.srb-gallery-width-wide .ngg-galleryoverview {
		width: min(calc(100vw - (var(--srb-gutter, 2rem) * 2)), var(--srb-container, 1240px)) !important;
		max-width: none !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		transform: none !important;
	}
}

/* --------------------------------------------------------------------------
 * Responsive columns
 * ----------------------------------------------------------------------- */
@media (max-width: 1023px) {
	.srb-gallery-site .ngg-galleryoverview {
		grid-template-columns: repeat(var(--srb-gallery-cols-tablet, 3), minmax(0, 1fr)) !important;
	}

	.srb-gallery-layout-masonry .ngg-galleryoverview {
		columns: var(--srb-gallery-cols-tablet, 3) !important;
	}

	.srb-gallery-layout-mosaic .ngg-gallery-thumbnail-box:first-child {
		grid-column: 1 / -1;
		grid-row: span 1;
	}
}

@media (max-width: 767px) {
	.srb-gallery-site .ngg-galleryoverview {
		grid-template-columns: repeat(var(--srb-gallery-cols-mobile, 2), minmax(0, 1fr)) !important;
	}

	.srb-gallery-layout-masonry .ngg-galleryoverview {
		columns: var(--srb-gallery-cols-mobile, 2) !important;
	}

	body.page.srb-gallery-width-wide .ngg-galleryoverview {
		width: 100% !important;
		margin-left: 0 !important;
		transform: none !important;
	}

	.srb-gallery-site.srb-gallery-captions-overlay .ngg-gallery-thumbnail span {
		padding: 1.8rem 0.7rem 0.65rem !important;
		font-size: 0.68rem !important;
	}
}

/* --------------------------------------------------------------------------
 * Lightbox
 * ----------------------------------------------------------------------- */
body.srb-lightbox-open {
	overflow: hidden;
}

.srb-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(1rem, 3vw, 2.5rem);
	background: rgba(4, 20, 37, 0.965);
	opacity: 0;
	visibility: hidden;
	transition: opacity 220ms ease, visibility 220ms ease;
}

.srb-lightbox[hidden] {
	display: none !important;
}

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

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

.srb-lightbox__image {
	display: block;
	width: auto;
	height: auto;
	max-width: min(1400px, 92vw);
	max-height: 78vh;
	object-fit: contain;
	border-radius: 4px;
	background: #061f3a;
	box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.srb-lightbox__footer {
	display: flex;
	align-items: baseline;
	gap: 1rem;
	max-width: min(1400px, 92vw);
	margin-top: 1rem;
	color: #fff;
	text-align: center;
}

.srb-lightbox__count {
	flex: 0 0 auto;
	color: rgba(255, 255, 255, 0.55);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.08em;
}

.srb-lightbox__caption {
	color: rgba(255, 255, 255, 0.9);
	font-family: "Playfair Display", Georgia, serif;
	font-size: clamp(0.95rem, 1.5vw, 1.2rem);
	font-style: italic;
	line-height: 1.4;
}

.srb-lightbox__caption[hidden] {
	display: none;
}

.srb-lightbox__button {
	position: absolute;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.38);
	border-radius: 50%;
	background: rgba(4, 20, 37, 0.42);
	color: #fff;
	cursor: pointer;
	backdrop-filter: blur(4px);
	transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.srb-lightbox__button:hover,
.srb-lightbox__button:focus {
	border-color: #fff;
	background: #fff;
	color: #082b50;
}

.srb-lightbox__button:focus-visible {
	outline: 3px solid #c8102e;
	outline-offset: 3px;
}

.srb-lightbox__button .srb-lightbox__icon {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.srb-lightbox__close {
	top: 1rem;
	right: 1rem;
}

.srb-lightbox__prev {
	top: 50%;
	left: 1rem;
	transform: translateY(-50%);
}

.srb-lightbox__next {
	top: 50%;
	right: 1rem;
	transform: translateY(-50%);
}

.srb-lightbox[data-single="true"] .srb-lightbox__prev,
.srb-lightbox[data-single="true"] .srb-lightbox__next {
	display: none;
}

.srb-lightbox__loading {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: srb-lightbox-spin 800ms linear infinite;
}

@keyframes srb-lightbox-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (max-width: 600px) {
	.srb-lightbox {
		padding: 3.5rem 0.75rem 1rem;
	}

	.srb-lightbox__image {
		max-width: 100%;
		max-height: 70vh;
	}

	.srb-lightbox__button {
		width: 44px;
		height: 44px;
	}

	.srb-lightbox__prev {
		left: 0.6rem;
	}

	.srb-lightbox__next {
		right: 0.6rem;
	}

	.srb-lightbox__footer {
		flex-direction: column;
		gap: 0.35rem;
		max-width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.srb-gallery-site .ngg-gallery-thumbnail img,
	.srb-lightbox,
	.srb-lightbox__button {
		transition: none !important;
	}

	.srb-lightbox__loading {
		animation: none;
	}
}
