/* Site Preview Dashboard — Frontend Styles */

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

.spd-grid {
	display: grid;
	gap: 1.5rem;
}

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

@media (max-width: 768px) {
	.spd-cols-3,
	.spd-cols-4 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.spd-cols-2,
	.spd-cols-3,
	.spd-cols-4 {
		grid-template-columns: 1fr;
	}
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.spd-card {
	cursor: pointer;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	background: #fff;
	outline: none;
}

.spd-card:hover,
.spd-card:focus {
	transform: scale(1.03);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.spd-card:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.spd-card img {
	width: 100%;
	aspect-ratio: 1280 / 900;
	object-fit: cover;
	object-position: top;
	display: block;
}

.spd-label {
	display: block;
	padding: 0.6rem 0.75rem;
	font-weight: 600;
	text-align: center;
	font-size: 0.9rem;
	color: #1e1e1e;
}

/* ── Popup overlay ────────────────────────────────────────────────────────── */

#spd-popup.spd-popup-overlay {
	position: fixed;
	inset: 0;
	margin: 0;
	padding: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.75);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.22s ease;
	z-index: 999999;
	box-sizing: border-box;
}

#spd-popup.spd-popup-overlay.spd-open {
	opacity: 1;
	pointer-events: auto;
}

/* ── Popup window ─────────────────────────────────────────────────────────── */

#spd-popup .spd-popup-window {
	position: absolute;
	inset: 40px;
	background: #fff;
	border-radius: 8px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform: scale(0.97);
	transition: transform 0.22s ease;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

#spd-popup.spd-open .spd-popup-window {
	transform: scale(1);
}

/* ── Popup header ─────────────────────────────────────────────────────────── */

#spd-popup .spd-popup-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.65rem 1rem;
	border-bottom: 1px solid #e0e0e0;
	gap: 12px;
	flex-shrink: 0;
	min-height: 48px;
	box-sizing: border-box;
}

#spd-popup .spd-popup-site-name {
	font-weight: 700;
	font-size: 1rem;
	color: #1e1e1e;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#spd-popup .spd-popup-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

#spd-popup .spd-popup-visit-btn {
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: none;
	color: #2271b1;
	white-space: nowrap;
}

#spd-popup .spd-popup-visit-btn:hover {
	text-decoration: underline;
}

#spd-popup .spd-popup-close {
	background: none;
	border: none;
	font-size: 1.8rem;
	line-height: 1;
	cursor: pointer;
	color: #646970;
	padding: 0 4px;
	transition: color 0.15s ease;
	flex-shrink: 0;
}

#spd-popup .spd-popup-close:hover {
	color: #d63638;
}

/* ── iframe: fills all space below the header ─────────────────────────────── */

#spd-popup-iframe {
	border: none;
	flex: 1 1 0;
	min-height: 0;
	width: 100%;
	display: block;
}

/* ── Mobile: edge-to-edge ─────────────────────────────────────────────────── */

@media (max-width: 600px) {
	#spd-popup .spd-popup-window {
		inset: 0;
		border-radius: 0;
	}
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.spd-empty {
	color: #646970;
	font-style: italic;
}

/* ── Project descriptions (v1.4.0) ── */
.spd-desc {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	padding: 0 0.85rem 0.75rem;
	font-size: 0.82rem;
	line-height: 1.5;
	text-align: center;
	color: #6b7280;
}

#spd-popup .spd-popup-desc {
	margin: 0;
	padding: 0.55rem 1rem;
	font-size: 0.85rem;
	line-height: 1.55;
	color: #4b5563;
	background: #f8f9fa;
	border-bottom: 1px solid #e0e0e0;
}
