/* SCHOOL ALBUM PRO - Frontend Gallery & Lightbox Styles */
.sap-gallery-wrapper,
.sap-albums-container {
	--sap-bg: #ffffff;
	--sap-card-bg: #ffffff;
	--sap-title-color: #0f172a;
	--sap-text-color: #475569;
	--sap-border-col: #e2e8f0;
	--sap-accent: #2563eb;
	--sap-cols-desktop: 4;
	--sap-cols-tablet: 3;
	--sap-cols-mobile: 2;
	--sap-spacing: 16px;
	--sap-border-width: 1px;
	--sap-radius: 12px;
	--sap-title-size: 18px;
	--sap-caption-size: 14px;

	background-color: var(--sap-bg);
	color: var(--sap-text-color);
	padding: 24px;
	border-radius: var(--sap-radius);
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	overflow-x: hidden;
}

.sap-gallery-wrapper *,
.sap-albums-container * {
	box-sizing: border-box;
}

/* Theme Presets */
.sap-theme-elegant-white {
	--sap-bg: #ffffff;
	--sap-card-bg: #ffffff;
	--sap-title-color: #0f172a;
	--sap-text-color: #475569;
	--sap-border-col: #e2e8f0;
	--sap-accent: #2563eb;
}
.sap-theme-modern-dark {
	--sap-bg: #0f172a;
	--sap-card-bg: #1e293b;
	--sap-title-color: #f8fafc;
	--sap-text-color: #cbd5e1;
	--sap-border-col: #334155;
	--sap-accent: #38bdf8;
}
.sap-theme-classic-institutional {
	--sap-bg: #f8fafc;
	--sap-card-bg: #ffffff;
	--sap-title-color: #1e3a8a;
	--sap-text-color: #334155;
	--sap-border-col: #cbd5e1;
	--sap-accent: #1d4ed8;
}

/* Album Header */
.sap-album-header {
	margin-bottom: 24px;
	border-bottom: 1px solid var(--sap-border-col);
	padding-bottom: 16px;
}
.sap-album-header-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	font-size: 13px;
	margin-bottom: 8px;
}
.sap-badge-category {
	background: var(--sap-accent);
	color: #ffffff;
	padding: 3px 10px;
	border-radius: 999px;
	font-weight: 600;
	font-size: 12px;
}
.sap-album-main-title {
	margin: 0 0 8px;
	font-size: calc(var(--sap-title-size) * 1.45);
	color: var(--sap-title-color);
	line-height: 1.25;
}
.sap-album-main-desc {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: var(--sap-text-color);
	max-width: 75ch;
}

/* 1. Elegant Grid (Default) */
.sap-gallery-grid {
	display: grid;
	grid-template-columns: repeat(var(--sap-cols-desktop), minmax(0, 1fr));
	gap: var(--sap-spacing);
}

/* 2. Masonry Gallery */
.sap-layout-masonry .sap-masonry-columns {
	display: block;
	column-count: var(--sap-cols-desktop);
	column-gap: var(--sap-spacing);
}
.sap-layout-masonry .sap-gallery-item {
	break-inside: avoid;
	margin-bottom: var(--sap-spacing);
	display: inline-block;
	width: 100%;
}

/* 3. Justified Gallery */
.sap-layout-justified .sap-justified-rows {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sap-spacing);
}
.sap-layout-justified .sap-gallery-item {
	flex-grow: calc(var(--sap-item-aspect, 1.33) * 100);
	flex-basis: calc(var(--sap-item-aspect, 1.33) * 210px);
	height: 230px;
}
.sap-layout-justified .sap-gallery-thumb {
	height: 100%;
}
.sap-layout-justified .sap-gallery-thumb img {
	height: 100%;
	width: 100%;
	object-fit: cover;
}
.sap-layout-justified .sap-justified-rows::after {
	content: "";
	flex-grow: 999999999;
}

