.wrapper {
  text-align: center;
}


.photo-grid {
  display: grid;
  list-style: none;
  grid-gap: 1.5rem;
  line-height: 0;
  grid-template-columns: repeat(1, 1fr);
  grid-auto-flow: dense;
  margin-top: 4rem;
}
.photo-grid li {
  position: relative;
  --cols: 1;
  --rows: 1;

  overflow: hidden;
  background: #000;
  line-height: 0;
}
.photo-grid li:first-child {
  --cols: 2;
  --rows: 2;
}
.photo-grid li:nth-child(5) {
  --cols: 2;
}
.photo-grid li:nth-child(6) {
  --rows: 2;
  --cols: 2;
}
.photo-grid li:nth-child(7) {
  --cols: 2;
}
.photo-grid li:nth-child(12) {
  --rows: 2;
  --cols: 2;
}

.photo-grid li:nth-child(16) {
  --rows: 2;
}

.photo-grid li:nth-child(20) {
  --rows: 2;
  --cols: 2;
}

.photo-grid li:nth-child(24) {
  --cols: 2;
}

.photo-grid li:nth-child(32) {
  --rows: 2;
  --cols: 2;
}

.photo-grid li:last-child {
  --rows: 2;
  --cols: 3;;
}
.photo-grid a {
  display: block;
  height: 20rem;
}

.photo-grid figure:hover figcaption {
  opacity: 1;
}

.photo-grid figure:hover figcaption img {
  transform: translateY(-50%);
}

.photo-grid img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all .3s;
}
.photo-grid figcaption {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  color: #fff;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  line-height: 1;
  text-align: center;
  background: rgba(199,125,255, .9);
  transition: all .4s ease-in-out;
  opacity: 0;
}

.photo-grid figcaption img {
  height: 3rem;
  width: 3rem;
  margin: 0 auto;
  top: 50%;
}



@media screen and (min-width: 45em) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .photo-grid li {
    grid-column-start: span var(--cols);
    grid-row-start: span var(--rows);
  }
  .photo-grid a {
    padding-bottom: 52.65%;
    height: 10rem;
  }
}
