    body {
      margin: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
    }
.gallery {
  --s: 150px; 
  --g: 15px;

  display: grid;
  gap: var(--g);
  grid-template-columns: repeat(auto-fill, minmax(var(--s), 1fr));
  padding: 40px 20px;
  width: 100%;
  max-width: 1400px;
  box-sizing: border-box;
}

.gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
  filter: grayscale(80%);
  transition: transform 0.35s ease, filter 0.35s ease;
  display: block;
}

.gallery img:hover {
  filter: grayscale(0);
  transform: scale(1.05);
  z-index: 1;
  position: relative;
}

.gallery img {
  will-change: transform;
}