/* 4. Carousel Slider & 6. Classic Thumbnail Gallery */
.sap-slider-viewport {
	position: relative;
	overflow: hidden;
	border-radius: var(--sap-radius);
}
.sap-layout-slider .sap-slider-track,
.sap-layout-classic .sap-slider-track {
	display: flex;
	gap: var(--sap-spacing);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
}
.sap-layout-slider .sap-slider-track::-webkit-scrollbar,
.sap-layout-classic .sap-slider-track::-webkit-scrollbar {
	display: none;
}
.sap-layout-slider .sap-gallery-item {
	flex: 0 0 calc((100% - (var(--sap-spacing) * (var(--sap-cols-desktop) - 1))) / var(--sap-cols-desktop));
	scroll-snap-align: start;
}
.sap-layout-classic .sap-gallery-item {
	flex: 0 0 100%;
	scroll-snap-align: center;
}
.sap-layout-classic .sap-gallery-thumb img {
	max-height: 540px;
	object-fit: contain;
	background: #0f172a;
}
.sap-slider-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 5;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: none;
	background: rgba(15, 23, 42, 0.72);
	color: #fff;
	font-size: 18px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
}
.sap-slider-btn:hover {
	background: var(--sap-accent);
}
.sap-slider-prev { left: 12px; }
.sap-slider-next { right: 12px; }

.sap-classic-thumbs {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding-top: 12px;
}
.sap-classic-thumb-btn {
	flex: 0 0 76px;
	height: 56px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	overflow: hidden;
	cursor: pointer;
	opacity: 0.65;
	transition: opacity 0.2s, border-color 0.2s;
}
.sap-classic-thumb-btn.active,
.sap-classic-thumb-btn:hover {
	opacity: 1;
	border-color: var(--sap-accent);
}
.sap-classic-thumb-btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 5. Editorial Gallery */
.sap-layout-editorial .sap-gallery-grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}
.sap-layout-editorial .sap-gallery-item:nth-child(6n + 1) {
	grid-column: span 2;
	grid-row: span 2;
}
.sap-layout-editorial .sap-gallery-item:nth-child(6n + 4) {
	grid-column: span 2;
}

