/**
 * SML Media Lightbox — styling tuned to the existing SML dark/green palette.
 *
 * Everything is namespaced under .sml-lb so it cannot leak into the rest of the
 * site, and the only rule that touches a non-namespaced element is the
 * .sml-lb-clickable cursor hint.
 */

.sml-lb-clickable {
	cursor: zoom-in;
}

.sml-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;          /* above the admin bar and the messenger launcher */
	display: none;
	align-items: center;
	justify-content: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #e8f4ee;
}

.sml-lb.is-open {
	display: flex;
}

.sml-lb__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(2, 6, 9, 0.94);
	backdrop-filter: blur(4px);
}

/* --- layout ------------------------------------------------------------- */

.sml-lb__shell {
	position: relative;
	display: flex;
	gap: 0;
	width: min(1600px, 96vw);
	height: min(900px, 92vh);
	background: #0b1210;
	border: 1px solid #1c2f26;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.sml-lb__stage {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #050a08;
	min-width: 0;             /* lets the flex child actually shrink */
	overflow: hidden;
}

.sml-lb__media {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

/* The instant frame: the cached thumbnail, blurred and scaled so its softness
   reads as intentional depth rather than a low-quality image. */
.sml-lb__media--preview {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	filter: blur(14px);
	transform: scale(1.06);
	opacity: 0.5;
}

.sml-lb__spinner {
	position: absolute;
	width: 34px;
	height: 34px;
	border: 3px solid rgba(0, 231, 141, 0.18);
	border-top-color: #00e78d;
	border-radius: 50%;
	animation: sml-lb-spin 0.7s linear infinite;
}

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

/* --- metadata panel ------------------------------------------------------ */

.sml-lb__panel {
	flex: 0 0 340px;
	background: #0b1210;
	border-left: 1px solid #1c2f26;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.sml-lb__panel-inner {
	padding: 20px;
}

.sml-lb__author {
	display: flex;
	gap: 10px;
	align-items: center;
	margin-bottom: 16px;
}

.sml-lb__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 40px;
}

.sml-lb__name {
	color: #e8f4ee;
	font-weight: 700;
	text-decoration: none;
	font-size: 15px;
}

.sml-lb__name:hover {
	color: #00e78d;
}

.sml-lb__title {
	font-size: 16px;
	font-weight: 700;
	margin: 0 0 6px;
	color: #e8f4ee;
	line-height: 1.3;
	/* Imported photos carry filenames like
	   751691872_1607193784305065_6655046769635502049_n.jpg — one unbroken
	   token wide enough to force a horizontal scrollbar on the whole panel. */
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* Nothing in the details panel may scroll sideways. */
.sml-lb__panel {
	overflow-x: hidden;
}

.sml-lb__caption {
	font-size: 14px;
	line-height: 1.5;
	color: #b7cfc3;
	margin: 0 0 16px;
}

.sml-lb__muted {
	color: #7f9a8e;
	font-size: 12px;
	margin: 0;
}

.sml-lb__section {
	margin-top: 18px;
	padding-top: 14px;
	border-top: 1px solid #16261f;
}

.sml-lb__section h3 {
	font-size: 11px;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: #00e78d;
	margin: 0 0 10px;
	font-weight: 800;
}

.sml-lb__section dl {
	margin: 0;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 6px 14px;
	font-size: 13px;
}

.sml-lb__section dt {
	color: #7f9a8e;
	white-space: nowrap;
}

.sml-lb__section dd {
	margin: 0;
	color: #dcefe5;
	text-align: right;
	word-break: break-word;
}

.sml-lb__actions {
	display: flex;
	gap: 8px;
	margin-top: 20px;
}

.sml-lb__btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 9px 12px;
	border-radius: 8px;
	border: 1px solid #244235;
	background: #102019;
	color: #dff9ec;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	transition: border-color 0.15s, color 0.15s;
}

.sml-lb__btn:hover {
	border-color: #00e78d;
	color: #00e78d;
}

/* --- controls ------------------------------------------------------------ */

.sml-lb__x {
	position: absolute;
	top: 18px;
	right: 22px;
	z-index: 2;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: rgba(12, 22, 18, 0.85);
	color: #e8f4ee;
	font-size: 18px;
	cursor: pointer;
	line-height: 1;
}

.sml-lb__x:hover {
	background: #16281f;
	color: #00e78d;
}

.sml-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 48px;
	height: 78px;
	border: none;
	border-radius: 10px;
	background: rgba(12, 22, 18, 0.7);
	color: #e8f4ee;
	font-size: 34px;
	line-height: 1;
	cursor: pointer;
}

.sml-lb__nav:hover {
	background: #16281f;
	color: #00e78d;
}

.sml-lb__nav--prev { left: 20px; }
.sml-lb__nav--next { right: 20px; }
.sml-lb__nav[hidden] { display: none; }

.sml-lb__count {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 12px;
	color: #9fb8ac;
	background: rgba(12, 22, 18, 0.8);
	padding: 5px 12px;
	border-radius: 999px;
	pointer-events: none;
}

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
	.sml-lb__shell {
		flex-direction: column;
		width: 100vw;
		height: 100vh;
		border: none;
		border-radius: 0;
	}
	.sml-lb__stage {
		flex: 1 1 60%;
	}
	.sml-lb__panel {
		flex: 1 1 40%;
		border-left: none;
		border-top: 1px solid #1c2f26;
	}
	.sml-lb__nav {
		width: 40px;
		height: 62px;
		font-size: 28px;
		background: rgba(12, 22, 18, 0.55);
	}
	.sml-lb__nav--prev { left: 6px; }
	.sml-lb__nav--next { right: 6px; }
}

@media (prefers-reduced-motion: reduce) {
	.sml-lb__spinner { animation-duration: 2s; }
	.sml-lb__media--preview { filter: none; transform: none; }
}
