/**
 * Spartan Gallery – shared front-end styles.
 * Hexagon and the Swiper layouts (3D slider, carousel, slideshow) have
 * their own stylesheets on top of this one.
 *
 * The wrapper sets --sg-gap and --sg-radius from the gallery settings.
 */

.spartan-gallery-wrapper {
	position: relative;
	box-sizing: border-box;
}

.sg-gallery *,
.sg-gallery *::before,
.sg-gallery *::after {
	box-sizing: border-box;
}

.sg-gallery .sg-link {
	position: relative;
	display: block;
	overflow: hidden;
	line-height: 0;
	border-radius: var(--sg-radius, 0);
}

.sg-gallery a.sg-link {
	cursor: zoom-in;
}

.sg-gallery .sg-img {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	margin: 0;
	transition: transform 0.35s ease, opacity 0.35s ease, filter 0.35s ease;
}

.sg-gallery a.sg-link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ---------- Hover effects (sg-hover-*) ---------- */

.sg-hover-zoom .sg-link:hover .sg-img,
.sg-hover-zoom .sg-link:focus-visible .sg-img {
	transform: scale(1.05);
}

.sg-hover-fade .sg-link:hover .sg-img,
.sg-hover-fade .sg-link:focus-visible .sg-img {
	opacity: 0.75;
}

.sg-hover-darken .sg-link::after,
.sg-hover-title .sg-link::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.sg-hover-darken .sg-link:hover::after,
.sg-hover-darken .sg-link:focus-visible::after,
.sg-hover-title .sg-link:hover::after,
.sg-hover-title .sg-link:focus-visible::after {
	opacity: 1;
}

