/* Prevent Lenis smooth scroll on modal */
.lenis-ignore, .custom-gallery-modal-content.lenis-ignore {
	overscroll-behavior: contain !important;
	touch-action: auto !important;
	scroll-behavior: auto !important;
}
/* Custom Media Gallery Styles */
#section-unique-5{
z-index: 9999999 !important;
}

.modal-open{
    overflow: hidden !important;
}

.custom-media-gallery {
	width: 100%;
	margin-bottom: 30px;
}

.custom-gallery-title {
	margin-bottom: 20px;
	font-size: 24px;
	font-weight: 600;
	color: #333;
}

/* Gallery Layout - Grid and Swiper Carousel */
.custom-gallery-grid {
	display: grid;
	gap: var(--gap-size, 20px);
}

/* Swiper Carousel Layout */
.custom-gallery-swiper {
	width: 100%;
	height: auto;
	border-radius: 8px;
	overflow: visible !important;
	clip-path: inset(0px -100vw 0px 0px);
}

.custom-gallery-swiper .swiper-slide {
	width: auto;
	height: auto;
	flex-shrink: 0;
}

.custom-gallery-swiper .swiper-pagination {
	position: relative;
	bottom: 0;
	margin-top: 20px;
}

.custom-gallery-swiper .swiper-pagination-bullet {
	background: #333;
	opacity: 0.5;
}

.custom-gallery-swiper .swiper-pagination-bullet-active {
	background: #333;
	opacity: 1;
}

.custom-media-gallery.gallery-layout-grid .custom-gallery-swiper {
	display: none;
}

.custom-media-gallery.gallery-layout-grid .custom-gallery-grid {
	display: grid;
}

.custom-media-gallery.gallery-layout-carousel .custom-gallery-grid {
	display: none;
}

.custom-media-gallery.gallery-layout-carousel .custom-gallery-swiper {
	display: block;
}

/* Column configurations */
.custom-media-gallery.columns-2 .custom-gallery-grid {
	grid-template-columns: repeat(2, 1fr);
}

.custom-media-gallery.columns-3 .custom-gallery-grid {
	grid-template-columns: repeat(3, 1fr);
}

.custom-media-gallery.columns-4 .custom-gallery-grid {
	grid-template-columns: repeat(4, 1fr);
}

.custom-media-gallery.columns-5 .custom-gallery-grid {
	grid-template-columns: repeat(5, 1fr);
}

.custom-media-gallery.columns-6 .custom-gallery-grid {
	grid-template-columns: repeat(6, 1fr);
}

/* Gap sizes */
.custom-media-gallery.gap-0 .custom-gallery-grid {
	gap: 0;
}

.custom-media-gallery.gap-10 .custom-gallery-grid {
	gap: 10px;
}

.custom-media-gallery.gap-20 .custom-gallery-grid {
	gap: 20px;
}

.custom-media-gallery.gap-30 .custom-gallery-grid {
	gap: 30px;
}

/* Gallery Item */
.custom-gallery-item {
	position: relative;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}



.custom-gallery-image-wrapper {
	position: relative;
	width: 100%;
	border-radius: 8px;
}

.custom-gallery-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}



/* Image text content under images */
.custom-gallery-item-text {
	padding: 12px 0 0 0;
	text-align: left;
}

.custom-gallery-item-title {
	font-size: 24px;
	font-weight: 400;
	margin: 0 0 4px 0;
	line-height: 32px;
	display: block;
}

.custom-gallery-item-caption {
	font-size: 18px;
	margin: 0;
	line-height: 24px;
	display: block;
}

/* Overlay */
.custom-gallery-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}



.custom-gallery-overlay-content {
	text-align: center;
}

.custom-gallery-icon {
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Modal Styles */
.custom-gallery-modal {
	display: none !important;
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	z-index: 9999999 !important;
	/* overflow-y removed to prevent double scroll */
}

.custom-gallery-modal.active {
	display: block !important;
}

.custom-gallery-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6) !important;
	cursor: pointer;
	z-index: 9999998 !important;
	opacity: 1;
	transition: opacity 0.3s ease;
}

.custom-gallery-modal-content {
	position: relative !important;
	max-width: 85vw !important;
	width: 85vw !important;
	height: 80vh !important;
	margin: 0 auto !important;
	background: white !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	z-index: 10000000 !important;
	display: flex !important;
	flex-direction: column !important;
	touch-action: pan-y !important;
}

.custom-gallery-modal-close {
	position: absolute;
	top: 20px;
	right: 25px;
	background: rgba(0, 0, 0, 0.8) !important;
	color: white !important;
	border: none !important;
	width: 23px;
	height: 23px;
	border-radius: 50%;
	font-size: 18px;
	cursor: pointer;
	z-index: 10000001 !important;
	transition: background 0.3s ease;
	display: flex !important;
	align-items: center;
	justify-content: center;
	line-height: 2;
}

.custom-gallery-modal-close:hover {
	background: rgba(0, 0, 0, 1) !important;
}

.custom-gallery-modal-body {
	display: flex !important;
	height: 100% !important;
	min-height: calc(70vh - 80px) !important;
	width: 100%;
	flex: 1 !important;
}

.custom-gallery-modal-image-container {
	flex: 1 1 42% !important;
	position: relative;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 5% 0% !important;
	min-height: 100% !important;
}

.custom-gallery-modal-image {
	max-width: 100% !important;
	max-height: 100% !important;
	height: 100% !important;
	width: auto !important;
	object-fit: contain !important;
	border-radius: 8px;
	transition: opacity 0.3s ease;
	display: block !important;
}

.custom-gallery-modal-image.loading {
	opacity: 0.5;
}

