.image-gallery {
  display: flex;
  flex-wrap: wrap;
}

.image-gallery__item {
  position: relative;
  display: block;
  flex: 0 0 25%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.image-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-gallery__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgb(32 32 32 / 40%);
  opacity: 0;
  transition: opacity 0.6s;
}

.image-gallery__item:hover::after {
  opacity: 1;
}

@media (max-width: 1024px) {
  .image-gallery__item { flex-basis: 50%; }
}

@media (max-width: 680px) {
  .image-gallery__item { flex-basis: 100%; }
}