.sg-gallery .sg-caption {
	position: absolute;
	z-index: 1;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 12px 14px;
	color: #fff;
	font-size: 15px;
	line-height: 1.35;
	text-align: left;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.sg-hover-title .sg-link:hover .sg-caption,
.sg-hover-title .sg-link:focus-visible .sg-caption {
	opacity: 1;
	transform: none;
}

/* Touch screens have no hover: keep titles visible on a soft gradient. */
@media (hover: none) {
	.sg-hover-title .sg-caption {
		opacity: 1;
		transform: none;
		background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
	}
}

@media (prefers-reduced-motion: reduce) {
	.sg-gallery .sg-img,
	.sg-gallery .sg-caption {
		transition: none;
	}
	.sg-hover-zoom .sg-link:hover .sg-img,
	.sg-hover-zoom .sg-link:focus-visible .sg-img {
		transform: none;
	}
}

/* ---------- Columns: sg-cols-N, max 3 on tablets, 2 on phones ---------- */

.sg-gallery .sg-cols-1 { --sg-cols: 1; }
.sg-gallery .sg-cols-2 { --sg-cols: 2; }
.sg-gallery .sg-cols-3 { --sg-cols: 3; }
.sg-gallery .sg-cols-4 { --sg-cols: 4; }
.sg-gallery .sg-cols-5 { --sg-cols: 5; }
.sg-gallery .sg-cols-6 { --sg-cols: 6; }

@media (max-width: 900px) {
	.sg-gallery .sg-cols-4,
	.sg-gallery .sg-cols-5,
	.sg-gallery .sg-cols-6 { --sg-cols: 3; }
}

@media (max-width: 600px) {
	.sg-gallery .sg-cols-3,
	.sg-gallery .sg-cols-4,
	.sg-gallery .sg-cols-5,
	.sg-gallery .sg-cols-6 { --sg-cols: 2; }
	.sg-gallery .sg-compare-list { --sg-cols: 1; }
}

/* ---------- Grid ---------- */

.sg-grid {
	display: grid;
	grid-template-columns: repeat(var(--sg-cols, 3), minmax(0, 1fr));
	gap: var(--sg-gap, 10px);
}

.sg-grid .sg-link {
	aspect-ratio: var(--sg-ratio, 1 / 1);
}

.sg-grid .sg-img {
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.sg-grid--natural {
	align-items: start;
}

.sg-grid--natural .sg-link {
	aspect-ratio: auto;
}

.sg-grid--natural .sg-img {
	height: auto;
}

/* ---------- Masonry ---------- */

.sg-masonry .sg-masonry-sizer,
.sg-masonry .sg-item {
	width: calc((100% - (var(--sg-cols, 3) - 1) * var(--sg-gap, 10px)) / var(--sg-cols, 3));
}

.sg-masonry .sg-item {
	margin-bottom: var(--sg-gap, 10px);
}

/* Before Masonry runs (or if JS is off) fall back to a simple wrapped row. */
.sg-masonry:not(.is-ready) {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	column-gap: var(--sg-gap, 10px);
}

.sg-masonry:not(.is-ready) .sg-masonry-sizer {
	display: none;
}

/* ---------- Justified ---------- */

/*
 * Each item grows in proportion to its aspect ratio, so every item in a row
 * ends up the same height while the row fills the full width. The ::after
 * spacer soaks up the leftover space on the last row so it isn't stretched.
 */
.sg-justified {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sg-gap, 10px);
	--sg-row: var(--sg-row-h, 240px);
}

.sg-justified::after {
	content: "";
	flex-grow: 999999;
}

.sg-justified .sg-item {
	flex-grow: calc(var(--sg-ar, 1) * 100);
	flex-basis: calc(var(--sg-ar, 1) * var(--sg-row));
	min-width: 0;
}

.sg-justified .sg-link {
	aspect-ratio: var(--sg-ar, 1);
}

.sg-justified .sg-img {
	height: 100%;
	object-fit: cover;
	object-position: center;
}

@media (max-width: 600px) {
	.sg-justified {
		--sg-row: calc(var(--sg-row-h, 240px) * 0.6);
	}
}

/* ---------- Mosaic ---------- */

/*
 * Square cells; every 1st and 6th image of each group of 7 spans 2x2.
 * grid-auto-flow: dense backfills any holes the big tiles leave.
 */
.sg-mosaic {
	display: grid;
	grid-template-columns: repeat(var(--sg-cols, 4), minmax(0, 1fr));
	grid-auto-flow: dense;
	gap: var(--sg-gap, 10px);
}

.sg-mosaic .sg-item {
	aspect-ratio: 1 / 1;
}

.sg-mosaic .sg-item:nth-child(7n+1),
.sg-mosaic .sg-item:nth-child(7n+6) {
	grid-column: span 2;
	grid-row: span 2;
	aspect-ratio: auto;
}

.sg-mosaic .sg-link {
	height: 100%;
}

.sg-mosaic .sg-img {
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* ---------- Polaroid ---------- */

.sg-polaroid {
	display: grid;
	grid-template-columns: repeat(var(--sg-cols, 4), minmax(0, 1fr));
	gap: calc(var(--sg-gap, 10px) + 16px);
	padding: 16px 8px;
}

.sg-polaroid .sg-item {
	padding: 10px 10px 42px;
	background: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	transform: rotate(-2.5deg);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sg-polaroid .sg-item:nth-child(4n+2) { transform: rotate(2deg); }
.sg-polaroid .sg-item:nth-child(4n+3) { transform: rotate(-1deg); }
.sg-polaroid .sg-item:nth-child(4n+4) { transform: rotate(3deg); }

.sg-polaroid .sg-item:hover,
.sg-polaroid .sg-item:focus-within {
	z-index: 2;
	transform: rotate(0) scale(1.04);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.sg-polaroid .sg-link {
	aspect-ratio: 1 / 1;
	border-radius: 0;
}

.sg-polaroid .sg-img {
	height: 100%;
	object-fit: cover;
	object-position: center;
}

@media (prefers-reduced-motion: reduce) {
	.sg-polaroid .sg-item {
		transition: none;
	}
}

/* ---------- Before / after ---------- */

.sg-compare-list {
	display: grid;
	grid-template-columns: repeat(var(--sg-cols, 1), minmax(0, 1fr));
	gap: var(--sg-gap, 10px);
}

.sg-compare {
	position: relative;
	overflow: hidden;
	line-height: 0;
	border-radius: var(--sg-radius, 0);
	user-select: none;
	touch-action: pan-y;
}

.sg-compare .sg-img,
.sg-compare-before {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.sg-compare .sg-img {
	object-fit: cover;
	object-position: center;
}

.sg-compare-before {
	clip-path: inset(0 calc(100% - var(--sg-pos, 50%)) 0 0);
}

.sg-compare--single .sg-img {
	position: static;
	height: auto;
}

.sg-compare-handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--sg-pos, 50%);
	width: 3px;
	margin-left: -1.5px;
	background: #fff;
	box-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
	pointer-events: none;
}

.sg-compare-handle::after {
	content: "\2194";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border-radius: 50%;
	background: #fff;
	color: #333;
	font-size: 20px;
	line-height: 40px;
	text-align: center;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.sg-compare-range {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: ew-resize;
	-webkit-appearance: none;
	appearance: none;
}

.sg-compare:focus-within .sg-compare-handle::after {
	outline: 2px solid #2271b1;
}

.sg-compare-label {
	position: absolute;
	top: 12px;
	padding: 4px 10px;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 13px;
	line-height: 1.4;
	pointer-events: none;
}

.sg-compare-label--before { left: 12px; }
.sg-compare-label--after { right: 12px; }

/* ---------- Lightbox extras (thumbnails, download, slideshow) ---------- */

.sg-lb-has-thumbs .glightbox-container .gcontainer {
	height: calc(100% - 84px);
}

/*
 * Leave room for the thumbnail strip (GLightbox sizes images against the
 * viewport). Slides with a title/caption are sized in JS, see fitThumbSpace().
 */
@media (min-width: 769px) {
	.sg-lb-has-thumbs .glightbox-container .gslide-image img {
		max-height: calc(97vh - 84px);
	}
}

.sg-lb-thumbs {
	position: fixed;
	z-index: 999999;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	gap: 6px;
	justify-content: safe center;
	padding: 10px 12px;
	overflow-x: auto;
	background: rgba(0, 0, 0, 0.6);
	scrollbar-width: thin;
}

.sg-lb-thumbs button {
	flex: 0 0 auto;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 3px;
	background: #222 center / cover no-repeat;
	opacity: 0.55;
	cursor: pointer;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.sg-lb-thumbs button:hover,
.sg-lb-thumbs button:focus-visible {
	opacity: 0.9;
}

.sg-lb-thumbs button.is-active {
	border-color: #fff;
	opacity: 1;
}

.sg-lb-tools {
	position: fixed;
	z-index: 999999;
	top: 14px;
	left: 14px;
	display: flex;
	gap: 8px;
}

.sg-lb-tools a,
.sg-lb-tools button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 18px;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
}

.sg-lb-tools a:hover,
.sg-lb-tools button:hover,
.sg-lb-tools a:focus-visible,
.sg-lb-tools button:focus-visible {
	background: rgba(0, 0, 0, 0.85);
}

.sg-lb-tools svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

/* ---------- Filtering + load more ---------- */

/* Lightbox-only entries (album covers' remaining images). */
.sg-gallery a[hidden] {
	display: none !important;
}

.sg-gallery .sg-filtered-out,
.sg-gallery .sg-paged-out {
	display: none !important;
}

.sg-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0 0 calc(var(--sg-gap, 10px) + 8px);
}

.sg-gallery .sg-filter {
	margin: 0;
	padding: 7px 16px;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 14px;
	line-height: 1.3;
	opacity: 0.7;
	cursor: pointer;
	transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.sg-gallery .sg-filter:hover,
.sg-gallery .sg-filter:focus-visible {
	opacity: 1;
}

.sg-gallery .sg-filter.is-active {
	opacity: 1;
	background: #1d2327;
	border-color: #1d2327;
	color: #fff;
}

.sg-more-wrap {
	margin-top: calc(var(--sg-gap, 10px) + 12px);
	text-align: center;
}

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

.sg-gallery .sg-more {
	margin: 0;
	padding: 10px 28px;
	border: 0;
	border-radius: 4px;
	background: #1d2327;
	color: #fff;
	font: inherit;
	font-size: 15px;
	line-height: 1.3;
	cursor: pointer;
}

.sg-gallery .sg-more:hover,
.sg-gallery .sg-more:focus-visible {
	background: #3c434a;
}

/* ---------- Album ---------- */

.sg-album {
	display: grid;
	grid-template-columns: repeat(var(--sg-cols, 3), minmax(0, 1fr));
	gap: 24px;
}

.sg-album-card .sg-link {
	aspect-ratio: 4 / 3;
	border-radius: 6px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.sg-album-card .sg-img {
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.sg-album-meta {
	position: absolute;
	z-index: 1;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 36px 16px 14px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
	color: #fff;
	line-height: 1.3;
	text-align: left;
	pointer-events: none;
}

.sg-album-title {
	font-size: 18px;
	font-weight: 600;
}

.sg-album-count {
	font-size: 13px;
	opacity: 0.85;
}

/* ---------- Metro ---------- */

/*
 * Square cells sized from the container width (container query units), so
 * big/wide/tall tiles line up exactly. Every 10 tiles: 1st is 2x2, 4th and
 * 9th are wide (2x1), 6th is tall (1x2).
 */
.sg-metro-wrap {
	container-type: inline-size;
}

.sg-metro {
	--sg-cell: calc((100cqw - (var(--sg-cols, 4) - 1) * var(--sg-gap, 10px)) / var(--sg-cols, 4));
	display: grid;
	grid-template-columns: repeat(var(--sg-cols, 4), minmax(0, 1fr));
	grid-auto-rows: var(--sg-cell);
	grid-auto-flow: dense;
	gap: var(--sg-gap, 10px);
}

.sg-metro .sg-item:nth-child(10n+1) { grid-column: span 2; grid-row: span 2; }
.sg-metro .sg-item:nth-child(10n+4),
.sg-metro .sg-item:nth-child(10n+9) { grid-column: span 2; }
.sg-metro .sg-item:nth-child(10n+6) { grid-row: span 2; }

.sg-metro .sg-link {
	height: 100%;
}

.sg-metro .sg-img {
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* ---------- Film strip ---------- */

.sg-filmstrip {
	position: relative;
	--sg-row: var(--sg-row-h, 240px);
}

.sg-strip-track {
	display: flex;
	gap: var(--sg-gap, 10px);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
	padding-bottom: 6px;
}

.sg-strip-track:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

.sg-strip-track .sg-item {
	flex: 0 0 auto;
	height: var(--sg-row);
	width: calc(var(--sg-row) * var(--sg-ar, 1.5));
	scroll-snap-align: start;
}

.sg-strip-track .sg-link {
	height: 100%;
}

.sg-strip-track .sg-img {
	height: 100%;
	object-fit: cover;
}

.sg-gallery .sg-strip-btn {
	position: absolute;
	z-index: 2;
	top: calc(50% - 3px);
	width: 44px;
	height: 44px;
	margin: -22px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	color: #1d2327;
	font-size: 30px;
	line-height: 40px;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease;
}

.sg-strip-prev { left: 10px; }
.sg-strip-next { right: 10px; }

.sg-filmstrip.is-scrollable .sg-strip-btn:not(:disabled) {
	opacity: 1;
	visibility: visible;
}

@media (hover: none) {
	.sg-gallery .sg-strip-btn {
		display: none;
	}
}

@media (max-width: 600px) {
	.sg-filmstrip {
		--sg-row: calc(var(--sg-row-h, 240px) * 0.7);
	}
}

/* ---------- Spotlight ---------- */

.sg-spotlight {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: var(--sg-gap, 10px);
}

.sg-spotlight-main .sg-link {
	aspect-ratio: var(--sg-ratio, 4 / 3);
}

.sg-spotlight-main .sg-img {
	height: 100%;
	object-fit: cover;
}

.sg-spotlight-thumbs {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	align-content: start;
	/* As tall as the main image (height 0 so it doesn't add to the row), scrolls if longer. */
	height: 0;
	min-height: 100%;
	overflow-y: auto;
}

.sg-gallery .sg-spotlight-thumb {
	display: block;
	aspect-ratio: 1 / 1;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: calc(var(--sg-radius, 0px) / 2);
	background: none;
	opacity: 0.6;
	cursor: pointer;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.sg-gallery .sg-spotlight-thumb:hover,
.sg-gallery .sg-spotlight-thumb:focus-visible {
	opacity: 0.9;
}

.sg-gallery .sg-spotlight-thumb.is-active {
	border-color: currentColor;
	opacity: 1;
}

.sg-spotlight-thumb .sg-img {
	height: 100%;
	object-fit: cover;
}

@media (max-width: 900px) {
	.sg-spotlight {
		grid-template-columns: 1fr;
	}
	.sg-spotlight-thumbs {
		grid-template-columns: repeat(6, minmax(0, 1fr));
		height: auto;
		min-height: 0;
	}
}

@media (max-width: 600px) {
	.sg-spotlight-thumbs {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* ---------- Video tiles ---------- */

.sg-gallery .sg-has-video::before {
	content: "";
	position: absolute;
	z-index: 2;
	top: 50%;
	left: 50%;
	width: 58px;
	height: 58px;
	margin: -29px 0 0 -29px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M8 5v14l11-7z'/%3E%3C/svg%3E") 55% 50% / 26px no-repeat;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	pointer-events: none;
	transition: transform 0.2s ease;
}

.sg-gallery .sg-has-video:hover::before {
	transform: scale(1.08);
}

/* ---------- Watermark + protection ---------- */

.sg-gallery .sg-watermark {
	position: absolute;
	z-index: 2;
	right: 10px;
	bottom: 8px;
	color: rgba(255, 255, 255, 0.8);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	pointer-events: none;
	user-select: none;
}

.sg-protect img {
	-webkit-user-drag: none;
	user-select: none;
	-webkit-touch-callout: none;
}

.sg-lb-protect .glightbox-container img {
	-webkit-user-drag: none;
	user-select: none;
	-webkit-touch-callout: none;
}

.sg-lb-watermark {
	position: fixed;
	z-index: 999999;
	right: 24px;
	bottom: 24px;
	color: rgba(255, 255, 255, 0.75);
	font-size: 18px;
	font-weight: 600;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
	pointer-events: none;
	user-select: none;
}

.sg-lb-has-thumbs .sg-lb-watermark {
	bottom: 100px;
}

/* ---------- Lightbox share menu ---------- */

.sg-lb-share {
	position: relative;
}

.sg-lb-share-menu {
	position: absolute;
	top: 44px;
	left: 0;
	min-width: 160px;
	padding: 6px 0;
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.sg-lb-share-menu[hidden] {
	display: none;
}

.sg-lb-tools .sg-lb-share-menu a,
.sg-lb-tools .sg-lb-share-menu button {
	display: block;
	width: 100%;
	height: auto;
	padding: 8px 14px;
	border-radius: 0;
	background: none;
	color: #1d2327;
	font-size: 14px;
	line-height: 1.3;
	text-align: left;
}

.sg-lb-tools .sg-lb-share-menu a:hover,
.sg-lb-tools .sg-lb-share-menu button:hover,
.sg-lb-tools .sg-lb-share-menu a:focus-visible,
.sg-lb-tools .sg-lb-share-menu button:focus-visible {
	background: #f0f0f1;
}

.sg-lb-tools a[hidden] {
	display: none;
}
