.sg-grid,
.sg-viewer,
.sg-lightbox {
	--sg-accent: #006c73;
	--sg-highlight: #f5eeb1;
	--sg-border: #dbdbdb;
	--sg-text: #616161;
	--sg-muted: #86929e;
	--sg-button: #a2a2a2;
	--sg-button-border: #c2c2c2;
	--sg-surface: #fff;
	--sg-radius: 3px;
	--sg-gap: 20px;
	--sg-font-ui: inherit;
}

.sg-icon {
	display: inline-block;
	flex: none;
	vertical-align: middle;
}

.sg-button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: 2px solid var(--sg-button-border);
	border-radius: var(--sg-radius);
	color: var(--sg-button);
	font-family: var(--sg-font-ui);
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.sg-button:hover,
.sg-button:focus-visible {
	color: #737373;
	border-color: #8a8a8a;
}

.sg-button--light {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.5);
}

/* Grid */

.sg-grid {
	display: grid;
	grid-template-columns: repeat(var(--sg-columns, 4), minmax(0, 1fr));
	gap: var(--sg-gap);
	margin: 0 0 32px;
}

.sg-grid--cols-1 { --sg-columns: 1; }
.sg-grid--cols-2 { --sg-columns: 2; }
.sg-grid--cols-3 { --sg-columns: 3; }
.sg-grid--cols-4 { --sg-columns: 4; }

@media (max-width: 959px) {
	.sg-grid--cols-3,
	.sg-grid--cols-4 { --sg-columns: 2; }
}

@media (max-width: 599px) {
	.sg-grid { --sg-columns: 1; }
}

/* Card */

.sg-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	border-radius: var(--sg-radius);
	box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.sg-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.sg-card__thumb {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--sg-radius) var(--sg-radius) 0 0;
	background: #eee;
}

.sg-card__thumb img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.5s ease;
}

.sg-card:hover .sg-card__thumb img {
	transform: scale(1.04);
}

.sg-card__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(54, 63, 72, 0.8);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.sg-card:hover .sg-card__overlay,
.sg-card:focus-within .sg-card__overlay {
	opacity: 1;
}

.sg-card:hover .sg-card__overlay .sg-button {
	border-color: #efe8ae;
	color: var(--sg-highlight);
}

.sg-card__body {
	flex: 1;
	padding: 22px 20px;
	background: var(--sg-surface);
	border: 1px solid var(--sg-border);
	border-radius: 0 0 var(--sg-radius) var(--sg-radius);
}

.sg-card__thumb + .sg-card__body {
	border-top: 0;
}

.sg-card__meta {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	line-height: 1.3;
}

.sg-card__title {
	color: var(--sg-text);
	font-style: italic;
	font-weight: 400;
	text-decoration: none;
}

.sg-card__title::after {
	content: "";
	position: absolute;
	inset: 0;
}

.sg-card__title:hover,
.sg-card__title:focus-visible {
	color: var(--sg-accent);
}

.sg-card__count {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: none;
	color: var(--sg-muted);
	font-weight: 700;
}

.sg-card__excerpt {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px dashed #c7c7c7;
	text-align: center;
}

.sg-card__excerpt p:last-child {
	margin-bottom: 0;
}

.sg-card__more {
	position: relative;
	z-index: 1;
	margin-top: 20px;
	text-align: center;
}

/* Single gallery viewer */

.sg-viewer {
	margin-bottom: 32px;
}

.sg-viewer__stage {
	position: relative;
	background: var(--sg-surface);
	border: 1px solid var(--sg-border);
	border-radius: var(--sg-radius);
	overflow: hidden;
}

.sg-viewer__slides {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
}

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

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

.sg-viewer__slide {
	position: relative;
	flex: 0 0 100%;
	margin: 0;
	scroll-snap-align: center;
	scroll-snap-stop: always;
}

.sg-viewer__zoom {
	display: flex;
	align-items: center;
	justify-content: center;
	height: clamp(260px, 62vh, 680px);
	cursor: zoom-in;
}

.sg-viewer__zoom img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.sg-viewer__caption {
	position: absolute;
	left: 0;
	bottom: 20px;
	max-width: calc(100% - 40px);
	margin: 0;
	padding: 16px 16px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 18px;
	font-weight: 300;
	line-height: 1.2;
}

