/* Przegladarka zdjec na telefonie (core-js/photo-viewer.js). Dolaczana w layoutach rdzenia dla stron ISP i Savio;
   siatka galerii jest osobno w core-css/gallery-mobile.css (tylko strony parafialne). */

.pv-lock,
.pv-lock body {
  overflow: hidden;
}

.pv {
  --pv-bg: 1;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
}
.pv:focus {
  outline: none;
}
.pv--open {
  display: block;
  animation: pv-in 0.22s ease-out;
}
.pv--closing {
  opacity: 0;
  transition: opacity 0.22s ease-out;
}
@keyframes pv-in {
  from { opacity: 0; }
}

.pv__bg {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: var(--pv-bg);
  touch-action: none;
}

/* Przesuwanie palcem: natywne przewijanie z przyciaganiem, po jednym zdjeciu, z odstepem jak na iPhonie. */
.pv__track {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 24px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior: contain;
  touch-action: pan-x;
  scrollbar-width: none;
}
.pv__track::-webkit-scrollbar {
  display: none;
}
.pv--zoomed .pv__track {
  overflow-x: hidden;
  touch-action: none;
}

.pv__slide {
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  background: center / contain no-repeat;
}
.pv__slide.is-loaded {
  background-image: none !important;
}
.pv__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  opacity: 0;
  transform-origin: center;
  transition: opacity 0.2s ease-out;
  will-change: transform;
}
.pv__img.is-loaded {
  opacity: 1;
}
.pv__img--anim {
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease-out;
}

.pv__bar {
  position: absolute;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  touch-action: none;
  transition: opacity 0.2s ease-out;
}
.pv__bar--top {
  top: 0;
  min-height: 64px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}
.pv__bar--bottom {
  bottom: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 28px 0 max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.65) 45%);
}
.pv--bare .pv__bar {
  opacity: 0;
  pointer-events: none;
}

.pv__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  cursor: pointer;
}
.pv__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.pv__pill {
  position: absolute;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(100% - 132px);
  padding: 6px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
  line-height: 1.25;
  text-align: center;
}
.pv__title {
  max-width: 100%;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv__title[hidden] {
  display: none;
}
.pv__count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0.85;
}
.pv__title[hidden] + .pv__count {
  font-size: 15px;
  font-weight: 600;
  opacity: 1;
}
.pv__caption {
  max-height: 30vh;
  margin: 0;
  padding: 0 20px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.4;
  text-wrap: pretty;
}

/* Pasek miniatur na dole: przewijany palcem, biezaca szersza i na srodku. */
.pv__strip {
  display: flex;
  gap: 2px;
  padding: 0 calc(50% - 26px);
  overflow-x: auto;
  overscroll-behavior: contain;
  touch-action: pan-x;
  scrollbar-width: none;
}
.pv__strip::-webkit-scrollbar {
  display: none;
}
.pv__strip[hidden],
.pv__caption[hidden] {
  display: none;
}
.pv__thumb {
  flex: 0 0 auto;
  width: 30px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  background: #222;
  opacity: 0.75;
  transition: width 0.2s ease-out, margin 0.2s ease-out, opacity 0.2s ease-out;
}
.pv__thumb.is-current {
  width: 52px;
  margin: 0 4px;
  opacity: 1;
}
.pv__strip--scrub .pv__thumb {
  transition: none;
}
.pv__strip--scrub .pv__thumb.is-current {
  width: 30px;
  margin: 0;
}
.pv__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
