/* ======================
   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%);
  }
}

.dapal-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  z-index: 10000;
  display: grid;
  place-items: center;
  color: #fff;
}

.dapal-lightbox::backdrop { background: transparent; }

.dapal-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 16, 20, 0.94);
}

.dapal-lightbox__frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100vw;
  max-height: 100dvh;
  min-width: 0;
}

.dapal-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 100dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.15s ease;
}

.dapal-lightbox.is-loading .dapal-lightbox__image { opacity: 0; }
.dapal-lightbox__status {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 104px);
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}
.dapal-lightbox__status[hidden], .dapal-lightbox__retry[hidden] { display: none; }
.dapal-lightbox__status::before {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: dapalPhotoLoading 0.8s linear infinite;
}
.dapal-lightbox__status.is-error::before { display: none; }
.dapal-lightbox__retry {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  color: #fff;
  background: #25353e;
  font: inherit;
  cursor: pointer;
}
.dapal-lightbox__retry:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@keyframes dapalPhotoLoading { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .dapal-lightbox__status::before { animation: none; }
  .dapal-lightbox__image { transition: none; }
}

.dapal-lightbox__info {
  position: fixed;
  left: max(4px, env(safe-area-inset-left));
  right: max(4px, env(safe-area-inset-right));
  bottom: max(4px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 4px;
  text-align: center;
  font-size: 11px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px #000;
  background: rgba(9, 16, 20, 0.28);
  border-radius: 4px;
}

.dapal-lightbox__info strong { flex: 1; min-width: 0; font-weight: 400; }
.dapal-lightbox__info [hidden] { display: none; }
.dapal-lightbox__counter { flex-shrink: 0; white-space: nowrap; font-size: 10px; opacity: 0.8; }

.dapal-lightbox__button {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  isolation: isolate;
}

.dapal-lightbox__button::before {
  content: '';
  position: absolute;
  inset: 8px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(20, 30, 34, 0.5);
}

.dapal-lightbox__button:hover::before,
.dapal-lightbox__button:focus-visible::before {
  background: #bd4e19;
}

.dapal-lightbox__button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.dapal-lightbox__close { top: max(4px, env(safe-area-inset-top)); right: max(4px, env(safe-area-inset-right)); }
.dapal-lightbox__prev { top: 50%; left: max(4px, env(safe-area-inset-left)); transform: translateY(-50%); }
.dapal-lightbox__next { top: 50%; right: max(4px, env(safe-area-inset-right)); transform: translateY(-50%); }

@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;
  }

}

@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);
  }
}
