/* Showcase Gallery - front end */

.sg {
	--sg-ratio: 16 / 9;
	--sg-fit: contain;
	--sg-thumb: 96px;
	--sg-accent: #2271b1;
	--sg-active-border: rgba(0, 0, 0, 0.25);
	max-width: 100%;
	margin: 1.5em 0;
}

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

.sg [hidden],
.sg-lb[hidden] {
	display: none !important;
}

/* ---------- Big preview ---------- */
.sg .sg-stage-btn {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--sg-ratio);
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	border-radius: 8px;
	background: transparent;
	box-shadow: none;
	color: inherit;
	line-height: 0;
	cursor: zoom-in;
	-webkit-appearance: none;
	appearance: none;
}

.sg .sg-stage-btn:hover,
.sg .sg-stage-btn:focus {
	background: transparent;
	box-shadow: none;
}

.sg .sg-stage-media {
	position: absolute;
	inset: 0;
	display: block;
	transition: opacity 0.2s ease;
}

.sg .sg-stage-media.is-loading {
	opacity: 0.35;
}

.sg img.sg-stage-img,
.sg video.sg-stage-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: var(--sg-fit);
	pointer-events: none;
}

/* Full-width layout: the preview spans the whole width and takes the image's own height. */
.sg.sg--full .sg-stage-btn {
	height: auto;
	aspect-ratio: auto;
}

.sg.sg--full .sg-stage-media {
	position: static;
	display: block;
}

.sg.sg--full img.sg-stage-img {
	width: 100%;
	height: auto;
	object-fit: fill;
}

.sg.sg--full video.sg-stage-img {
	width: 100%;
	height: auto;
	aspect-ratio: var(--sg-ratio);
	object-fit: contain;
}

.sg .sg-stage-caption {
	margin: 8px 0 0;
	font-size: 0.9em;
	line-height: 1.4;
	opacity: 0.8;
}

/* ---------- Thumbnails ---------- */
.sg .sg-thumbs-wrap {
	position: relative;
	margin: 10px 0 0;
}

/* A gallery with a single item shows just the big preview. */
.sg.sg--single .sg-thumbs-wrap {
	display: none;
}

.sg .sg-thumbs {
	position: relative;
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	list-style: none;
	cursor: grab;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
	-webkit-user-select: none;
	user-select: none;
}

.sg .sg-thumbs::-webkit-scrollbar {
	display: none;
}

.sg .sg-thumbs.is-dragging {
	cursor: grabbing;
}

.sg .sg-thumbs-btn {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.65);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	color: #fff;
	font: 400 24px/1 Arial, sans-serif;
	text-transform: none;
	cursor: pointer;
	transform: translateY(-50%);
	transition: opacity 0.15s ease, background 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.sg .sg-thumbs-btn:hover,
.sg .sg-thumbs-btn:focus {
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	outline: none;
}

.sg .sg-thumbs-btn:focus-visible {
	outline: 2px solid var(--sg-accent);
	outline-offset: 2px;
}

.sg .sg-thumbs-btn:disabled {
	opacity: 0;
	pointer-events: none;
}

.sg .sg-thumbs-prev {
	left: 6px;
}

.sg .sg-thumbs-next {
	right: 6px;
}

.sg .sg-thumbs li {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
}

.sg .sg-thumb {
	position: relative;
	display: block;
	width: calc(var(--sg-thumb) * 1.5);
	height: var(--sg-thumb);
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	box-shadow: none;
	color: inherit;
	line-height: 0;
	cursor: pointer;
	transition: border-color 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.sg .sg-thumb:hover,
.sg .sg-thumb:focus {
	background: transparent;
	box-shadow: none;
}

.sg .sg-thumb.is-active {
	border-color: var(--sg-active-border);
}

.sg .sg-thumb img,
.sg .sg-thumb video {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	pointer-events: none;
}

.sg .sg-stage-btn,
.sg .sg-thumb,
.sg .sg-thumbs-btn {
	-webkit-tap-highlight-color: transparent;
}

/* No outline when clicking or tapping... */
.sg .sg-stage-btn:focus,
.sg .sg-stage-btn:active,
.sg .sg-thumb:focus,
.sg .sg-thumb:active {
	outline: none;
}

/* ...but keep a ring for keyboard users. */
.sg .sg-stage-btn:focus-visible,
.sg .sg-thumb:focus-visible {
	outline: 2px solid var(--sg-accent);
	outline-offset: 2px;
}

/* ---------- Play badge (videos) ---------- */
.sg .sg-play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	border: 2px solid rgba(255, 255, 255, 0.9);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	pointer-events: none;
	transition: transform 0.15s ease;
}