/* Gallery Item Card & Ratios */
.sap-gallery-item {
	margin: 0;
	background: var(--sap-card-bg);
	border: var(--sap-border-width) solid var(--sap-border-col);
	border-radius: var(--sap-radius);
	overflow: hidden;
	position: relative;
	transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.sap-shadow-soft .sap-gallery-item,
.sap-shadow-soft .sap-album-card {
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.sap-shadow-medium .sap-gallery-item,
.sap-shadow-medium .sap-album-card {
	box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}
.sap-shadow-strong .sap-gallery-item,
.sap-shadow-strong .sap-album-card {
	box-shadow: 0 18px 36px rgba(15, 23, 42, 0.2);
}

.sap-gallery-thumb {
	position: relative;
	overflow: hidden;
	width: 100%;
}
.sap-gallery-thumb img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	transition: transform 0.45s ease;
}

.sap-ratio-4-3:not(.sap-layout-masonry):not(.sap-layout-justified):not(.sap-layout-classic) .sap-gallery-thumb { aspect-ratio: 4 / 3; }
.sap-ratio-16-9:not(.sap-layout-masonry):not(.sap-layout-justified):not(.sap-layout-classic) .sap-gallery-thumb { aspect-ratio: 16 / 9; }
.sap-ratio-3-2:not(.sap-layout-masonry):not(.sap-layout-justified):not(.sap-layout-classic) .sap-gallery-thumb { aspect-ratio: 3 / 2; }
.sap-ratio-1-1:not(.sap-layout-masonry):not(.sap-layout-justified):not(.sap-layout-classic) .sap-gallery-thumb { aspect-ratio: 1 / 1; }
.sap-ratio-original .sap-gallery-thumb img { height: auto; }

/* Hover Animations */
.sap-hover-zoom .sap-gallery-item:hover .sap-gallery-thumb img { transform: scale(1.07); }
.sap-hover-lift .sap-gallery-item:hover { transform: translateY(-5px); }
.sap-hover-glow .sap-gallery-item:hover { border-color: var(--sap-accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }

.sap-zoom-trigger {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: rgba(15, 23, 42, 0.25);
	border: none;
	color: #fff;
	opacity: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.25s ease;
}
.sap-gallery-item:hover .sap-zoom-trigger,
.sap-zoom-trigger:focus {
	opacity: 1;
}

.sap-gallery-caption {
	padding: 10px 14px;
	font-size: var(--sap-caption-size);
	color: var(--sap-text-color);
	line-height: 1.4;
}
.sap-cap-title {
	display: block;
	color: var(--sap-title-color);
	font-size: calc(var(--sap-caption-size) + 1px);
	margin-bottom: 2px;
}

/* Album Cards Listing ([school_albums]) */
.sap-albums-grid {
	display: grid;
	grid-template-columns: repeat(var(--sap-cols-desktop), minmax(0, 1fr));
	gap: 24px;
}
.sap-album-card {
	background: var(--sap-card-bg);
	border: 1px solid var(--sap-border-col);
	border-radius: var(--sap-radius);
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.sap-album-card:hover {
	transform: translateY(-5px);
}
.sap-album-card-link {
	text-decoration: none;
	color: inherit;
	display: flex;
	flex-direction: column;
	height: 100%;
}
.sap-album-card-media {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #e2e8f0;
}
.sap-album-card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.45s ease;
}
.sap-album-card:hover .sap-album-card-media img {
	transform: scale(1.06);
}
.sap-album-card-count {
	position: absolute;
	bottom: 12px;
	right: 12px;
	background: rgba(15, 23, 42, 0.8);
	backdrop-filter: blur(6px);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}
.sap-album-card-content {
	padding: 18px 20px;
	display: flex;
	flex-direction: column;
	flex: 1;
}
.sap-album-card-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 12px;
	color: var(--sap-text-color);
	margin-bottom: 8px;
}
.sap-album-card-cat {
	color: var(--sap-accent);
	font-weight: 600;
}
.sap-album-card-title {
	margin: 0 0 8px;
	font-size: var(--sap-title-size);
	color: var(--sap-title-color);
	line-height: 1.35;
}
.sap-album-card-desc {
	margin: 0 0 14px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--sap-text-color);
}
.sap-album-card-cta {
	margin-top: auto;
	font-size: 13px;
	font-weight: 600;
	color: var(--sap-accent);
}

/* Horizontal & Overlay Album Card Variants */
.sap-albums-card-horizontal .sap-albums-grid {
	grid-template-columns: 1fr;
}
.sap-albums-card-horizontal .sap-album-card-link {
	flex-direction: row;
}
.sap-albums-card-horizontal .sap-album-card-media {
	flex: 0 0 280px;
}
.sap-albums-card-overlay .sap-album-card {
	position: relative;
}
.sap-albums-card-overlay .sap-album-card-content {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(15, 23, 42, 0.9) 10%, rgba(15, 23, 42, 0.15) 70%);
	justify-content: flex-end;
	color: #fff;
}
.sap-albums-card-overlay .sap-album-card-title,
.sap-albums-card-overlay .sap-album-card-meta,
.sap-albums-card-overlay .sap-album-card-desc {
	color: #f8fafc;
}

.sap-back-nav {
	margin-bottom: 16px;
}
.sap-back-btn {
	display: inline-block;
	padding: 8px 16px;
	background: #f1f5f9;
	color: #0f172a;
	text-decoration: none;
	border-radius: 8px;
	font-weight: 600;
	font-size: 14px;
}
.sap-load-more-wrap {
	text-align: center;
	margin-top: 28px;
}
.sap-load-more-btn {
	background: var(--sap-accent);
	color: #fff;
	border: none;
	padding: 12px 26px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s;
}
.sap-load-more-btn:hover {
	opacity: 0.9;
}

