/* Speranta Gallery — front-end */
.sg-gallery {
	--sg-accent: #2a9d8f;
	--sg-cols: 3;
	--sg-gap: 14px;
	--sg-radius: 14px;
	--sg-ease: cubic-bezier(.22, .8, .24, 1);
	position: relative;
	margin: 0 auto 2em;
	width: 100%;
}
.sg-gallery *, .sg-gallery *::before, .sg-gallery *::after { box-sizing: border-box; }
.sg-gallery svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Filters ---------- */
.sg-filters {
	display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
	margin: 0 0 calc(var(--sg-gap) + 14px);
}
.sg-filter {
	appearance: none; -webkit-appearance: none;
	display: inline-flex; align-items: center; gap: 8px;
	padding: 10px 18px; margin: 0;
	font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; letter-spacing: .01em;
	color: #3a4a52; background: #fff;
	border: 1px solid rgba(0, 0, 0, .09); border-radius: 999px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
	cursor: pointer; text-transform: none;
	transition: color .25s, background .25s, border-color .25s, box-shadow .25s, transform .25s var(--sg-ease);
}
.sg-filter:hover { color: var(--sg-accent); border-color: var(--sg-accent); transform: translateY(-1px); background: #fff; }
.sg-filter:focus-visible { outline: 3px solid color-mix(in srgb, var(--sg-accent) 35%, transparent); outline-offset: 2px; }
.sg-filter.is-active {
	color: #fff; background: var(--sg-accent); border-color: var(--sg-accent);
	box-shadow: 0 6px 18px -6px var(--sg-accent);
}
.sg-badge {
	min-width: 22px; padding: 2px 7px; border-radius: 999px;
	font-size: 12px; font-weight: 700; text-align: center;
	background: rgba(0, 0, 0, .06); color: inherit;
	transition: background .25s;
}
.sg-filter.is-active .sg-badge { background: rgba(255, 255, 255, .25); }

/* ---------- Grid ---------- */
.sg-grid.sg-l-masonry { column-count: var(--sg-cols); column-gap: var(--sg-gap); }
.sg-grid.sg-l-masonry .sg-item { margin: 0 0 var(--sg-gap); break-inside: avoid; -webkit-column-break-inside: avoid; }
.sg-grid.sg-l-grid { display: grid; grid-template-columns: repeat(var(--sg-cols), minmax(0, 1fr)); gap: var(--sg-gap); }
.sg-grid.sg-l-grid .sg-item { aspect-ratio: 1 / 1; }

.sg-item {
	position: relative; display: block; width: 100%;
	overflow: hidden; border-radius: var(--sg-radius);
	background: linear-gradient(110deg, #eef1f2 30%, #f7f9f9 50%, #eef1f2 70%);
	background-size: 250% 100%;
	animation: sg-shimmer 1.6s linear infinite;
	box-shadow: 0 2px 6px rgba(20, 40, 50, .06);
	transform: translateZ(0);
	text-decoration: none !important; border: 0 !important;
	cursor: zoom-in;
	transition: box-shadow .45s var(--sg-ease), transform .45s var(--sg-ease);
}
.sg-item.is-loaded { animation: none; background: #eef1f2; }
.sg-item:hover { box-shadow: 0 18px 40px -14px rgba(20, 40, 50, .45); transform: translateY(-3px); }
.sg-item:focus-visible { outline: 3px solid var(--sg-accent); outline-offset: 3px; }
.sg-item .sg-img {
	display: block; width: 100% !important; height: 100% !important; max-width: none !important;
	object-fit: cover; margin: 0 !important; border-radius: 0 !important;
	opacity: 0; transform: scale(1.04);
	transition: opacity .6s ease, transform 1.1s var(--sg-ease), filter .6s;
}
.sg-item.is-loaded .sg-img { opacity: 1; transform: scale(1); }
.sg-item:hover .sg-img { transform: scale(1.07); }

.sg-ov {
	position: absolute; inset: 0; display: flex; align-items: flex-end;
	padding: 16px;
	background: linear-gradient(180deg, rgba(10, 25, 30, 0) 40%, rgba(10, 25, 30, .72) 100%);
	opacity: 0; transition: opacity .45s var(--sg-ease);
}
.sg-item:hover .sg-ov, .sg-item:focus-visible .sg-ov { opacity: 1; }
.sg-zoom {
	position: absolute; top: 50%; left: 50%;
	width: 52px; height: 52px; margin: -26px 0 0 -26px;
	display: grid; place-items: center;
	border-radius: 50%; color: #fff; font-size: 22px;
	background: rgba(255, 255, 255, .18);
	backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, .45);
	transform: scale(.6); opacity: 0;
	transition: transform .45s var(--sg-ease), opacity .35s;
}
.sg-item:hover .sg-zoom { transform: scale(1); opacity: 1; }
.sg-cap {
	position: relative; color: #fff; font-size: 14px; line-height: 1.35; font-weight: 500;
	text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
	transform: translateY(10px); transition: transform .45s var(--sg-ease);
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sg-item:hover .sg-cap { transform: translateY(0); }

/* entrance animation (only when JS is running) */
.sg-js .sg-item { opacity: 0; transform: translateY(26px) scale(.97); }
.sg-js .sg-item.sg-show {
	opacity: 1; transform: none;
	transition: opacity .7s var(--sg-ease), transform .7s var(--sg-ease), box-shadow .45s var(--sg-ease);
	transition-delay: var(--sg-d, 0ms);
}
.sg-js .sg-item.sg-show:hover { transform: translateY(-3px); transition-delay: 0ms; }
.sg-item.sg-hide { display: none !important; }

@keyframes sg-shimmer { to { background-position: -150% 0; } }

/* ---------- Load more ---------- */
.sg-more-wrap { text-align: center; margin-top: calc(var(--sg-gap) + 18px); }
.sg-more-wrap[hidden] { display: none; }
.sg-more {
	appearance: none; -webkit-appearance: none;
	display: inline-flex; align-items: center; gap: 10px;
	padding: 14px 28px; margin: 0;
	font: inherit; font-size: 15px; font-weight: 700; letter-spacing: .02em;
	color: var(--sg-accent); background: transparent;
	border: 2px solid var(--sg-accent); border-radius: 999px;
	cursor: pointer; text-transform: none;
	transition: background .3s, color .3s, transform .3s var(--sg-ease), box-shadow .3s;
}
.sg-more:hover { background: var(--sg-accent); color: #fff; transform: translateY(-2px); box-shadow: 0 10px 24px -10px var(--sg-accent); }
.sg-more svg { transition: transform .3s var(--sg-ease); }
.sg-more:hover svg { transform: translateY(3px); }

/* ---------- Album cards ---------- */
.sg-albums {
	display: grid; gap: calc(var(--sg-gap) + 16px);
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
	padding: 10px 6px 4px;
}
.sg-album {
	appearance: none; -webkit-appearance: none;
	position: relative; display: block; width: 100%;
	padding: 0; margin: 0; border: 0; background: none; font: inherit; text-align: left;
	cursor: pointer; text-transform: none;
}
.sg-album-stack, .sg-album-stack::before {
	position: absolute; inset: 0; border-radius: var(--sg-radius);
	background: #fff; box-shadow: 0 4px 14px rgba(20, 40, 50, .14);
	transition: transform .55s var(--sg-ease);
}
.sg-album-stack { transform: rotate(3deg) translate(4px, 2px); }
.sg-album-stack::before { content: ""; transform: rotate(-6deg) translate(-6px, 2px); }
.sg-album:hover .sg-album-stack { transform: rotate(7deg) translate(14px, -2px); }
.sg-album:hover .sg-album-stack::before { transform: rotate(-14deg) translate(-16px, 4px); }

.sg-album-media {
	position: relative; display: block; aspect-ratio: 4 / 3;
	overflow: hidden; border-radius: var(--sg-radius);
	background: #e8eded;
	box-shadow: 0 10px 30px -12px rgba(20, 40, 50, .45);
	transition: transform .55s var(--sg-ease), box-shadow .55s var(--sg-ease);
}
.sg-album:hover .sg-album-media { transform: translateY(-6px); box-shadow: 0 26px 50px -18px rgba(20, 40, 50, .55); }
.sg-album:focus-visible .sg-album-media { outline: 3px solid var(--sg-accent); outline-offset: 4px; }
.sg-album-img {
	position: absolute; inset: 0; display: block;
	width: 100% !important; height: 100% !important; max-width: none !important; margin: 0 !important;
	object-fit: cover; transition: transform 1.2s var(--sg-ease);
}
.sg-album:hover .sg-album-img { transform: scale(1.08); }
.sg-album-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 25, 30, 0) 35%, rgba(10, 25, 30, .8) 100%); }
.sg-album-count {
	position: absolute; top: 14px; right: 14px;
	display: inline-flex; align-items: center; gap: 6px;
	padding: 6px 11px; border-radius: 999px;
	font-size: 13px; font-weight: 700; color: #fff;
	background: rgba(255, 255, 255, .2);
	backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, .35);
}
.sg-album-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 22px; color: #fff; display: block; }
.sg-album-title { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; text-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.sg-album-sub { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; opacity: .9; }
.sg-arrow { display: inline-block; transition: transform .4s var(--sg-ease); }
.sg-album:hover .sg-arrow { transform: translateX(6px); }
.sg-js .sg-album { opacity: 0; transform: translateY(30px); }
.sg-js .sg-album.sg-show { opacity: 1; transform: none; transition: opacity .8s var(--sg-ease), transform .8s var(--sg-ease); transition-delay: calc(var(--sg-i, 0) * 90ms); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.sg-grid.sg-l-masonry { column-count: min(var(--sg-cols), 3); }
	.sg-grid.sg-l-grid { grid-template-columns: repeat(min(var(--sg-cols), 3), minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.sg-gallery { --sg-gap: 8px; }
	.sg-grid.sg-l-masonry { column-count: min(var(--sg-cols), 2); }
	.sg-grid.sg-l-grid { grid-template-columns: repeat(min(var(--sg-cols), 2), minmax(0, 1fr)); }
	.sg-filters { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
	.sg-filters::-webkit-scrollbar { display: none; }
	.sg-filter { flex: 0 0 auto; padding: 9px 15px; font-size: 14px; }
	.sg-ov, .sg-zoom { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.sg-gallery *, .sg-lb * { transition-duration: .01ms !important; animation: none !important; }
	.sg-js .sg-item, .sg-js .sg-album { opacity: 1; transform: none; }
}

/* ================= Lightbox ================= */
.sg-lb {
	--sg-accent: #2a9d8f;
	position: fixed; inset: 0; z-index: 999999;
	display: flex; flex-direction: column;
	background: rgba(8, 14, 16, .94);
	backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
	color: #fff; font-family: inherit;
	opacity: 0; visibility: hidden;
	transition: opacity .35s ease, visibility 0s linear .35s;
	-webkit-tap-highlight-color: transparent;
	user-select: none; -webkit-user-select: none;
}
.sg-lb.is-open { opacity: 1; visibility: visible; transition: opacity .35s ease; }
.sg-lb *, .sg-lb *::before, .sg-lb *::after { box-sizing: border-box; }
.sg-lb svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sg-lb-progress { position: absolute; top: 0; left: 0; height: 3px; width: 0; background: var(--sg-accent); z-index: 3; }
.sg-lb-progress.is-run { width: 100%; transition: width linear var(--sg-dur, 4000ms); }

.sg-lb-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 12px 14px; }
.sg-lb-counter { font-size: 14px; font-weight: 600; letter-spacing: .08em; opacity: .85; margin-right: auto; padding-left: 6px; font-variant-numeric: tabular-nums; }
.sg-lb-btn {
	appearance: none; -webkit-appearance: none;
	display: grid; place-items: center;
	width: 44px; height: 44px; padding: 0; margin: 0;
	border: 0; border-radius: 50%;
	color: #fff; background: rgba(255, 255, 255, .08);
	cursor: pointer; transition: background .2s, transform .2s;
}
.sg-lb-btn:hover { background: rgba(255, 255, 255, .2); }
.sg-lb-btn:active { transform: scale(.92); }
.sg-lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sg-lb-btn.is-on { background: var(--sg-accent); }

.sg-lb-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.sg-lb-img {
	max-width: calc(100% - 140px); max-height: 100%;
	width: auto; height: auto; object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
	transition: opacity .35s ease, transform .45s var(--sg-ease, cubic-bezier(.22,.8,.24,1));
	will-change: transform, opacity;
	cursor: zoom-in;
}
.sg-lb-img.is-out-l { opacity: 0; transform: translateX(-60px) scale(.97); }
.sg-lb-img.is-out-r { opacity: 0; transform: translateX(60px) scale(.97); }
.sg-lb-img.is-zoom { transform: scale(2.2); cursor: zoom-out; border-radius: 0; box-shadow: none; }
.sg-lb-img.is-drag { transition: none; }

.sg-lb-spin { position: absolute; top: 50%; left: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--sg-accent); animation: sg-spin .8s linear infinite; opacity: 0; transition: opacity .2s; pointer-events: none; }
.sg-lb.is-loading .sg-lb-spin { opacity: 1; }
@keyframes sg-spin { to { transform: rotate(360deg); } }

.sg-lb-nav { position: absolute; top: 50%; z-index: 2; width: 54px; height: 54px; margin-top: -27px; background: rgba(255, 255, 255, .1); }
.sg-lb-nav svg { width: 26px; height: 26px; }
.sg-lb-prev { left: 18px; }
.sg-lb-next { right: 18px; }
.sg-lb-nav:hover { background: var(--sg-accent); }

.sg-lb-cap { min-height: 1.4em; padding: 12px 20px 4px; text-align: center; font-size: 15px; line-height: 1.45; opacity: .92; transition: opacity .3s; }
.sg-lb-cap:empty { padding: 4px; }

.sg-lb-thumbs { display: flex; gap: 8px; padding: 10px 14px 16px; overflow-x: auto; scrollbar-width: none; justify-content: safe center; }
.sg-lb-thumbs::-webkit-scrollbar { display: none; }
.sg-lb-thumb {
	appearance: none; -webkit-appearance: none;
	flex: 0 0 auto; width: 64px; height: 48px; padding: 0; margin: 0;
	border: 2px solid transparent; border-radius: 8px; overflow: hidden;
	background: #222; cursor: pointer;
	opacity: .45; transition: opacity .25s, border-color .25s, transform .25s;
}
.sg-lb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sg-lb-thumb:hover { opacity: .85; }
.sg-lb-thumb.is-active { opacity: 1; border-color: var(--sg-accent); transform: translateY(-2px); }

@media (max-width: 700px) {
	.sg-lb-img { max-width: 100%; border-radius: 0; }
	.sg-lb-nav { display: none; }
	.sg-lb-thumb { width: 52px; height: 40px; }
	.sg-lb-fs { display: none; }
}
