/* =========================================================
   WSPÓLNY LIGHTBOX ZDJĘĆ
========================================================= */

.lightbox[hidden] {
  display: none !important;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 58px 20px 24px;
  overflow: auto;
  background: rgba(3, 9, 20, 0.94);
  backdrop-filter: blur(5px);
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox-figure {
  display: flex;
  max-width: 1200px;
  max-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
}

.lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(1200px, 100%);
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 12px;
  background: #081223;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  max-width: 900px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}

.lightbox-caption:empty {
  display: none;
}

.lightbox-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 10001;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(8, 18, 35, 0.88);
  color: #fff;
  font: inherit;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  border-color: #ff8a00;
  background: #ff8a00;
  color: #111;
}

.lightbox-close:focus-visible {
  outline: 3px solid rgba(255, 138, 0, 0.55);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .lightbox {
    padding: 68px 12px 20px;
  }
  .lightbox-img {
    max-height: calc(100vh - 130px);
    border-radius: 9px;
  }
  .lightbox-caption {
    font-size: 0.85rem;
  }
  .lightbox-close {
    top: 12px;
    right: 12px;
  }
}

/* =========================================================
   LEKKI LIGHTBOX GALERII REALIZACJI
========================================================= */

.gallery-lightbox[hidden] {
  display: none !important;
}

.gallery-lightbox {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 9, 18, 0.94);
  backdrop-filter: blur(5px);
}

.gallery-lightbox-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 14px;
  align-items: center;
  width: min(1180px, 100%);
  max-height: calc(100vh - 48px);
}

.gallery-lightbox-figure {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: #081223;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.gallery-lightbox-image-wrap {
  position: relative;
  display: grid;
  min-height: 240px;
  place-items: center;
  background: #050b14;
}

.gallery-lightbox-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  opacity: 1;
  transition: opacity 0.16s ease;
}

.gallery-lightbox.is-loading .gallery-lightbox-image {
  opacity: 0;
}

.gallery-lightbox-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ff8a00;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: gallery-lightbox-spin 0.8s linear infinite;
}

.gallery-lightbox.is-loading .gallery-lightbox-loader {
  display: block;
}

.gallery-lightbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 15px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  background: #081223;
}

.gallery-lightbox-caption {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.45;
}

.gallery-lightbox-counter {
  flex: 0 0 auto;
  color: #ffad42;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(8, 18, 35, 0.9);
  color: #fff;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.gallery-lightbox-close {
  position: absolute;
  z-index: 3;
  top: -17px;
  right: -17px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.gallery-lightbox-nav {
  width: 52px;
  height: 58px;
  border-radius: 14px;
  font-size: 1.7rem;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-nav:hover {
  border-color: #ff8a00;
  background: #ff8a00;
  color: #111;
}

.gallery-lightbox-close:focus-visible,
.gallery-lightbox-nav:focus-visible {
  outline: 3px solid #ffad42;
  outline-offset: 3px;
}

body.gallery-lightbox-open {
  overflow: hidden;
}

@keyframes gallery-lightbox-spin {
  to {
    transform:
      translate(-50%, -50%)
      rotate(360deg);
  }
}

@media (max-width: 760px) {
  .gallery-lightbox {
    padding: 14px;
  }
  .gallery-lightbox-dialog {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: stretch;
    max-height: calc(100vh - 28px);
  }
  .gallery-lightbox-figure {
    grid-column: 1 / -1;
    grid-row: 1;
    border-radius: 15px;
  }
  .gallery-lightbox-image {
    max-height: calc(100vh - 175px);
  }
  .gallery-lightbox-prev {
    grid-column: 1;
    grid-row: 2;
  }
  .gallery-lightbox-next {
    grid-column: 2;
    grid-row: 2;
  }
  .gallery-lightbox-nav {
    width: 100%;
    height: 46px;
  }
  .gallery-lightbox-close {
    top: 8px;
    right: 8px;
    width: 42px;
    height: 42px;
  }
  .gallery-lightbox-footer {
    align-items: flex-start;
    min-height: 0;
    flex-direction: column;
    gap: 5px;
    padding: 13px 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-lightbox-image,
  .gallery-lightbox-close,
  .gallery-lightbox-nav {
    transition: none;
  }
  .gallery-lightbox-loader {
    animation-duration: 1.5s;
  }
}