/*Gallery*/

.gallery {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: auto;
  grid-auto-flow: dense;
  gap: 6px;
  padding-inline: va(--content-padding-inline);
  margin-block: 1rem 2rem;
}

.gallery a {
  position: relative;
  display: block;
}

.gallery__credit {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 0.2em 0.6em;
  font-family: "Carlito", sans-serif;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery a:hover .gallery__credit,
.gallery a:focus-within .gallery__credit {
  opacity: 1;
}

img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
}

.lightbox:target {
  display: flex;
}

.lightbox figure {
  margin: 0;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox img {
  display: block;
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox figcaption {
  margin-top: 0.5em;
  color: #fff;
  font-family: "Carlito", sans-serif;
  font-size: 0.9rem;
  text-align: center;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: fixed;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
  padding: 0.5em 0.75em;
  z-index: 101;
}

.lightbox__close { top: 1rem; right: 1rem; }
.lightbox__prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 1rem; top: 50%; transform: translateY(-50%); }

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  opacity: 0.7;
}

a.four-grid-cells {
  grid-row: span 2 / auto;
  grid-column: span 2 / auto;
}

a.wide-image {
  grid-column: span 2 / auto;
}

@media screen and (max-width: 768px) {
  .gallery {
    grid-template-columns: 1fr 1fr;
  }
}

@media screen and (max-width: 480px) {

  /* changes the grid layout to a single column */
  div.gallery {
    grid-template-columns: 1fr;
  }

  /* resets the grid placement properties for
  the images spanning four grid cells */
  a.four-grid-cells {
    grid-row: auto;
    grid-column: auto;
  }

  /* resets the grid placement properties for
  the images spanning two grid columns  */
  a.wide-image {
    grid-column: auto;
  }

}
