/* ============================================================
   GALERIA.CSS — Style dla strony galerii ośrodka (strony/galeria.php)
   Mobile-first. Breakpointy spójne z resztą strony: 768px / 1024px
   ============================================================ */

/* ===== FILTRY KATEGORII ===== */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
  margin: 0 0 var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.gallery-filter {
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: transparent;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  transition: color var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.gallery-filter:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.gallery-filter.is-active {
  color: #fff;
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-gold);
}

.gallery-filter.is-active:hover {
  color: #fff;
}

/* ===== SIATKA GALERII (masonry przez CSS columns) ===== */
.gallery-grid {
  column-count: 1;             /* mobile: jeden układ kolumnowy (1 kolumna) */
  column-gap: var(--space-md);
}

.gallery-item {
  break-inside: avoid;         /* nie dziel figury między kolumnami */
  margin: 0 0 var(--space-md);
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-dark-card);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-slow);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text-light);
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.75) 100%
  );
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--transition-normal),
    transform var(--transition-normal);
  pointer-events: none;
}

.gallery-item:hover figcaption,
.gallery-item:focus-within figcaption {
  opacity: 1;
  transform: translateY(0);
}

/*Hover tylko na urządzeniach z precyzyjnym wskaźnikiem */
@media (hover: none) {
  .gallery-item figcaption {
    opacity: 1;
    transform: translateY(0);
  }
  .gallery-item:hover img {
    transform: none;
  }
}

/* ===== LIGHTBOX ===== */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 13, 12, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

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

.lightbox-figure {
  max-width: 92vw;
  max-height: 82vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-figure img {
  max-width: 92vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}

.lightbox-figure figcaption {
  margin-top: var(--space-sm);
  font-size: var(--fs-small);
  color: var(--text-muted-light);
  text-align: center;
  font-family: var(--font-sans);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-dark);
}

.lightbox-close {
  top: var(--space-md);
  right: var(--space-md);
}

.lightbox-prev {
  left: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
}

/* ===== BREAKPOINT: tablet (>=768px) ===== */
@media (min-width: 768px) {
  .gallery-grid {
    column-count: 2;
    column-gap: var(--space-lg);
  }

  .gallery-item {
    margin-bottom: var(--space-lg);
  }

  .gallery-filter {
    font-size: var(--fs-body);
    padding: 0.55rem 1.25rem;
  }

  .lightbox-close,
  .lightbox-prev,
  .lightbox-next {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
  }
}

/* ===== BREAKPOINT: desktop (>=1024px) ===== */
@media (min-width: 1024px) {
  .gallery-grid {
    column-count: 3;
    column-gap: var(--space-xl);
  }

  .gallery-item {
    margin-bottom: var(--space-xl);
  }

  .lightbox-prev {
    left: var(--space-xl);
  }

  .lightbox-next {
    right: var(--space-xl);
  }
}

/* ===== Dostępność: redukcja ruchu ===== */
@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item img,
  .gallery-item figcaption {
    transition: none;
  }
  .gallery-item:hover img {
    transform: none;
  }
}
