.gallery-intro {
  padding-bottom: 2rem;
}

.gallery-intro__inner {
  display: grid;
  grid-template-columns: minmax(18rem, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 8vw, 9rem);
  align-items: end;
}

.gallery-intro .section-title {
  max-width: 10ch;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.gallery-filter {
  border: 0.08rem solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: 700 0.8rem/1 var(--ff-body);
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
}

.gallery-filter:hover,
.gallery-filter:focus-visible,
.gallery-filter.is-active {
  border-color: var(--cypress);
  background: var(--cypress);
  color: var(--on-dark);
}

.gallery-field {
  padding: 2rem 0 var(--section-space);
}

.gallery-columns {
  columns: 4 16rem;
  column-gap: 0.8rem;
}

.gallery-item {
  position: relative;
  width: 100%;
  display: block;
  break-inside: avoid;
  overflow: hidden;
  border: 0;
  background: var(--stone);
  cursor: zoom-in;
  margin: 0 0 0.8rem;
  padding: 0;
}

.gallery-item[hidden] {
  display: none;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 500ms var(--ease);
}

.gallery-item::after {
  content: "+";
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 36, 29, 0.92);
  color: var(--white);
  font-size: 1.35rem;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 250ms ease, transform 250ms ease;
}

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

.gallery-item:hover::after,
.gallery-item:focus-visible::after {
  opacity: 1;
  transform: none;
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  border: 0;
  background: rgba(7, 18, 14, 0.98);
  color: var(--white);
  padding: clamp(4.5rem, 8vw, 6.5rem) clamp(3.7rem, 8vw, 8rem) 2rem;
}

.lightbox::backdrop {
  background: rgba(7, 18, 14, 0.96);
}

.lightbox[open] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  place-items: center;
}

.lightbox figure {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  margin: 0;
}

.lightbox figure img {
  max-width: 100%;
  max-height: calc(100dvh - 9rem);
  object-fit: contain;
}

.lightbox figcaption {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.8rem;
  padding-top: 0.7rem;
}

.lightbox__close,
.lightbox__nav {
  border: 0;
  background: transparent;
  color: var(--white);
  cursor: pointer;
}

.lightbox__close {
  position: fixed;
  z-index: 2;
  top: 1.25rem;
  right: 1.5rem;
  border: 0.06rem solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  font: 700 0.75rem/1 var(--ff-body);
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
}

.lightbox__close span {
  margin-left: 0.35rem;
  font-size: 1.1rem;
}

.lightbox__nav {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  font-size: 1.4rem;
}

@media (max-width: 760px) {
  .gallery-intro__inner {
    grid-template-columns: 1fr;
  }

  .gallery-filters {
    justify-content: flex-start;
  }

  .gallery-columns {
    columns: 2 9rem;
    column-gap: 0.45rem;
  }

  .gallery-item {
    margin-bottom: 0.45rem;
  }

  .lightbox {
    padding: 4.8rem 0.8rem 1rem;
  }

  .lightbox[open] {
    grid-template-columns: 2.7rem minmax(0, 1fr) 2.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item img,
  .gallery-item::after {
    transition: none;
  }
}
