.masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-gap: 16px;
  grid-auto-flow: dense;
}

.image-container {
  break-inside: avoid;
  position: relative;
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.image-container:nth-child(3n) {
  grid-row: span 2;
}

.image-container:nth-child(4n) {
  grid-column: span 2;
}

.image-link {
  display: block;
  height: 100%;
}

.image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.image-container:hover {
  transform: scale(1.01);
}

.image-container:hover .image {
  transform: scale(1.005);
}

@media (max-width: 768px) {
  .masonry {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .image-container:nth-child(3n),
  .image-container:nth-child(4n) {
    grid-row: auto;
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .masonry {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
