.gallery-page {
  background: var(--paper);
}

.gallery-intro {
  padding: clamp(72px, 8vw, 118px) 0 clamp(46px, 6vw, 78px);
}

.gallery-intro h1 {
  margin-top: 12px;
  color: var(--forest);
  font-size: clamp(4.5rem, 9vw, 9rem);
}

.gallery-intro > p:last-child {
  margin-top: 18px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.3vw, 2rem);
  font-style: italic;
}

.gallery {
  --gallery-gap: 12px;
  padding-bottom: clamp(80px, 10vw, 140px);
  column-count: 4;
  column-gap: var(--gallery-gap);
}

.gallery-item {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0 0 var(--gallery-gap);
  padding: 0;
  display: block;
  overflow: hidden;
  background: var(--forest);
  border: 0;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  cursor: zoom-in;
}

.gallery-item[data-reveal] {
  opacity: 1;
  transform: none;
  transition: none;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: opacity 300ms ease;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
  opacity: 0.84;
}

.gallery-item::after {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(250, 240, 225, 0.92);
  color: var(--forest);
  content: "+";
  font-size: 1.4rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms var(--ease);
}

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

.gallery-next {
  padding: 48px 0;
  background: var(--olive);
  color: var(--cream);
}

.gallery-next__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
}

.gallery-next p {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  color: var(--white);
}

.lightbox::backdrop {
  background: rgba(15, 16, 8, 0.95);
}

.lightbox__stage {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 68px 92px 52px;
  display: grid;
  place-items: center;
}

.lightbox__stage > img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.icon-button {
  position: absolute;
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(250, 240, 225, 0.1);
  border: 1px solid rgba(250, 240, 225, 0.46);
  color: var(--white);
  cursor: pointer;
  font-size: 1.4rem;
  transition: background-color 180ms ease, color 180ms ease;
}

.icon-button:hover {
  background: var(--cream);
  color: var(--forest);
}

.lightbox__close {
  top: 20px;
  right: 22px;
}

.lightbox__previous {
  top: 50%;
  left: 22px;
  transform: translateY(-50%);
}

.lightbox__next {
  top: 50%;
  right: 22px;
  transform: translateY(-50%);
}

.lightbox__counter {
  position: absolute;
  right: 0;
  bottom: 18px;
  left: 0;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

@media (max-width: 900px) {
  .gallery {
    column-count: 3;
  }
}

@media (max-width: 620px) {
  .gallery-intro {
    padding-top: 56px;
  }

  .gallery-intro h1 {
    max-width: 100%;
    font-size: clamp(3rem, 14vw, 4rem);
    letter-spacing: -0.045em;
  }

  .gallery {
    --gallery-gap: 7px;
    width: calc(100% - 20px);
    column-count: 2;
  }

  .gallery-item::after {
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    opacity: 0.88;
    transform: none;
  }

  .gallery-next__inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .lightbox__stage {
    padding: 78px 14px 66px;
  }

  .lightbox__previous,
  .lightbox__next {
    top: auto;
    bottom: 14px;
    transform: none;
  }

  .lightbox__previous {
    left: 14px;
  }

  .lightbox__next {
    right: 14px;
  }
}

@media (max-width: 360px) {
  .gallery {
    column-count: 1;
  }
}
