/* Castle Group — product gallery with lightbox */

.cg-product-gallery {
	display: flex;
	flex-direction: row;
	gap: 20px;
	justify-content: center;
	max-height: 770px;
	width: 100%;
	position: relative;
}

.cg-product-gallery__action-wrapper {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: row;
    gap: 15px;
}

a.cg-product-gallery__action-link-floor-plan {
    width: 45px;
    height: 45px;
    background: var(--cgp-primary);
    display: flex;
    border-radius: 50%;
    padding: 10px;
}

a.cg-product-gallery__action-link-zoom {
    width: 45px;
    height: 45px;
    background: var(--white);
    display: flex;
    border-radius: 50%;
    padding: 10px;
}


.cg-product-gallery--single .cg-product-gallery__main {
	width: 100%;
}

.cg-product-gallery__main {
	position: relative;
	height: 100%;
	aspect-ratio: 10 / 7;
	margin-bottom: 20px;
	max-height: 770px;
	text-align: center;
	width: calc(100% - 180px);
}

.cg-product-gallery__main-link {
	display: block;
	width: 100%;
	height: 100%;
	cursor: zoom-in;
}

.cg-product-gallery__main-img {
	width: 100%;
	height: 100%;
	aspect-ratio: 10 / 7;
	max-height: 770px;
	max-width: 100%;
	object-fit: cover;
	border-radius: 0px;
}

.cg-product-gallery__thumbs {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 770px;
	overflow-y: auto;
	width: 160px;
}

.cg-product-gallery__thumb-link {
	display: block;
	flex-shrink: 0;
}

.cg-product-gallery__thumb-img {
	width: 100%;
	height: 120px;
	object-fit: cover;
	cursor: pointer;
	border-radius: 5px;
	transition: opacity 0.3s ease;
	opacity: 0.75;
	border-radius: 0px;
}

.cg-product-gallery__thumb-link:hover .cg-product-gallery__thumb-img {
	opacity: 1;
}

.cg-product-gallery__thumb-link.is-active .cg-product-gallery__thumb-img {
	opacity: 1;
	box-shadow: 0 0 0 2px currentColor;
}

/* Lightbox */
.cg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.cg-lightbox[hidden] {
	display: none !important;
}

.cg-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.88);
	cursor: pointer;
}

.cg-lightbox__content {
	position: relative;
	z-index: 2;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cg-lightbox__img {
	max-width: 100%;
	max-height: calc(100vh - 40px);
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

.cg-lightbox__close,
.cg-lightbox__prev,
.cg-lightbox__next {
	position: absolute;
	z-index: 3;
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #fff;
	font-size: 2rem;
	line-height: 1;
	padding: 12px 16px;
	cursor: pointer;
	border-radius: 4px;
	transition: background 0.2s ease;
}

.cg-lightbox__close:hover,
.cg-lightbox__prev:hover,
.cg-lightbox__next:hover {
	background: rgba(255, 255, 255, 0.3);
}

.cg-lightbox__close:disabled,
.cg-lightbox__prev:disabled,
.cg-lightbox__next:disabled {
	opacity: 0.4;
	cursor: default;
}

.cg-lightbox__close {
	top: 20px;
	right: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 14px;
}

.cg-lightbox__close-icon {
	display: block;
	width: 2rem;
	height: 2rem;
	flex-shrink: 0;
}

.cg-lightbox__prev {
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 3rem;
	padding: 16px 12px;
}

.cg-lightbox__next {
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 3rem;
	padding: 16px 12px;
}

.cg-lightbox--open {
	animation: cg-lightbox-fade-in 0.2s ease;
}

@keyframes cg-lightbox-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.cg-product-gallery__thumbs::-webkit-scrollbar {
	width: 6px;
}

.cg-product-gallery__thumbs::-webkit-scrollbar-track {
	background: transparent;
}

.cg-product-gallery__thumbs::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 3px;
}

@media (max-width: 767px) {
	.cg-product-gallery {
		flex-direction: column;
		max-height: none;
	}

	.cg-product-gallery__main {
		width: 100%;
		height: auto;
		max-height: none;
	}

	.cg-product-gallery__main-img {
		max-height: 60vw;
	}

	.cg-product-gallery__thumbs {
		flex-direction: row;
		width: 100%;
		max-height: none;
		overflow-x: auto;
		overflow-y: hidden;
	}

	.cg-product-gallery__thumb-link {
		width: 80px;
	}

	.cg-product-gallery__thumb-img {
		width: 80px;
		height: 80px;
	}
}
