/*
 * Gallery page — our-gallery.php. A masonry of campus photos at their natural
 * shape, opened in GLightbox, with Load More in place of page links. Plain
 * CSS: the theme ships without node_modules, so Tailwind classes missing from
 * the compiled build would not render.
 */

.gallery-page {
	position: relative;
	padding: 5rem 0;
	overflow: hidden;
	background:
		radial-gradient(40rem 22rem at 100% 0%, rgb(6 182 212 / 0.08), transparent 70%),
		radial-gradient(36rem 20rem at 0% 30%, rgb(79 70 229 / 0.07), transparent 70%),
		#FFFFFF;
}

@media (min-width: 768px) {
	.gallery-page {
		padding: 6rem 0;
	}
}

.gallery-page__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1.5rem;
	margin-bottom: 2.5rem;
}

.gallery-page__tag {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	color: #0891B2;
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.25em;
	text-transform: uppercase;
}

.gallery-page__tag::before {
	content: '';
	width: 2rem;
	height: 2px;
	border-radius: 2px;
	background: linear-gradient(90deg, #4F46E5, #06B6D4);
}

.gallery-page__title {
	margin: 0.9rem 0 0;
	color: #0F172A;
	font-size: 1.9rem;
	font-weight: 800;
	line-height: 1.15;
}

@media (min-width: 768px) {
	.gallery-page__title {
		font-size: 2.5rem;
	}
}

.gallery-page__desc {
	max-width: 36rem;
	margin: 0.9rem 0 0;
	color: #64748B;
	font-size: 1rem;
	line-height: 1.7;
}

.gallery-page__count {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 1.1rem 0.6rem 0.6rem;
	border: 1px solid #E2E8F0;
	border-radius: 9999px;
	background: #FFFFFF;
	box-shadow: 0 12px 28px -18px rgb(15 23 42 / 0.35);
	color: #475569;
	font-size: 0.9rem;
}

.gallery-page__count .material-symbols-outlined {
	display: flex;
	width: 2.4rem;
	height: 2.4rem;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background: linear-gradient(135deg, #4F46E5, #06B6D4);
	color: #FFFFFF;
	font-size: 1.25rem;
}

.gallery-page__count strong {
	color: #0F172A;
	font-size: 1.1rem;
	font-weight: 800;
}

/* ----- Masonry ----- */

.gallery-masonry {
	columns: 1;
	column-gap: 1.25rem;
}

@media (min-width: 640px) {
	.gallery-masonry {
		columns: 2;
	}
}

@media (min-width: 1024px) {
	.gallery-masonry {
		columns: 3;
		column-gap: 1.5rem;
	}
}

.gallery-card {
	position: relative;
	display: block;
	margin: 0 0 1.5rem;
	overflow: hidden;
	border-radius: 1.1rem;
	background: #E2E8F0;
	box-shadow: 0 14px 30px -22px rgb(15 23 42 / 0.45);
	break-inside: avoid;
	transition: box-shadow .35s ease, transform .35s ease;
	/* Columns lay cards out top to bottom; this keeps each one whole. */
	-webkit-column-break-inside: avoid;
}

/*
 * Most photos are wide 16:9 phone shots, which made short tiles. Each tile is
 * cropped taller instead, cycling square, 5:4 and 4:3 so the columns keep a
 * masonry rhythm; the lightbox still opens the whole photo.
 */
.gallery-card img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	transition: transform .7s cubic-bezier(.2, .7, .2, 1), filter .4s ease;
}

.gallery-card:nth-child(3n + 2) img {
	aspect-ratio: 5 / 4;
}

.gallery-card:nth-child(3n) img {
	aspect-ratio: 4 / 3;
}

.gallery-card:hover,
.gallery-card:focus-visible {
	box-shadow: 0 26px 50px -24px rgb(79 70 229 / 0.5);
	transform: translateY(-4px);
}

.gallery-card:hover img,
.gallery-card:focus-visible img {
	transform: scale(1.06);
}

/* Shade and zoom badge that come up on hover. */
.gallery-card::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgb(15 23 42 / 0.65), rgb(15 23 42 / 0) 55%);
	opacity: 0;
	transition: opacity .35s ease;
}