.custom-gallery-modal-text-container {
	flex: 1 1 58% !important;
	padding: 5% 5% 5% 0 !important;
	display: flex !important;
	flex-direction: column !important;
	justify-content: flex-start !important;
	/* overflow-y: auto; */
	/* border-left: 1px solid #eee; */
}

.custom-gallery-modal-title {
	margin: 0 0 15px 0 !important;
	font-size: 24px !important;
	font-weight: 400 !important;
	color: #373435 !important;
	line-height: 1.2 !important;
	display: block !important;
}

.custom-gallery-modal-caption {
	margin: 0 0 20px 0 !important;
	font-size: 18px !important;
	color: #373435 !important;
	line-height: 1.5 !important;
	display: block !important;
}

.custom-gallery-modal-description {
	margin-top: auto !important;
	margin-bottom: 0 !important;
	font-size: 15px !important;
	line-height: 1.7 !important;
	color: #373435 !important;
	display: block !important;
	flex-shrink: 0 !important;
}

/* Animation Classes */
.custom-gallery-modal[data-animation="fadeIn"] .custom-gallery-modal-content {
	animation: fadeInModal 0.3s ease-out;
}

.custom-gallery-modal[data-animation="zoomIn"] .custom-gallery-modal-content {
	animation: zoomInModal 0.3s ease-out;
}

.custom-gallery-modal[data-animation="slideUp"] .custom-gallery-modal-content {
	animation: slideUpModal 0.3s ease-out;
}

@keyframes fadeInModal {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes zoomInModal {
	from {
		transform: scale(0.8);
		opacity: 0;
	}

	to {
		transform: scale(1);
		opacity: 1;
	}
}

@keyframes slideUpModal {
	from {
		transform: translateY(50px);
		opacity: 0;
	}

	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* Responsive Design */
@media (max-width: 1200px) {
	.custom-gallery-modal-content {
		width: 85vw !important;
		height: 75vh !important;
		margin: 0 auto !important;
	}

	.custom-gallery-modal-text-container {
		padding: 5% 5% 0 5% !important;
	}

	.custom-gallery-modal-title {
		font-size: 30px !important;
	}

	.custom-gallery-modal-description {
		font-size: 17px !important;
	}
}

@media (max-width: 768px) {

	.custom-media-gallery.columns-4 .custom-gallery-grid,
	.custom-media-gallery.columns-5 .custom-gallery-grid,
	.custom-media-gallery.columns-6 .custom-gallery-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.custom-gallery-modal-content {
		width: 100vw !important;
		height: 600px !important;
		max-height: 80vh !important;
		margin: 0 !important;
		max-width: 100% !important;
		overflow-y: auto !important;
		overflow-x: hidden !important;
		display: flex !important;
		flex-direction: column !important;
		-webkit-overflow-scrolling: touch !important; /* critical for iOS */
	}

	.custom-gallery-modal-close {
		top: 10px;
		right: 10px;
	}

	.custom-gallery-modal-body {
		flex-direction: column;
		/* min-height: auto !important; */
		/* height: 400px !important; */
		min-height: 0 !important;

	}

	.custom-gallery-modal-image-container {
		flex: 1 1 50% !important;
		padding: 30px !important;
		min-height: 500px !important;
	}

	.custom-gallery-modal-text-container {
		flex: 1 1 50% !important;
		/* padding: 30px 25px !important; */
		border-left: none;
		border-top: 1px solid #eee;

			/* overflow-y: scroll;
		-webkit-overflow-scrolling: touch !important; */
	}

	.custom-gallery-modal-title {
		font-size: 26px !important;
		margin-bottom: 20px !important;
	}

	.custom-gallery-modal-description {
		font-size: 16px !important;
	}

	.custom-media-gallery.columns-4 .custom-gallery-grid,
	.custom-media-gallery.columns-5 .custom-gallery-grid,
	.custom-media-gallery.columns-6 .custom-gallery-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.custom-gallery-modal-body {
		flex-direction: column;
		min-height: auto;
	}

	.custom-gallery-modal-image-container {
		min-height: 300px;
	}

	.custom-gallery-modal-text-container {
		flex: none;
		padding: 25px 20px;
	}

	.custom-gallery-modal-title {
		font-size: 22px;
	}

	.custom-gallery-modal-description {
		font-size: 15px;
	}
}

@media (max-width: 480px) {
	.custom-gallery-modal-image {
		object-fit: cover !important;
		width: 100% !important;
	}

	.custom-media-gallery.columns-2 .custom-gallery-grid,
	.custom-media-gallery.columns-3 .custom-gallery-grid,
	.custom-media-gallery.columns-4 .custom-gallery-grid,
	.custom-media-gallery.columns-5 .custom-gallery-grid,
	.custom-media-gallery.columns-6 .custom-gallery-grid {
		grid-template-columns: 1fr;
	}

	.custom-gallery-modal-content {
		margin: 20px auto;
	}

	.custom-gallery-modal-text-container {
		padding: 20px 15px 80px 15px;
	}

	.custom-gallery-modal-title {
		font-size: 20px;
		margin-bottom: 15px;
	}

	/* Responsive text for gallery items */
	.custom-gallery-item-title {
		font-size: 13px;
	}

	/* .custom-gallery-item-caption {
		font-size: 11px;
	} */

	.custom-gallery-item-text {
		padding: 8px 0 0 0;
	}
}

/* Masonry Layout (if needed for future enhancement) */
.custom-media-gallery.gallery-layout-masonry .custom-gallery-grid {
	column-count: var(--columns, 3);
	column-gap: var(--gap-size, 20px);
	display: block;
}

.custom-media-gallery.gallery-layout-masonry .custom-gallery-item {
	display: inline-block;
	width: 100%;
	margin-bottom: var(--gap-size, 20px);
	aspect-ratio: auto;
}
