.gallery {
  margin: 0 auto;
  max-width: 1440px;
  padding: 120px 135px 125px;
  box-sizing: border-box;
}

@media (max-width: 1279px) {
  .gallery {
    padding: 50px 75px;
  } 
}

@media (max-width: 650px) {
  .gallery {
    padding: 30px;
  } 
}

.gallery__headline {
  margin: 0 0 40px 0;
}

.gallery__headline p {
  margin: 0;
}

.gallery__items {
  display: grid;
  grid-gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 651px) and (max-width: 1024px) {
  .gallery__items {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 650px) {
  .gallery__items {
    grid-template-columns: 1fr;
  }
}

.gallery__item {
  cursor: pointer;
}

.gallery__image {
  cursor: pointer;
}

.gallery__image img {
  width: 100%;
  height: auto;
}

.gallery__modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top:0;
  width: 100%;
  height: 100%;
  overflow: auto;
  cursor: pointer;
  background-color: rgba(0,0,0,0.85);
}

.gallery__modal-content {
  display: block;
  position: absolute;
  max-width: 1440px;
  z-index: 2;
  padding: 0;
  left: 50%;
  top:25%;
  transform: translate(-50%, -25%);
  margin: 100px 0;
}

@media (max-width: 1024px) {
  .gallery__modal-content {
    width: 80%;
  }
}

.gallery__modal-image img {
  display: block;
  margin: auto;
  width: 100%;
  height: auto;
}

.gallery--with-modal img {
  cursor: pointer;
}

.gallery__modal-close {
  position: absolute;
  top: 0;
  right: -35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}

.gallery__modal-close:hover,
.gallery__modal-close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

.gallery__modal-caption {
  color: #fff;
}