.gallery-card:hover::after,
.gallery-card:focus-visible::after {
	opacity: 1;
}

.gallery-card__num {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	z-index: 2;
	padding: 0.2rem 0.55rem;
	border-radius: 9999px;
	background: rgb(15 23 42 / 0.5);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	color: #FFFFFF;
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	opacity: 0;
	transform: translateY(-4px);
	transition: opacity .3s ease, transform .3s ease;
}

.gallery-card__zoom {
	position: absolute;
	right: 0.9rem;
	bottom: 0.9rem;
	z-index: 2;
	display: flex;
	width: 2.75rem;
	height: 2.75rem;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background: #FFFFFF;
	box-shadow: 0 10px 20px -8px rgb(0 0 0 / 0.5);
	color: #4F46E5;
	font-size: 1.5rem;
	opacity: 0;
	transform: scale(0.6) rotate(-45deg);
	transition: opacity .3s ease, transform .35s cubic-bezier(.3, 1.4, .5, 1);
}

.gallery-card__caption {
	position: absolute;
	right: 4rem;
	bottom: 1rem;
	left: 1rem;
	z-index: 2;
	overflow: hidden;
	color: #FFFFFF;
	font-size: 0.85rem;
	font-weight: 700;
	white-space: nowrap;
	text-overflow: ellipsis;
	opacity: 0;
	transition: opacity .3s ease;
}

.gallery-card:hover .gallery-card__num,
.gallery-card:focus-visible .gallery-card__num,
.gallery-card:hover .gallery-card__caption,
.gallery-card:focus-visible .gallery-card__caption {
	opacity: 1;
	transform: none;
}

.gallery-card:hover .gallery-card__zoom,
.gallery-card:focus-visible .gallery-card__zoom {
	opacity: 1;
	transform: none;
}

/* Scroll-in: only once the script has marked the grid, so without JS every
   card simply shows. */
.gallery-masonry.is-animated .gallery-card {
	opacity: 0;
	transform: translateY(24px) scale(0.98);
	transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease;
}

.gallery-masonry.is-animated .gallery-card.is-in {
	opacity: 1;
	transform: none;
}

.gallery-masonry.is-animated .gallery-card.is-in:hover,
.gallery-masonry.is-animated .gallery-card.is-in:focus-visible {
	transform: translateY(-4px);
	transition-delay: 0s !important;
}

/* ----- Load more ----- */

.gallery-page__more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	margin-top: 2.5rem;
}

.gallery-page__more-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.9rem 1.75rem;
	border-radius: 9999px;
	background: linear-gradient(135deg, #4F46E5, #06B6D4);
	box-shadow: 0 16px 32px -14px rgb(79 70 229 / 0.6);
	color: #FFFFFF;
	font-size: 0.95rem;
	font-weight: 700;
	text-decoration: none;
	transition: transform .2s ease, box-shadow .2s ease;
}

.gallery-page__more-btn:hover,
.gallery-page__more-btn:focus-visible {
	box-shadow: 0 20px 36px -14px rgb(79 70 229 / 0.7);
	transform: translateY(-2px);
}

.gallery-page__more-btn.is-loading {
	pointer-events: none;
	opacity: 0.75;
}

.gallery-page__more-btn.is-loading .material-symbols-outlined {
	animation: gallery-spin 1s linear infinite;
}

@keyframes gallery-spin {
	to {
		transform: rotate(360deg);
	}
}

.gallery-page__progress {
	color: #94A3B8;
	font-size: 0.82rem;
}

.gallery-page__more.is-done .gallery-page__progress::after {
	content: ' — that\2019s everything!';
}

.gallery-page__empty {
	padding: 3rem 0;
	color: #64748B;
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	.gallery-card,
	.gallery-card img,
	.gallery-card__zoom,
	.gallery-page__more-btn {
		transition: none;
	}

	.gallery-card:hover,
	.gallery-card:hover img {
		transform: none;
	}
}