.sg-viewer__nav {
	position: absolute;
	top: 50%;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	margin-top: -24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #3e3e3e;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	opacity: 0.85;
	transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.sg-viewer__nav .sg-icon {
	width: 22px;
	height: 22px;
}

.sg-viewer__nav:hover,
.sg-viewer__nav:focus-visible {
	opacity: 1;
	color: var(--sg-accent);
	transform: scale(1.06);
}

.sg-viewer__nav--prev { left: 16px; }
.sg-viewer__nav--next { right: 16px; }

.sg-viewer__counter {
	position: absolute;
	top: 16px;
	right: 16px;
	margin: 0;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.5;
}

.sg-viewer__thumbs {
	display: flex;
	gap: 8px;
	margin: 12px 0 0;
	padding: 4px 2px 8px;
	list-style: none;
	overflow-x: auto;
	scrollbar-width: thin;
}

.sg-viewer__thumbs li {
	flex: none;
	margin: 0;
}

.sg-viewer__thumb {
	display: block;
	width: 80px;
	height: 80px;
	padding: 4px;
	border: 1px solid var(--sg-border);
	border-radius: var(--sg-radius);
	background: var(--sg-surface);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sg-viewer__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 2px;
	opacity: 0.7;
	transition: opacity 0.2s ease;
}

.sg-viewer__thumb:hover img,
.sg-viewer__thumb.is-active img {
	opacity: 1;
}

.sg-viewer__thumb.is-active {
	border-color: var(--sg-accent);
	box-shadow: 0 0 0 1px var(--sg-accent);
}

@media (max-width: 767px) {
	.sg-viewer__zoom {
		height: clamp(220px, 55vh, 480px);
	}

	.sg-viewer__nav {
		width: 40px;
		height: 40px;
		margin-top: -20px;
	}

	.sg-viewer__nav--prev { left: 8px; }
	.sg-viewer__nav--next { right: 8px; }

	.sg-viewer__caption {
		bottom: 0;
		max-width: 100%;
		font-size: 15px;
		padding: 12px;
	}

	.sg-viewer__thumb {
		width: 64px;
		height: 64px;
	}
}

/* Lightbox */

html.sg-lightbox-open {
	overflow: hidden;
}

.sg-lightbox {
	width: 100vw;
	max-width: 100vw;
	height: 100dvh;
	max-height: 100dvh;
	margin: 0;
	padding: 0;
	border: 0;
	background: #fff;
	color: #3e3e3e;
}

.sg-lightbox::backdrop {
	background: #fff;
}

.sg-lightbox[open] {
	display: flex;
	align-items: center;
	justify-content: center;
	animation: sg-fade 0.2s ease;
}

.sg-lightbox__figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 64px 80px;
	box-sizing: border-box;
}

.sg-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	min-height: 0;
	object-fit: contain;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.sg-lightbox__caption {
	flex: none;
	font-size: 15px;
	text-align: center;
}

.sg-lightbox__counter {
	position: absolute;
	top: 22px;
	left: 24px;
	margin: 0;
	font-size: 13px;
	font-weight: 700;
	color: #737373;
}

.sg-lightbox__close,
.sg-lightbox__nav {
	position: absolute;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #3e3e3e;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.sg-lightbox__close:hover,
.sg-lightbox__close:focus-visible,
.sg-lightbox__nav:hover,
.sg-lightbox__nav:focus-visible {
	background: #f1f1f1;
	color: var(--sg-accent);
}

.sg-lightbox__close {
	top: 10px;
	right: 12px;
}

.sg-lightbox__nav {
	top: 50%;
	margin-top: -24px;
}

.sg-lightbox__nav--prev { left: 16px; }
.sg-lightbox__nav--next { right: 16px; }

@media (max-width: 767px) {
	.sg-lightbox__figure {
		padding: 64px 12px 72px;
	}

	.sg-lightbox__nav {
		top: auto;
		bottom: 12px;
		margin-top: 0;
	}

	.sg-lightbox__nav--prev { left: calc(50% - 56px); }
	.sg-lightbox__nav--next { right: calc(50% - 56px); }
}

@keyframes sg-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.sg-card,
	.sg-card__thumb img,
	.sg-lightbox[open] {
		transition: none;
		animation: none;
	}

	.sg-card:hover,
	.sg-card:hover .sg-card__thumb img {
		transform: none;
	}
}

.sg-grid .screen-reader-text,
.sg-viewer .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
