/*
 * Masonry gallery lightbox — frontend modal styles.
 *
 * Forked from design-hall-modal.css. Removed the right-side info panel
 * (description, features, CTAs) — galleries are images-only. Layout is now
 * a single column: main image area + thumbnail strip below.
 */

.masonry-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(20, 22, 24, .94);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	padding: 24px;
	overflow-y: auto;
}

.masonry-lightbox.is-open {
	display: flex;
}

.masonry-lightbox .ml-box {
	position: relative;
	width: 100%;
	max-width: 1280px;
	max-height: calc( 100vh - 48px );
	background: var( --ink, #292b2c );
	border-radius: 18px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.masonry-lightbox .ml-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	background: rgba(255, 255, 255, .12);
	border-radius: 50%;
	cursor: pointer;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* Hide the text "×" glyph that lives in the button's innerHTML — it's kept
	 * for screen-reader users + as a fallback if CSS fails. The visible X is
	 * drawn geometrically via the two ::before / ::after lines below — same
	 * weight regardless of system font, perfectly centered. */
	font-size: 0;
	color: transparent;
	transition: background .2s ease;
}

.masonry-lightbox .ml-close::before,
.masonry-lightbox .ml-close::after {
	content: '';
	position: absolute;
	width: 14px;
	height: 2px;
	background: #fff;
	border-radius: 1px;
}

.masonry-lightbox .ml-close::before { transform: rotate(45deg); }
.masonry-lightbox .ml-close::after  { transform: rotate(-45deg); }

.masonry-lightbox .ml-close:hover,
.masonry-lightbox .ml-close:focus-visible {
	background: rgba(255, 255, 255, .22);
	outline: none;
}

.masonry-lightbox .ml-main {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #111;
	min-height: 360px;
	overflow: hidden;
}

.masonry-lightbox .ml-img {
	display: block;
	max-width: 100%;
	max-height: calc( 100vh - 240px );
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

.masonry-lightbox .ml-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
}

.masonry-lightbox .ml-nav:hover,
.masonry-lightbox .ml-nav:focus-visible {
	background: rgba(0, 0, 0, .85);
	outline: none;
}

.masonry-lightbox .ml-prev { left: 16px; }
.masonry-lightbox .ml-next { right: 16px; }

.masonry-lightbox .ml-counter {
	position: absolute;
	bottom: 14px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, .6);
	color: #fff;
	font-family: var( --mono, monospace );
	font-size: 12px;
	letter-spacing: .12em;
	padding: 4px 12px;
	border-radius: 99px;
	z-index: 2;
}

.masonry-lightbox .ml-thumbs {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	padding: 14px;
	overflow-x: auto;
	background: rgba(0, 0, 0, .35);
	/* Hide scrollbar across browsers — strip is drag-scrollable via JS. */
	scrollbar-width: none;             /* Firefox */
	-ms-overflow-style: none;          /* IE / legacy Edge */
	cursor: grab;
	user-select: none;
	scroll-behavior: smooth;
}

.masonry-lightbox .ml-thumbs::-webkit-scrollbar {
	display: none;                     /* Chrome / Safari / Edge Chromium */
}

.masonry-lightbox .ml-thumbs.is-dragging {
	cursor: grabbing;
	scroll-behavior: auto;             /* immediate response while dragging */
}

.masonry-lightbox .ml-thumbs.is-dragging .ml-thumb {
	pointer-events: none;              /* prevent click during drag */
}

.masonry-lightbox .ml-thumb {
	flex: 0 0 auto;
	width: 80px;
	height: 60px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	background: transparent;
	cursor: pointer;
	overflow: hidden;
	transition: border-color .2s ease, opacity .2s ease;
	opacity: .6;
}

.masonry-lightbox .ml-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

.masonry-lightbox .ml-thumb:hover,
.masonry-lightbox .ml-thumb:focus-visible {
	opacity: 1;
	outline: none;
}

.masonry-lightbox .ml-thumb.is-active {
	border-color: var( --gold-bright, #d4a949 );
	opacity: 1;
}

@media ( max-width: 720px ) {
	.masonry-lightbox {
		padding: 0;
	}
	.masonry-lightbox .ml-box {
		max-width: 100%;
		max-height: 100vh;
		border-radius: 0;
	}
	.masonry-lightbox .ml-img {
		max-height: calc( 100vh - 200px );
	}
	.masonry-lightbox .ml-nav {
		width: 40px;
		height: 40px;
		font-size: 22px;
	}
	.masonry-lightbox .ml-prev { left: 8px; }
	.masonry-lightbox .ml-next { right: 8px; }
	.masonry-lightbox .ml-thumb {
		width: 60px;
		height: 44px;
	}
}