/* Lightbox Overlay */
.sap-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: var(--sap-lb-bg, rgba(15, 23, 42, 0.95));
	backdrop-filter: blur(8px);
	display: none;
	flex-direction: column;
	color: #fff;
	user-select: none;
}
.sap-lightbox.is-open {
	display: flex;
}
.sap-lb-topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 14px 20px;
	z-index: 10;
}
.sap-lb-counter {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.05em;
}
.sap-lb-controls {
	display: flex;
	gap: 8px;
}
.sap-lb-btn,
.sap-lb-arrow {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, transform 0.2s ease;
}
.sap-lb-nav-solid .sap-lb-btn,
.sap-lb-nav-solid .sap-lb-arrow {
	background: #1e293b;
	border-color: #475569;
}
.sap-lb-nav-minimal .sap-lb-btn,
.sap-lb-nav-minimal .sap-lb-arrow {
	background: transparent;
	border-color: transparent;
}
.sap-lb-btn:hover,
.sap-lb-arrow:hover {
	background: rgba(255, 255, 255, 0.28);
}
.sap-lb-btn.is-active {
	background: #2563eb;
	border-color: #3b82f6;
}
.sap-lb-stage {
	flex: 1;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	padding: 0 60px;
}
.sap-lb-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	font-size: 20px;
}
.sap-lb-prev { left: 16px; }
.sap-lb-next { right: 16px; }

.sap-lb-img-wrap {
	max-width: 100%;
	max-height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}
#sap-lb-img {
	max-width: 90vw;
	max-height: 76vh;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
	transition: transform 0.25s ease, opacity 0.25s ease;
}
.sap-lb-bottombar {
	padding: 14px 24px 20px;
	text-align: center;
	max-width: 800px;
	margin: 0 auto;
}
.sap-lb-bottombar h4 {
	margin: 0 0 4px;
	font-size: 16px;
	color: #fff;
}
.sap-lb-bottombar p {
	margin: 0;
	font-size: 14px;
	color: #cbd5e1;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
	.sap-gallery-grid,
	.sap-albums-grid {
		grid-template-columns: repeat(var(--sap-cols-tablet), minmax(0, 1fr));
	}
	.sap-layout-masonry .sap-masonry-columns {
		column-count: var(--sap-cols-tablet);
	}
	.sap-layout-slider .sap-gallery-item {
		flex: 0 0 calc((100% - (var(--sap-spacing) * (var(--sap-cols-tablet) - 1))) / var(--sap-cols-tablet));
	}
	.sap-layout-editorial .sap-gallery-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.sap-gallery-wrapper,
	.sap-albums-container {
		padding: 14px;
	}
	.sap-gallery-grid,
	.sap-albums-grid {
		grid-template-columns: repeat(var(--sap-cols-mobile), minmax(0, 1fr));
	}
	.sap-layout-masonry .sap-masonry-columns {
		column-count: var(--sap-cols-mobile);
	}
	.sap-layout-slider .sap-gallery-item {
		flex: 0 0 calc((100% - (var(--sap-spacing) * (var(--sap-cols-mobile) - 1))) / var(--sap-cols-mobile));
	}
	.sap-layout-editorial .sap-gallery-grid {
		grid-template-columns: 1fr;
	}
	.sap-layout-editorial .sap-gallery-item:nth-child(6n + 1),
	.sap-layout-editorial .sap-gallery-item:nth-child(6n + 4) {
		grid-column: span 1;
		grid-row: span 1;
	}
	.sap-albums-card-horizontal .sap-album-card-link {
		flex-direction: column;
	}
	.sap-albums-card-horizontal .sap-album-card-media {
		flex: auto;
	}
	.sap-lb-stage {
		padding: 0 12px;
	}
	.sap-lb-arrow {
		width: 36px;
		height: 36px;
		font-size: 16px;
	}
}
