/* ======================
   GALERIA DAPAL — osobny CSS ładowany tylko na stronach z galerią
====================== */

.gallery-grid-section {
  padding: 30px 0;
  background: #fff;
}

.gallery-title {
  text-align: center;
  color: #000;
  margin-bottom: 15px;
  font-size: 1.5em;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #faf9f6;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  aspect-ratio: 4 / 3;
  transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  filter: brightness(1.05);
}

.gallery-item a {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item.fade-in {
  opacity: 0;
  animation: galleryFadeIn 0.45s ease forwards;
}

@keyframes galleryFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.load-more-btn {
  position: relative;
  overflow: hidden;
  display: block;
  margin: 32px auto 0;
  padding: 14px 30px;
  font-size: 1.1em;
  font-weight: 700;
  background: #89c789;
  color: #fff;
  border: none;
  border-radius: 30px;
  box-shadow: 0 4px 14px rgba(137, 199, 137, 0.25);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.load-more-btn:hover:not(:disabled),
.load-more-btn:focus:not(:disabled) {
  background: #6fb56f;
  transform: scale(1.04);
}

.load-more-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}

.gallery-end-message {
  margin-top: 18px;
  text-align: center;
  color: #666;
  font-weight: 600;
}

.gallery-sentinel {
  width: 100%;
  height: 1px;
}

.gallery-item--skeleton {
  background-color: #f1eee8;
}

.gallery-item--skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: galleryShimmer 1.4s infinite;
}

@keyframes galleryShimmer {
  100% {
    transform: translateX(300%);
  }
}

/* GLightbox: caption */
.glightbox-clean .gslide-description.description-bottom {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 92%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  padding: 0 !important;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  text-align: center;
  z-index: 99;
  backdrop-filter: blur(3px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glightbox-clean .gslide-description.description-bottom .gdesc-inner {
  padding: 4px 12px !important;
  color: #fff !important;
}

.glightbox-caption {
  display: none !important;
}

.glightbox-clean .gslide-title {
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.2;
}

/* Pozwól Lightboxowi przechwytywać swipe i pinch-zoom */
.glightbox-container,
.glightbox-container .gslider,
.glightbox-slide {
  touch-action: pan-y pinch-zoom;
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .load-more-btn {
    width: 100%;
    max-width: 320px;
    font-size: 1em;
  }

  .glightbox-clean .gslide-description.description-bottom {
    font-size: 0.85rem;
    bottom: 10px;
    max-width: 95%;
  }
}

@media (min-width: 601px) and (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1025px) {
  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .gallery-item {
    border: 1px solid rgba(0, 0, 0, 0.08);
  }
}
