.gridi mg,
.grid a {
  display: block;
  height: 100%;
}

.grid img {
  max-width: 100%;
  width: 100%;
  object-fit: cover;
}

.grid {
  display: grid;
  grid-gap: 0;
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 0;
  padding-bottom: 100px;
}
.grid li {
  position: relative;
}
.grid li:hover ~ li:last-child:after,
.grid li:last-child:hover:after,
.grid li:hover ~ li:last-child:before,
.grid li:last-child:hover:before {
  opacity: 1;
  transition: 1s ease;
}
.grid li:last-child:after,
.grid li:last-child:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  pointer-events: none;
  clip-path: polygon(
    var(--offset) var(--offset),
    var(--offset) calc(100% - var(--offset)),
    calc(100% - var(--offset)) calc(100% - var(--offset)),
    calc(100% - var(--offset)) var(--offset)
  );
  -webkit-clip-path: polygon(
    var(--offset) var(--offset),
    var(--offset) calc(100% - var(--offset)),
    calc(100% - var(--offset)) calc(100% - var(--offset)),
    calc(100% - var(--offset)) var(--offset)
  );
  opacity: 0;
  transition: opacity 1s, transform 1s 1s, background 1s;
}
.grid li:last-child:after {
  mix-blend-mode: multiply;
  background: #aaafc3;
}
.grid li:last-child:before {
  backdrop-filter: grayscale(100%) blur(2px);
  -webkit-backdrop-filter: grayscale(100%) blur(2px);
}
.grid li:nth-child(1):hover ~ li:last-child:after {
  background: #555;
}
.grid li:nth-child(2):hover ~ li:last-child:after {
  background: #f1ff5c;
}
.grid li:nth-child(3):hover ~ li:last-child:after {
  background: #cdcdcd;
}
.grid li:nth-child(4):hover ~ li:last-child:after {
  background: #a5d6a7;
}
.grid li:nth-child(5):hover ~ li:last-child:after {
  background: #76a6f9;
}
.grid li:nth-child(6):hover ~ li:last-child:after {
  background: #ffc2a0;
}
.grid li:nth-child(7):hover ~ li:last-child:after {
  background: #a6f8fe;
}
.grid li:nth-child(8):hover ~ li:last-child:after {
  background: #76a6f9;
}
.grid li:last-child:hover:after {
  background: #1a237e;
}

.grid {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 33.3333333333%);
}
.grid li:last-child:after,
.grid li:last-child:before {
  left: 100%;
  transform: translate3d(-100%, -100%, 0);
}
.grid li:nth-child(1):hover ~ li:last-child:after,
.grid li:nth-child(1):hover ~ li:last-child:before {
  transform: translate3d(-200%, -200%, 0);
}
.grid li:nth-child(2):hover ~ li:last-child:after,
.grid li:nth-child(2):hover ~ li:last-child:before {
  transform: translate3d(-100%, -200%, 0);
}
.grid li:nth-child(3):hover ~ li:last-child:after,
.grid li:nth-child(3):hover ~ li:last-child:before {
  transform: translate3d(0%, -200%, 0);
}
.grid li:nth-child(4):hover ~ li:last-child:after,
.grid li:nth-child(4):hover ~ li:last-child:before {
  transform: translate3d(-200%, -100%, 0);
}
.grid li:nth-child(5):hover ~ li:last-child:after,
.grid li:nth-child(5):hover ~ li:last-child:before {
  transform: translate3d(-100%, -100%, 0);
}
.grid li:nth-child(6):hover ~ li:last-child:after,
.grid li:nth-child(6):hover ~ li:last-child:before {
  transform: translate3d(0%, -100%, 0);
}
.grid li:nth-child(7):hover ~ li:last-child:after,
.grid li:nth-child(7):hover ~ li:last-child:before {
  transform: translate3d(-200%, 0%, 0);
}

.grid li:last-child:hover:after,
.grid li:last-child:hover:before {
  transform: translate3d(-100%, 0%, 0);
}

@media (max-width: 60em) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 25%);
  }
  .grid li:last-child:after,
  .grid li:last-child:before {
    left: 0%;
    transform: translate3d(-50%, -150%, 0);
  }
  .grid li:nth-child(1):hover ~ li:last-child:after,
  .grid li:nth-child(1):hover ~ li:last-child:before {
    transform: translate3d(-100%, -300%, 0);
  }
  .grid li:nth-child(2):hover ~ li:last-child:after,
  .grid li:nth-child(2):hover ~ li:last-child:before {
    transform: translate3d(0%, -300%, 0);
  }
  .grid li:nth-child(3):hover ~ li:last-child:after,
  .grid li:nth-child(3):hover ~ li:last-child:before {
    transform: translate3d(-100%, -200%, 0);
  }
  .grid li:nth-child(4):hover ~ li:last-child:after,
  .grid li:nth-child(4):hover ~ li:last-child:before {
    transform: translate3d(0%, -200%, 0);
  }
  .grid li:nth-child(5):hover ~ li:last-child:after,
  .grid li:nth-child(5):hover ~ li:last-child:before {
    transform: translate3d(-100%, -100%, 0);
  }
  .grid li:nth-child(6):hover ~ li:last-child:after,
  .grid li:nth-child(6):hover ~ li:last-child:before {
    transform: translate3d(0%, -100%, 0);
  }
  .grid li:nth-child(7):hover ~ li:last-child:after,
  .grid li:nth-child(7):hover ~ li:last-child:before {
    transform: translate3d(-100%, 0%, 0);
  }
  .grid li:last-child:hover:after,
  .grid li:last-child:hover:before {
    transform: translate3d(0%, 0%, 0);
  }

  :root {
    --offset: 0;
  }
}
.description {
  font-family: "Unica One", sans-serif;
  font-size: 1.25rem;
  position: absolute;
  display: block;
  right: 2rem;
  left: 2rem;
  text-align: center;
  top: 50%;
  width: 60px;
  margin: auto;
  color: white;
  z-index: 100;
  opacity: 0;
  transform: translate3d(0, -50%, 0);
  transition: 0.3s 0s;
}

li:hover .description {
  opacity: 1;
  transition: 0.6s 0.3s;
}
