.custom-gallery-grid.col3 {
  flex-wrap: wrap;
}

.custom-gallery-grid.col3 li {
  width: calc(33.33333% - 0.66667em);
  margin: 0 1em 1em 0;
  list-style-type: none;
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

@media screen and (min-width: 769px) {
  .custom-gallery-grid.col3 li:nth-child(3n) {
    margin-right: 0;
  }
}

@media screen and (max-width: 768px) {
  .custom-gallery-grid.col3 li {
    margin: 0 2% 2% 0;
    display: flex;
    flex-wrap: wrap;
    flex-grow: 0;
    flex-direction: column;
    justify-content: center;
    position: relative;
    width: 49%;
    box-sizing: border-box;
  }

  .custom-gallery-grid.col3 li:nth-child(2n) {
    margin-right: 0;
  }
}

.custom-gallery-grid.col3 figure {
  width: 100%;
  height: 160.95px;
  margin: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

@media screen and (max-width: 768px) {
  .custom-gallery-grid.col3 figure {
    height: 163.33px;
  }
}

@media screen and (max-width: 540px) {
  .custom-gallery-grid.col3 figure {
    height: 30.246vw;
  }
}

.custom-gallery-grid.col3 figure img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.custom-gallery-grid.col3 .caption {
  margin-top: 3px;
  text-align: center;
  font-size: 1.2rem;
}
