/* ======================
   ГАЛЕРИЯ (изолиран блок)
   ====================== */

/* локални CSS променливи само за галерията */
.gallery{
  background-color: #4b654b;;
  --gap: 14px;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  --shadow-hover: 0 14px 30px rgba(0,0,0,.18), 0 6px 12px rgba(0,0,0,.10);
  --ring: #007400;         
  --maxw: 1500px;          

  max-width: var(--maxw);
  margin: 10px auto;
  padding: 0 16px;
}

.gallery__title{
  color: #fff;
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 600;
}

/* мрежа */
.gallery__grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
  perspective: 1000px;
  padding: 40px;
}

/* елемент от галерията */
.gallery__item{
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transform: translateZ(0);
  transition:
    transform .22s ease,
    box-shadow .22s ease,
    outline-color .22s ease,
    outline-offset .22s ease;
  outline: 2px solid transparent;
  outline-offset: -2px;
  will-change: transform;
}

.gallery__item img{
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 4/ 3;
  object-fit: cover;
}

/* ефект при задържане или фокус */
.gallery__item:hover,
.gallery__item:focus-within{
  transform: translateY(-6px) translateZ(18px) scale(1.03);
  box-shadow: var(--shadow-hover);
  outline-color: color-mix(in srgb, var(--ring) 75%, transparent);
  z-index: 2;
}

/* модификатори за размер */
.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; }

.gallery__grid {
  display: grid;
  gap: 40px; /* расстояние между фото */
  grid-template-columns: repeat(4, 1fr); /* по умолчанию 4 в ряд на больших экранах */
}

.gallery__item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* Когда ширина экрана меньше 768px — показываем по 2 фото в ряд */
@media (max-width: 768px) {
  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* На совсем маленьких экранах (например, телефоны до 480px) — можно по 1 */
@media (max-width: 300px) {
  .gallery__grid {
    grid-template-columns: 1fr;
  }
}



/* по-малко анимация, ако е настроено в ОС */
@media (prefers-reduced-motion: reduce){
  .gallery__item{ transition: none; }
}
