main.page-gallery {
  padding-top: var(--nav-h-desktop);
}

@media (max-width: 1023px) {
  main.page-gallery {
    padding-top: var(--nav-h-mobile);
  }
}

.gallery-hero {
  height: 30vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--charcoal);
  padding: 48px 24px;
}

.gallery-hero .h1 {
  color: var(--linen);
  margin-bottom: 12px;
}

.gallery-hero__sub {
  color: var(--caption-dark);
  font-size: 16px;
  margin: 0;
}

.gallery-masonry {
  background: var(--linen);
  padding: 40px 24px 80px;
  column-count: 3;
  column-gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 1023px) {
  .gallery-masonry {
    column-count: 2;
    column-gap: 10px;
    padding: 24px 24px 48px;
  }
}

@media (max-width: 767px) {
  .gallery-masonry {
    column-count: 1;
    column-gap: 0;
    padding: 16px 16px 48px;
  }
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

@media (max-width: 1023px) {
  .gallery-item {
    margin-bottom: 10px;
  }
}

@media (max-width: 767px) {
  .gallery-item {
    margin-bottom: 8px;
  }
}

.gallery-item--loading {
  min-height: 160px;
  background: var(--mist);
  animation: phPulse 1.2s ease-in-out infinite;
}

@keyframes phPulse {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}

.gallery-item img {
  width: 100%;
  display: block;
  transition: filter 300ms ease, transform 300ms ease;
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-radius: 8px;
  pointer-events: none;
  transition: border-color 300ms ease;
  z-index: 1;
}

.gallery-item:hover img {
  filter: brightness(0.85);
  transform: scale(1.03);
}

.gallery-item:hover::after {
  border-color: var(--sage);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(26, 26, 26, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 48px;
  height: 48px;
  color: var(--linen);
  font-size: 32px;
  line-height: 1;
  z-index: 2;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 248, 240, 0.15);
  color: var(--linen);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 200ms ease;
}

.lightbox__nav:hover {
  background: rgba(255, 248, 240, 0.3);
}

.lightbox__nav--prev {
  left: 16px;
}

.lightbox__nav--next {
  right: 16px;
}

@media (max-width: 767px) {
  .lightbox__nav {
    display: none;
  }
}
