/* Shared, accessible gallery preview for the Południowa 4 page. */
.gallery-lightbox-trigger {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  background: var(--sand);
  border-radius: var(--radius-sm);
}

.gallery-lightbox-trigger::after {
  content: "Powiększ";
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 7px 11px;
  color: var(--brand);
  background: rgb(255 255 255 / 94%);
  border-radius: 7px;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.4;
}

.gallery-lightbox-trigger:hover::after { color: #fff; background: var(--brand); }
.gallery--lewkow > .gallery-lightbox-trigger img { display: block; width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery--lewkow > .gallery-lightbox-trigger:first-child { grid-column: 1 / -1; }
.gallery--lewkow > .gallery-lightbox-trigger:first-child img { aspect-ratio: 16 / 8; }
.interior-grid figure > .gallery-lightbox-trigger { border-radius: 0; }
.interior-grid figure > .gallery-lightbox-trigger img { display: block; }
.gallery-lightbox-trigger:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.gallery-lightbox {
  inset: 0;
  box-sizing: border-box;
  width: min(1180px, calc(100vw - 40px));
  max-width: none;
  height: auto;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--brand);
  background: #fff;
  border: 0;
  border-radius: 14px;
  outline: 0;
  box-shadow: 0 24px 80px rgb(11 18 40 / 32%);
}

.gallery-lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(820px, calc(100dvh - 40px));
}

.gallery-lightbox--fallback {
  position: fixed;
  z-index: 1000;
}

.gallery-lightbox--fallback::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background: rgb(15 22 43 / 78%);
  content: "";
}

.gallery-lightbox::backdrop { background: rgb(15 22 43 / 78%); backdrop-filter: blur(2px); }

.gallery-lightbox-head,
.gallery-lightbox-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  background: #fff;
}

.gallery-lightbox-head { min-height: 66px; border-bottom: 1px solid var(--line); }
.gallery-lightbox-title { margin: 0; color: var(--navy); font-size: 1rem; font-weight: 650; line-height: 1.45; }

.gallery-lightbox-close,
.gallery-lightbox-nav button {
  display: inline-flex;
  min-width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  color: var(--brand);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  font-size: .875rem;
  font-weight: 650;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.gallery-lightbox-close { gap: 10px; }
.gallery-lightbox-close b { font-size: 1.35rem; font-weight: 400; line-height: 1; }
.gallery-lightbox-close:hover,
.gallery-lightbox-nav button:hover { color: #fff; background: var(--navy); border-color: var(--navy); }

.gallery-lightbox-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #eef0f4;
  touch-action: pan-y;
}

.gallery-lightbox-stage img {
  position: absolute;
  inset: 12px;
  display: block;
  width: calc(100% - 24px) !important;
  height: calc(100% - 24px) !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center !important;
  opacity: 1;
  transition: opacity 160ms ease;
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-lightbox.is-loading .gallery-lightbox-stage img,
.gallery-lightbox.has-error .gallery-lightbox-stage img { opacity: 0; }

.gallery-lightbox-status {
  position: absolute;
  inset: 50% auto auto 50%;
  display: none;
  max-width: min(420px, calc(100% - 40px));
  margin: 0;
  color: var(--ink-soft);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
  transform: translate(-50%, -50%);
}

.gallery-lightbox.is-loading .gallery-lightbox-status,
.gallery-lightbox.has-error .gallery-lightbox-status { display: block; }

.gallery-lightbox.is-loading .gallery-lightbox-status::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border: 3px solid rgb(39 51 97 / 18%);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: gallery-spin 720ms linear infinite;
}

.gallery-lightbox-foot { min-height: 66px; border-top: 1px solid var(--line); }
.gallery-lightbox-original { display: inline-flex; min-height: 44px; align-items: center; gap: 7px; color: var(--brand); font-size: .875rem; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.gallery-lightbox-nav { display: flex; align-items: center; gap: 8px; }
.gallery-lightbox-count { min-width: 96px; color: var(--ink-soft); font-size: .875rem; text-align: center; }
body.gallery-lightbox-open { overflow: hidden; }

@keyframes gallery-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .gallery-lightbox { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); border-radius: 10px; }
  .gallery-lightbox[open] { height: calc(100dvh - 12px); }
  .gallery-lightbox-head,
  .gallery-lightbox-foot { padding: 8px 10px; }
  .gallery-lightbox-head { min-height: 60px; }
  .gallery-lightbox-title { max-width: calc(100% - 58px); font-size: .875rem; }
  .gallery-lightbox-close { width: 48px; padding-inline: 0; }
  .gallery-lightbox-close span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .gallery-lightbox-stage { min-height: 0; }
  .gallery-lightbox-stage img { inset: 6px; width: calc(100% - 12px) !important; height: calc(100% - 12px) !important; }
  .gallery-lightbox-foot { min-height: 106px; flex-wrap: wrap; }
  .gallery-lightbox-original { order: 2; width: 100%; justify-content: center; }
  .gallery-lightbox-nav { width: 100%; justify-content: space-between; }
  .gallery--lewkow { grid-template-columns: minmax(0, 1fr); }
  .gallery--lewkow > .gallery-lightbox-trigger:first-child { grid-column: auto; }
  .gallery--lewkow > .gallery-lightbox-trigger:first-child img { aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-lightbox-trigger img,
  .gallery-lightbox-stage img { transition: none !important; }
  .gallery-lightbox.is-loading .gallery-lightbox-status::before { animation: none; }
}
