.gallerybox {
  padding: 90px 0;
}
.gallerybox__head {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 50px;
}
.gallerybox__head p {
  color: var(--grey);
}

.gallerybox__item {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  perspective: 1000px;
}
.gallerybox__item figure {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  width: 348px;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}
.gallerybox__item figure img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  border-radius: 8px;
  overflow: hidden;
  backface-visibility: hidden;
}
.gallerybox__item figure figcaption {
  position: absolute;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  top: 0;
  left: 0;
  padding: 40px;
  font-weight: 400;
  background-color: var(--blue4);
  color: #fff;
  border-radius: 8px;
  transform: rotateY(180deg);
  z-index: -1;
}
@media (any-hover: hover) {
  .gallerybox__item.has-desc:hover figure {
    transform: rotateY(180deg);
  }
}

.gallerybox-opts {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 50px;
}

@media screen and (max-width: 1130px) {
  .gallerybox {
    padding: 60px 0;
  }
  .gallerybox__head {
    gap: 16px;
    margin-bottom: 25px;
  }
  .gallerybox__head + .gallerybox-images {
    padding-top: 25px;
  }
  .gallerybox__desc {
    font-size: 18px;
    line-height: 130%;
  }
  .gallerybox-images {
    gap: 16px;
  }
  .gallerybox__column {
    gap: 16px;
  }
  .gallerybox__item {
    display: flex;
    justify-content: center;
  }
  .gallerybox__item figure {
    gap: 16px;
  }
  .gallerybox__item figure figcaption {
    padding: 10px 13px;
    font-size: 16px;
    line-height: 130%;
  }
  .gallerybox-opts {
    margin-top: 25px;
  }
}
@media screen and (max-width: 580px) {
  .gallerybox-images {
    flex-wrap: wrap;
  }
  .gallerybox__column {
    flex: 1 50%;
  }
  .gallerybox__column .gallerybox__item figure img {
    aspect-ratio: 4/3 !important;
  }
  .gallerybox__column:nth-child(1) .gallerybox__item:nth-child(1) figure img {
    max-height: -moz-max-content;
    max-height: max-content;
  }
  .gallerybox__column:nth-child(1) .gallerybox__item:nth-child(2) figure img {
    max-height: -moz-max-content;
    max-height: max-content;
  }
  .gallerybox__column:nth-child(2) .gallerybox__item:nth-child(1) figure {
    flex-direction: column;
  }
  .gallerybox__column:nth-child(2) .gallerybox__item:nth-child(1) figure img {
    max-height: -moz-max-content;
    max-height: max-content;
  }
  .gallerybox__column:nth-child(2) .gallerybox__item:nth-child(2) figure {
    flex-direction: column;
  }
  .gallerybox__column:nth-child(2) .gallerybox__item:nth-child(2) figure img {
    max-height: -moz-max-content;
    max-height: max-content;
  }
  .gallerybox__column:nth-child(3) .gallerybox__item:nth-child(1) figure img {
    max-height: -moz-max-content;
    max-height: max-content;
  }
  .gallerybox__column:nth-child(3) .gallerybox__item:nth-child(2) figure img {
    max-height: -moz-max-content;
    max-height: max-content;
  }
}