/* Public gallery and lightbox. */
@layer pages {

.gallery-grid {
  columns: 2 12rem;
  column-gap: var(--space-3);
}
@media (min-width: 900px) {
  .gallery-grid {
    columns: 4 14rem;
  }
}
.gallery-item {
  break-inside: avoid;
  margin-bottom: var(--space-3);
}
.gallery-link {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--color-sand);
  cursor: zoom-in;
}
.gallery-link img {
  width: 100%;
  height: auto;
  transition: transform 0.8s var(--ease);
}
.gallery-link:hover img,
.gallery-link:focus-visible img {
  transform: scale(1.04);
}
.gallery-caption {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ---- lightbox ---- */
.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(6 18 12 / 0.96);
  color: var(--color-on-dark);
}
.lightbox[open] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: center;
}
.lightbox::backdrop {
  background: rgb(6 18 12 / 0.9);
}
.lightbox-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-5);
}
.lightbox-count {
  font-size: var(--text-sm);
  color: var(--color-on-dark-muted);
}
.lightbox-figure {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding-bottom: var(--space-4);
}
.lightbox-figure img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 9rem);
  object-fit: contain;
  border-radius: var(--radius);
}
.lightbox-figure figcaption {
  text-align: center;
  color: var(--color-on-dark-muted);
}
.lightbox-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--color-line-on-dark);
  border-radius: 50%;
  background: rgb(var(--rgb-white) / 0.06);
  color: var(--color-on-dark);
  cursor: pointer;
}
.lightbox-btn:hover {
  background: var(--color-accent);
  color: var(--color-night);
}
.lightbox-prev {
  grid-column: 1;
  grid-row: 2;
  margin-inline: var(--space-4);
}
.lightbox-next {
  grid-column: 3;
  grid-row: 2;
  margin-inline: var(--space-4);
}
@media (max-width: 700px) {
  .lightbox[open] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .lightbox-figure {
    grid-column: 1;
    padding-inline: var(--space-3);
  }
  .lightbox-prev,
  .lightbox-next {
    position: absolute;
    bottom: var(--space-4);
    margin: 0;
  }
  .lightbox-prev { left: var(--space-4); }
  .lightbox-next { right: var(--space-4); }
  .lightbox-figure img {
    max-height: calc(100dvh - 12rem);
  }
}

} /* end @layer pages */
