/* Simple Clean Gallery – Frontend v1.3
   Masonry + orientation + watermark + clean video embeds
*/

.scg-gallery {
	--scg-columns: 3;
	--scg-gutter: 10px;
	--scg-wm-opacity: 0.4;
	width: 100%;
	box-sizing: border-box;
}

.scg-masonry {
	column-count: var(--scg-columns);
	column-gap: var(--scg-gutter);
	width: 100%;
}

.scg-item {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
	margin: 0 0 var(--scg-gutter);
	position: relative;
	display: block;
	border-radius: 4px;
	background: #f5f5f5;
}

.scg-item:last-child {
	margin-bottom: 0;
}

.scg-link {
	display: block;
	line-height: 0;
	text-decoration: none;
	color: inherit;
	overflow: hidden;
	border-radius: 4px;
	position: relative;
}

.scg-img {
	width: 100%;
	height: auto;
	display: block;
	vertical-align: middle;
	transition: opacity 0.25s ease, transform 0.3s ease;
}

/* ---------- Orientation ---------- */
.scg-orient-natural .scg-img {
	height: auto;
	object-fit: contain;
}

.scg-orient-landscape .scg-link { aspect-ratio: 3 / 2; }
.scg-orient-landscape .scg-img {
	width: 100%; height: 100%;
	object-fit: cover; object-position: center center;
}

.scg-orient-portrait .scg-link { aspect-ratio: 2 / 3; }
.scg-orient-portrait .scg-img {
	width: 100%; height: 100%;
	object-fit: cover; object-position: center center;
}

.scg-orient-square .scg-link { aspect-ratio: 1 / 1; }
.scg-orient-square .scg-img {
	width: 100%; height: 100%;
	object-fit: cover; object-position: center center;
}

.scg-link:hover .scg-img {
	opacity: 0.92;
	transform: scale(1.03);
}

.scg-caption {
	font-size: 0.85em;
	line-height: 1.4;
	padding: 8px 10px;
	margin: 0;
	color: #333;
	background: #fff;
	border-radius: 0 0 4px 4px;
}

/* ---------- Watermark ---------- */
.scg-wm {
	position: absolute;
	z-index: 2;
	pointer-events: none;
	opacity: var(--scg-wm-opacity);
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.scg-wm-text {
	color: #fff;
	font-weight: 600;
	text-shadow: 0 1px 3px rgba(0,0,0,0.6);
	font-family: system-ui, -apple-system, sans-serif;
	white-space: nowrap;
}

.scg-wm-logo {
	display: block;
	height: auto;
	max-width: 100%;
}

/* Size variants */
.scg-wm-size-small .scg-wm-text { font-size: 11px; }
.scg-wm-size-small .scg-wm-logo { width: 48px; }

.scg-wm-size-medium .scg-wm-text { font-size: 14px; }
.scg-wm-size-medium .scg-wm-logo { width: 72px; }

.scg-wm-size-large .scg-wm-text { font-size: 18px; }
.scg-wm-size-large .scg-wm-logo { width: 96px; }

/* Positions */
.scg-wm-top-left .scg-wm { top: 8px; left: 8px; }
.scg-wm-top-center .scg-wm { top: 8px; left: 50%; transform: translateX(-50%); }
.scg-wm-top-right .scg-wm { top: 8px; right: 8px; }
.scg-wm-center .scg-wm { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.scg-wm-bottom-left .scg-wm { bottom: 8px; left: 8px; }
.scg-wm-bottom-center .scg-wm { bottom: 8px; left: 50%; transform: translateX(-50%); }
.scg-wm-bottom-right .scg-wm { bottom: 8px; right: 8px; }

/* ---------- Video embeds (no whitespace) ---------- */
.scg-item-video .scg-video-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: var(--scg-video-aspect, 16/9);
	background: #000;
	border-radius: 4px;
	overflow: hidden;
}

.scg-video-iframe,
.scg-video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

/* ---------- Responsive columns ---------- */
@media (max-width: 1024px) {
	.scg-gallery { --scg-columns: 3; }
}
@media (max-width: 768px) {
	.scg-gallery { --scg-columns: 2; }
}
@media (max-width: 480px) {
	.scg-gallery { --scg-columns: 1; }
}

/* ---------- Lightbox ---------- */
.scg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.92);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}
.scg-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}
.scg-lightbox-inner {
	position: relative;
	max-width: 95vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.scg-lightbox-img {
	max-width: 95vw;
	max-height: 80vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 2px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.scg-lightbox-caption {
	color: #fff;
	text-align: center;
	margin-top: 12px;
	font-size: 0.95em;
	max-width: 90vw;
	line-height: 1.4;
}
.scg-lightbox-close {
	position: absolute;
	top: -44px;
	right: 0;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 10px;
	opacity: 0.85;
}
.scg-lightbox-close:hover { opacity: 1; }
.scg-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255,255,255,0.12);
	border: none;
	color: #fff;
	font-size: 28px;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.8;
	transition: background 0.2s, opacity 0.2s;
}
.scg-lightbox-nav:hover {
	background: rgba(255,255,255,0.25);
	opacity: 1;
}
.scg-lightbox-prev { left: 16px; }
.scg-lightbox-next { right: 16px; }

@media (max-width: 600px) {
	.scg-lightbox-nav { width: 40px; height: 40px; font-size: 22px; }
	.scg-lightbox-prev { left: 8px; }
	.scg-lightbox-next { right: 8px; }
	.scg-lightbox-close { top: -40px; font-size: 28px; }
}
