.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: 200px;
  gap: 16px;
  max-width: 1400px;
  grid-auto-flow: dense;
  margin: 0 auto;
  padding: 20px 0;
}

.gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #ddd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.gallery__item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px var(--accent-color);
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery__item:hover img {
  transform: scale(1.05);
}

/* Классы для визуального разнообразия */
.gallery__item--wide {
  grid-column: span 2;
}
.gallery__item--tall {
  grid-row: span 2;
}
.gallery__item--big {
  grid-column: span 2;
  grid-row: span 2;
}

/* Адаптив: на мобильных убираем объединение ячеек */
@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    padding: 0 15px;
  }
  .gallery__item--wide,
  .gallery__item--big {
    grid-column: span 1;
  }
  .gallery__item--tall {
    grid-row: span 1;
  }
}

@media (max-width: 375px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
