.projects {
  list-style: none;
  display: flex;
  overflow: hidden;
  position: relative;
}

.projects li {
  display: flex;
  justify-content: center;
  width: 100%;
}

.project-fig {
  position: relative;
}

.projects figcaption {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: absolute;
  color: #fff;
  font-weight: 600;
  font-size: 1.5em;
  top: 0;
  right: 0;
  bottom: 0px;
  left: 0;
  padding-bottom: 40px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.2);
}

.slider-buttons {
  position: absolute;
  color: #fff;
  top: 50%;
  font-size: 2rem;
  transform: translate(-50%, -50%);
  height: 100%;
  width: 10%;
}

.slider-buttons:hover {
  background: rgba(255, 255, 255, 0.1);
}

.slider-button-left {
  left: 5%;
}

.slider-button-right {
  left: 95%;
}

.projects a {
  width: 100%;
}

.projects figure {
  width: 100%;
}

.projects img {
  width: calc(100vw - (var(--padding) * 2));
}

@media screen and (min-width: 768px) {
  .projects {
    display: grid;
    list-style: none;

    line-height: 0;
    grid-template-columns: repeat(5, 1fr);
    grid-column-gap: 2rem;
    grid-row-gap: 2.5rem;
    grid-auto-flow: dense;
  }
  .projects li {
    position: relative;
    --cols: 1;
    --rows: 1;
    grid-column-start: span var(--cols);
    grid-row-start: span var(--rows);
    overflow: hidden;
    background: #000;
    line-height: 0;
    width: unset;
  }
  .projects li:first-child {
    --cols: 3;
    --rows: 2;
  }

  .projects li:nth-child(2),
  .projects li:nth-child(3) {
    --cols: 2;
    --rows: 1;
  }

  .projects li:nth-child(4) {
    --cols: 2;
    --rows: 1;
  }

  .projects li:nth-child(5) {
    --cols: 3;
    --rows: 2;
  }
  .projects li:nth-child(6) {
    --cols: 2;
  }
  .projects li:nth-child(7) {
    --cols: 2;
  }
  .projects a {
    display: block;
    height: 10rem;
    padding-bottom: 52.65%;
  }
  .projects img {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s;
    max-width: unset;
  }

  .project-fig {
    position: unset;
  }
  .projects figcaption {
    align-items: bottom;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    text-align: left;
    background: rgba(0, 0, 0, 0.5);
    padding-bottom: 1rem;
    padding-left: 1rem;
    font-size: unset;
    font-weight: unset;
    justify-content: flex-start;
  }

  .slider-buttons {
    display: none;
  }
}
