/* ============================================================
   GALLERY.CSS — стилове само за страницата „Галерия"
   ------------------------------------------------------------
   Общ файл за четирите езика (bg/en/de/pl).
   Използва съществуващите цветове/шрифтове от site.css (:root).
   Masonry подредбата е реализирана чрез CSS columns, за да се
   запазят оригиналните пропорции на снимките.
   ============================================================ */

.gallery-page {
  padding: 32px 0 64px;
}

.gallery-subtitle {
  max-width: 760px;
  margin: 0 auto 30px;
  text-align: center;
  color: var(--text-light);
  font-size: 1.05rem;
  line-height: 1.6;
  text-wrap: pretty;
}

/* ------------------------------------------------------------
   MASONRY (CSS columns) — 5 колони на голям desktop
   ------------------------------------------------------------ */
.gallery-grid {
  column-count: 5;
  column-gap: 14px;
}

.gallery-grid[aria-busy="true"] {
  min-height: 240px;
}

/* Всеки елемент е бутон (за достъпно отваряне в модал) */
.gallery-item {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  padding: 0;
  border: none;
  background: var(--gray-light);
  cursor: pointer;
  break-inside: avoid;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item.is-loaded {
  opacity: 1;
}

.gallery-item:hover,
.gallery-item:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  outline: none;
}

.gallery-item:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.gallery-item-img {
  display: block;
  width: 100%;
  height: auto; /* запазва оригиналните пропорции */
}

/* Съобщение при празна галерия / неуспешно зареждане */
.gallery-empty {
  margin: 40px auto 0;
  text-align: center;
  color: var(--text-light);
  font-size: 1.05rem;
}

/* ------------------------------------------------------------
   МОДАЛ (уголемена снимка)
   ------------------------------------------------------------ */
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 54, 32, 0.92); /* var(--green-dark) с прозрачност */
}

.gallery-modal.is-open {
  display: flex;
}

.gallery-modal-img {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  background: var(--white);
}

.gallery-modal-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.gallery-modal-close:hover,
.gallery-modal-close:focus-visible {
  background: var(--orange);
  color: var(--white);
  outline: none;
}

/* Заключване на скрола на страницата, докато модалът е отворен */
body.gallery-modal-open {
  overflow: hidden;
}

/* ------------------------------------------------------------
   RESPONSIVE брой колони
   ------------------------------------------------------------ */
@media (max-width: 1200px) {
  .gallery-grid { column-count: 4; }
}

@media (max-width: 900px) {
  .gallery-grid { column-count: 3; }
}

@media (max-width: 600px) {
  .gallery-grid {
    column-count: 2;
    column-gap: 10px;
  }
  .gallery-item { margin-bottom: 10px; }
  .gallery-modal-close {
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
}
