/* =============================================================================
   Newsam Photo Gallery — v1.0
   ============================================================================= */

/* ── Tile Grid ───────────────────────────────────────────────────────────── */

.newsam-pg-wrapper {
	display: grid;
	gap: 16px;
	width: 100%;
	box-sizing: border-box;
}

.newsam-pg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.newsam-pg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.newsam-pg-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Default: 3 columns */
.newsam-pg-wrapper:not([class*="newsam-pg-cols-"]) {
	grid-template-columns: repeat(3, 1fr);
}

/* Individual tile */
.newsam-pg-tile {
	position: relative;
	overflow: hidden;
	cursor: pointer;
	border-radius: 3px;
	aspect-ratio: 233 / 131;
	display: block;
}

.newsam-pg-tile img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.newsam-pg-tile:hover img {
	transform: scale(1.06);
}

/* Overlay on hover */
.newsam-pg-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.35);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.newsam-pg-tile:hover .newsam-pg-overlay {
	opacity: 1;
}

.newsam-pg-zoom-icon {
	width: 32px;
	height: 32px;
}

/* ── Backdrop ────────────────────────────────────────────────────────────── */

.newsam-pg-lb-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	z-index: 99998;
}

.newsam-pg-lb-backdrop.active {
	display: block;
}

/* ── Lightbox ────────────────────────────────────────────────────────────── */

.newsam-pg-lightbox {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	align-items: center;
	justify-content: center;
	flex-direction: column;
}

.newsam-pg-lightbox.active {
	display: flex;
}

/* Image wrapper */
.newsam-pg-lb-img-wrap {
	position: relative;
	max-width: 90vw;
	max-height: 80vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

#newsam-pg-lb-img {
	max-width: 90vw;
	max-height: 80vh;
	object-fit: contain;
	display: block;
	border-radius: 3px;
	transition: opacity 0.2s ease;
	box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

/* Spinner */
.newsam-pg-lb-spinner {
	display: none;
	position: absolute;
	width: 36px;
	height: 36px;
	border: 3px solid rgba(255,255,255,0.2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: newsam-spin 0.7s linear infinite;
}

@keyframes newsam-spin {
	to { transform: rotate(360deg); }
}

/* Close button */
.newsam-pg-lb-close {
	position: fixed;
	top: 16px;
	right: 20px;
	background: rgba(0,0,0,0.5);
	border: none;
	color: #fff;
	font-size: 20px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	transition: background 0.2s;
	line-height: 1;
}

.newsam-pg-lb-close:hover {
	background: rgba(255,255,255,0.15);
}

/* Arrows */
.newsam-pg-lb-arrow {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0,0,0,0.45);
	border: none;
	cursor: pointer;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	transition: background 0.2s, opacity 0.2s;
}

.newsam-pg-lb-arrow:hover {
	background: rgba(255,255,255,0.15);
}

.newsam-pg-lb-arrow svg {
	width: 28px;
	height: 28px;
}

.newsam-pg-lb-prev { left: 16px; }
.newsam-pg-lb-next { right: 16px; }

/* Caption */
.newsam-pg-lb-caption {
	color: #ddd;
	font-size: 13px;
	margin-top: 12px;
	text-align: center;
	max-width: 80vw;
	line-height: 1.4;
}

/* Counter */
.newsam-pg-lb-counter {
	color: #888;
	font-size: 11px;
	margin-top: 5px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
	.newsam-pg-cols-3 { grid-template-columns: repeat(2, 1fr); }
	.newsam-pg-cols-4 { grid-template-columns: repeat(2, 1fr); }
	.newsam-pg-lb-arrow { width: 38px; height: 38px; }
	.newsam-pg-lb-arrow svg { width: 22px; height: 22px; }
	.newsam-pg-lb-prev { left: 8px; }
	.newsam-pg-lb-next { right: 8px; }
}

/* Empty state */
.newsam-pg-empty {
	padding: 16px;
	text-align: center;
	color: #666;
}
