.bsp-property-gallery {
	display: flex;
	gap: 16px;
	width: 100%;
	height: var(--bsp-gallery-height, 620px);
	box-sizing: border-box;
}

.bsp-property-gallery * {
	box-sizing: border-box;
}

.bsp-gallery-main {
	position: relative;
	flex: 1 1 65%;
	min-width: 0;
	height: 100%;
	border-radius: 6px;
	overflow: hidden;
	background: #f2f2f2;
}

.bsp-gallery-main-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	cursor: zoom-in;
	transition: opacity 0.2s ease;
}

.bsp-gallery-main-img.is-loading {
	opacity: 0.4;
}

.bsp-gallery-expand-hint {
	position: absolute;
	bottom: 14px;
	right: 14px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	pointer-events: none;
	z-index: 2;
}

.bsp-gallery-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: none;
	background: rgba(255, 255, 255, 0.9);
	color: #222;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	transition: background 0.15s ease;
}

.bsp-gallery-nav:hover {
	background: #fff;
}

.bsp-gallery-prev {
	left: 16px;
}

.bsp-gallery-next {
	right: 16px;
}

.bsp-gallery-grid {
	flex: 1 1 35%;
	height: 100%;
	overflow-y: auto;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	grid-auto-rows: min-content;
	gap: 12px;
	align-content: start;
	padding-right: 4px; /* keeps thumbnails clear of the scrollbar */
}

.bsp-gallery-grid::-webkit-scrollbar {
	width: 6px;
}

.bsp-gallery-grid::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 3px;
}

.bsp-gallery-thumb-btn {
	padding: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	overflow: hidden;
	cursor: pointer;
	background: none;
	aspect-ratio: 1 / 1;
	transition: border-color 0.15s ease, opacity 0.15s ease;
	flex-shrink: 0;
}

.bsp-gallery-thumb-btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.bsp-gallery-thumb-btn:hover {
	opacity: 0.85;
}

.bsp-gallery-thumb-btn.is-active {
	border-color: #222;
}

@media (max-width: 782px) {
	.bsp-property-gallery {
		flex-direction: column;
		height: auto;
	}

	.bsp-gallery-main {
		flex-basis: auto;
		height: 340px;
	}

	.bsp-gallery-grid {
		flex-basis: auto;
		grid-template-columns: repeat(4, 1fr);
		height: 200px;
	}
}

/* Lightbox — one shared instance, appended to <body>, reused across
   every gallery instance on the page. */
.bsp-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bsp-lightbox[hidden] {
	display: none;
}

.bsp-lightbox-img {
	max-width: 90vw;
	max-height: 88vh;
	object-fit: contain;
	display: block;
	transition: opacity 0.15s ease;
}

.bsp-lightbox-img.is-loading {
	opacity: 0.3;
}

.bsp-lightbox-close {
	position: absolute;
	top: 20px;
	right: 24px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: none;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bsp-lightbox-close:hover {
	background: rgba(255, 255, 255, 0.25);
}

.bsp-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: none;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bsp-lightbox-nav:hover {
	background: rgba(255, 255, 255, 0.25);
}

.bsp-lightbox-prev {
	left: 20px;
}

.bsp-lightbox-next {
	right: 20px;
}

.bsp-lightbox-counter {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	letter-spacing: 0.03em;
}

@media (max-width: 600px) {
	.bsp-lightbox-nav {
		width: 40px;
		height: 40px;
		font-size: 20px;
	}

	.bsp-lightbox-prev {
		left: 8px;
	}

	.bsp-lightbox-next {
		right: 8px;
	}
}
