/* Justified-row gallery: every image in a row shares one height and keeps its
   own aspect ratio. Each item carries its ratio (width / height) as --ratio. */
.gallery {
  --row-height: 320px;
  flex-wrap: wrap;
  gap: 10px;
  display: flex;
}

/* Soaks up the spare space on the last row so it isn't stretched. */
.gallery:after {
  content: "";
  flex-grow: 1000000;
}

.gallery-item {
  flex: var(--ratio) 1 calc(var(--ratio) * var(--row-height));
  min-width: 0;
  display: block;
  position: relative;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: auto;
  transition: transform .4s;
  display: block;
}

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

.gallery-title {
  color: var(--white);
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  background-color: rgba(13, 13, 14, .6);
  justify-content: center;
  align-items: center;
  padding: 10px;
  font-family: Montserrat, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  transition: opacity .3s;
  display: flex;
  position: absolute;
  inset: 0;
  opacity: 0;
}

.gallery-item:hover .gallery-title,
.gallery-item:focus-visible .gallery-title {
  opacity: 1;
}

/* Copy protection (paired with the contextmenu/dragstart block in gallery.js). */
.gallery-item img,
.pswp__img {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.pswp__gallery-caption {
  color: var(--white);
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  pointer-events: none;
  padding: 0 20px;
  font-family: Montserrat, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
}

@media screen and (max-width: 991px) {
  .gallery {
    --row-height: 260px;
  }
}

@media screen and (max-width: 479px) {
  .gallery {
    --row-height: 200px;
  }

  .gallery-title {
    font-size: 12px;
  }
}
