/* Gallery Page Layout */
.gallery-main {
	padding-top: 8rem; /* Space for the fixed header */
	padding-bottom: 5rem;
}

.gallery-title {
	font-size: clamp(2.25rem, 6vw, 3.5rem);
	font-weight: 800;
	color: var(--black);
	margin-bottom: 3rem;
	position: relative;
	width: max-content;
}

.gallery-title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -10px;
	width: 60px;
	height: 4px;
	background-color: var(--light-green);
	border-radius: 2px;
}

/* Gallery Section - Masonry Grid using Column-Count */
.gallery-section {
	column-count: 1;
	column-gap: 16px;
}

/* Responsive columns based on screensize */
@media screen and (min-width: 480px) {
	.gallery-section {
		column-count: 2;
		column-gap: 16px;
	}
}

@media screen and (min-width: 768px) {
	.gallery-section {
		column-count: 3;
		column-gap: 20px;
	}
}

@media screen and (min-width: 1024px) {
	.gallery-section {
		column-count: 4;
		column-gap: 24px;
	}
}

/* Gallery Item Styling */
.gallery-item {
	display: inline-block; /* Prevents item from breaking across columns */
	width: 100%;
	padding: 0;
	border: 0;
	text-align: left;
	margin-bottom: 16px;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
	transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
	            box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	background-color: var(--light-gray);
	break-inside: avoid; /* Standard masonry behaviour */
	cursor: pointer;
}

.gallery-item__caption {
	text-align: center;
	font-size: 0.9rem;
	margin: 8px 0 0;
	padding: 0 0.75rem 0.75rem;
	color: #555;
	overflow-wrap: break-word;
	word-break: normal;
}

.gallery-item:hover {
	transform: translateY(-6px) scale(1.04);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.gallery-item:hover img {
}

/* Body sticky footer layout specifically for this page */
body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.gallery-main {
	flex-grow: 1;
}

/* Fallback / Empty State Style */
.gallery-fallback {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 4rem 2rem;
	background: rgba(255, 255, 255, 0.6);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(0, 0, 0, 0.05);
	border-radius: 16px;
	margin: 2rem auto;
	max-width: 500px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.gallery-fallback__icon {
	width: 80px;
	height: 80px;
	color: #9ca3af;
	margin-bottom: 1.5rem;
	background: var(--light-gray);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.3s ease;
}

.gallery-fallback:hover .gallery-fallback__icon {
	color: var(--light-green);
}

.gallery-fallback__icon svg {
	width: 40px;
	height: 40px;
}

.gallery-fallback__text {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--dark-gray);
	margin-bottom: 0.5rem;
}

.gallery-fallback__subtext {
	font-size: 0.95rem;
	color: #6b7280;
	margin-bottom: 1.5rem;
	max-width: 30ch;
	line-height: 1.5;
}

.gallery-fallback__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0.75rem 1.5rem;
	background-color: var(--light-green);
	color: #fff;
	text-decoration: none;
	font-weight: 600;
	border-radius: 30px;
}

.lightbox-dialog {
	border: none;
	background: transparent;
	padding: 0;
	margin: 0;
	max-width: 100vw;
	max-height: 100vh;
	width: 100%;
	height: 100%;
	display: none;
	justify-content: center;
	align-items: center;
	position: fixed;
	top: 0;
	left: 0;
	z-index: 9999;
}

.lightbox-dialog[open] {
	display: flex;
}

.lightbox-dialog::backdrop {
	background-color: rgba(0, 0, 0, 0.85);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.lightbox-dialog__backdrop-closer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	z-index: 1;
	cursor: zoom-out;
}

.lightbox-dialog__container {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 2rem;
	box-sizing: border-box;
	z-index: 2;
	pointer-events: none;
}

.lightbox-dialog__close,
.lightbox-dialog__arrow,
.lightbox-dialog__content {
	pointer-events: auto;
}

.lightbox-dialog__close {
	position: absolute;
	top: 1.5rem;
	right: 1.5rem;
	background: rgba(0, 0, 0, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.25);
	color: #fff;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 10;
	font-size: 2rem;
	line-height: 1;
}

.lightbox-dialog__close:hover,
.lightbox-dialog__arrow:hover {
	background: rgba(255, 255, 255, 0.2);
	border-color: #fff;
}

.lightbox-dialog__close:hover {
	transform: scale(1.08);
}

.lightbox-dialog__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.25);
	color: #fff;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 5;
	font-size: 3rem;
	line-height: 1;
}

.lightbox-dialog__arrow:hover {
	transform: translateY(-50%) scale(1.08);
}

.lightbox-dialog__arrow--prev {
	left: 1.5rem;
}

.lightbox-dialog__arrow--next {
	right: 1.5rem;
}

.lightbox-dialog__content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	max-width: 80%;
	max-height: 85%;
	position: relative;
}

.lightbox-dialog__image {
	max-width: 100%;
	max-height: 80vh;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
	user-select: none;
	-webkit-user-drag: none;
	animation: lightboxZoomIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-dialog__caption {
	color: rgba(255, 255, 255, 0.9);
	margin-top: 1.25rem;
	font-size: 0.95rem;
	font-weight: 600;
	text-align: center;
	background: rgba(0, 0, 0, 0.65);
	padding: 8px 18px;
	border-radius: 20px;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	border: 1px solid rgba(255, 255, 255, 0.1);
	user-select: none;
}

@keyframes lightboxZoomIn {
	from {
		opacity: 0;
		transform: scale(0.92);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@media (max-width: 768px) {
	.lightbox-dialog__container {
		padding: 1rem;
	}

	.lightbox-dialog__content {
		max-width: 95%;
	}

	.lightbox-dialog__arrow {
		width: 46px;
		height: 46px;
		background: rgba(0, 0, 0, 0.75);
		font-size: 2.5rem;
	}

	.lightbox-dialog__arrow--prev {
		left: 0.5rem;
	}

	.lightbox-dialog__arrow--next {
		right: 0.5rem;
	}

	.lightbox-dialog__close {
		top: 1rem;
		right: 1rem;
		width: 42px;
		height: 42px;
		background: rgba(0, 0, 0, 0.75);
	}
}

/* Auto-hide fallback if gallery section contains items or is not empty */
.gallery-main:has(.gallery-item) .gallery-fallback,
.gallery-section:not(:empty) ~ .gallery-fallback {
	/* display: none; */
}
