/**
 * Shay Lehv Justified Gallery widget (v1.6.3).
 *
 * Original styles for the justified photo grid and its lightbox.
 * Everything is scoped to .sl-justified-gallery / .sl-jg-* classes.
 */

/* The grid: JS sizes each tile; flex-wrap flows the justified rows. */
.sl-justified-gallery {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	line-height: 0;
}

/* Each tile: link wrapping the image; hover zooms the image and reveals
   the caption overlay. */
.sl-jg-item {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 3px;
	flex: 0 0 auto;
}

.sl-jg-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.sl-jg-item:hover img,
.sl-jg-item:focus-visible img {
	transform: scale(1.06);
}

/* Caption: dark gradient at the bottom, revealed on hover/focus. */
.sl-jg-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 24px 10px 10px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.78));
	color: #fff;
	font-size: 0.8rem;
	line-height: 1.35;
	pointer-events: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.sl-jg-item:hover .sl-jg-caption,
.sl-jg-item:focus-visible .sl-jg-caption {
	opacity: 1;
	transform: none;
}

/* Honor reduced-motion: no zoom, no caption slide. */
@media (prefers-reduced-motion: reduce) {
	.sl-jg-item img,
	.sl-jg-caption {
		transition: none;
	}

	.sl-jg-item:hover img,
	.sl-jg-item:focus-visible img {
		transform: none;
	}

	.sl-jg-item:hover .sl-jg-caption,
	.sl-jg-item:focus-visible .sl-jg-caption {
		transform: none;
	}
}

/* ============================================================
   Lightbox (appended to <body>, still fully prefixed).
   ============================================================ */
.sl-jg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.92);
	opacity: 0;
	transition: opacity 0.25s ease;
	padding: 20px;
	box-sizing: border-box;
}

.sl-jg-lightbox.sl-jg-open {
	opacity: 1;
}

.sl-jg-lightbox-figure {
	margin: 0;
	max-width: 94vw;
	text-align: center;
	line-height: 1.4;
}

.sl-jg-lightbox img {
	max-width: 94vw;
	max-height: 74vh;
	width: auto;
	height: auto;
	display: block;
	margin: 0 auto;
	border-radius: 3px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.sl-jg-lightbox-caption {
	color: #fff;
	font-size: 0.95rem;
	margin-top: 12px;
}

.sl-jg-lightbox-counter {
	color: rgba(255, 255, 255, 0.65);
	font-size: 0.8rem;
	margin-top: 6px;
	letter-spacing: 0.05em;
}

.sl-jg-lightbox-btn {
	position: absolute;
	background: rgba(255, 255, 255, 0.12);
	border: none;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	width: 46px;
	height: 46px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease;
}

.sl-jg-lightbox-btn:hover,
.sl-jg-lightbox-btn:focus-visible {
	background: rgba(255, 255, 255, 0.28);
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sl-jg-lightbox-btn svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

.sl-jg-lightbox-close {
	top: 16px;
	right: 16px;
}

.sl-jg-lightbox-prev {
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
}

.sl-jg-lightbox-next {
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 600px) {
	.sl-jg-lightbox-prev {
		left: 8px;
	}

	.sl-jg-lightbox-next {
		right: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sl-jg-lightbox {
		transition: none;
	}
}