.sg .sg-play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	margin: -11px 0 0 -6px;
	border-top: 11px solid transparent;
	border-bottom: 11px solid transparent;
	border-left: 18px solid #fff;
}

.sg .sg-stage-btn:hover .sg-play {
	transform: scale(1.08);
}

.sg .sg-thumb .sg-play {
	width: 30px;
	height: 30px;
	margin: -15px 0 0 -15px;
	border-width: 1.5px;
}

.sg .sg-thumb .sg-play::before {
	margin: -6px 0 0 -3px;
	border-top-width: 6px;
	border-bottom-width: 6px;
	border-left-width: 9px;
}

/* ---------- Lightbox ---------- */
/* Phones/tablets only: pin the page in place (JS sets body top to the scroll offset).
   On desktop the page and its scrollbar are left alone so nothing shifts. */
html.sg-lb-fixed {
	overflow: hidden;
}

html.sg-lb-fixed body {
	position: fixed;
	left: 0;
	right: 0;
	width: auto;
	overflow: hidden;
}

.sg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	overscroll-behavior: contain;
	color: #fff;
	opacity: 0;
	transition: opacity 0.2s ease;
}

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

.sg-lb.is-open {
	opacity: 1;
}

.sg-lb-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 12, 0.94);
}

.sg-lb-viewport {
	position: absolute;
	inset: 0;
	overflow: hidden;
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
}

.sg-lb-track {
	display: flex;
	height: 100%;
	transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
	will-change: transform;
}

.sg-lb-track.is-dragging {
	transition: none;
}

.sg-lb-slide {
	display: flex;
	flex: 0 0 100%;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 64px 72px 72px;
}

.sg-lb img.sg-lb-media {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
	border-radius: 4px;
	background: #000;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
	object-fit: contain;
}

.sg-lb video.sg-lb-media {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
	border-radius: 4px;
	background: #000;
	object-fit: contain;
}

.sg-lb .sg-lb-btn {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	box-shadow: none;
	color: #fff;
	font: 400 30px/1 Arial, sans-serif;
	text-transform: none;
	cursor: pointer;
	transition: background 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.sg-lb .sg-lb-btn:hover,
.sg-lb .sg-lb-btn:focus {
	background: rgba(255, 255, 255, 0.3);
	color: #fff;
	outline: none;
}

.sg-lb .sg-lb-media,
.sg-lb .sg-lb-slide,
.sg-lb .sg-lb-viewport,
.sg-lb .sg-lb-btn {
	-webkit-tap-highlight-color: transparent;
}

.sg-lb .sg-lb-media:focus,
.sg-lb .sg-lb-media:active,
.sg-lb .sg-lb-slide:focus,
.sg-lb .sg-lb-viewport:focus {
	outline: none;
}

.sg-lb .sg-lb-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sg-lb .sg-lb-close {
	top: 14px;
	right: 14px;
}

.sg-lb .sg-lb-prev,
.sg-lb .sg-lb-next {
	top: 50%;
	transform: translateY(-50%);
}

.sg-lb .sg-lb-prev {
	left: 14px;
}

.sg-lb .sg-lb-next {
	right: 14px;
}

.sg-lb.is-single .sg-lb-prev,
.sg-lb.is-single .sg-lb-next,
.sg-lb.is-single .sg-lb-count {
	display: none;
}

.sg-lb-bar {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 20px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
	font-size: 14px;
	line-height: 1.4;
	pointer-events: none;
}

.sg-lb-count {
	flex: 0 0 auto;
	margin-left: auto;
	opacity: 0.8;
}

@media (max-width: 600px) {
	.sg-lb-slide {
		padding: 60px 8px 64px;
	}

	.sg-lb .sg-lb-btn {
		width: 38px;
		height: 38px;
		font-size: 26px;
	}

	.sg-lb .sg-lb-prev {
		left: 6px;
	}

	.sg-lb .sg-lb-next {
		right: 6px;
	}

	.sg .sg-play {
		width: 52px;
		height: 52px;
		margin: -26px 0 0 -26px;
	}

	/* Phones: exactly 2 thumbnails visible at a time. */
	.sg .sg-thumbs {
		scroll-snap-type: x mandatory;
	}

	.sg .sg-thumbs li {
		flex: 0 0 calc((100% - 8px) / 2);
	}

	.sg .sg-thumb {
		width: 100%;
		height: auto;
		aspect-ratio: 3 / 2;
	}

	.sg .sg-thumb img,
	.sg .sg-thumb video {
		position: absolute;
		top: 0;
		left: 0;
		height: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sg-lb,
	.sg-lb-track,
	.sg .sg-stage-media,
	.sg .sg-play,
	.sg .sg-thumb {
		transition: none;
	}
}
