/*
 * Image viewer (/scripts/viewer.js, approved design docs/design/mockups/viewer): PhotoSwipe 5 themed
 * to the site, loaded after /styles/photoswipe.css.
 * Always dark (photos read best on a dark backdrop), same in light and dark theme.
 * Buttons: 44 px round, dark translucent with a thin edge (readable over white screenshots); icons: the site stroke icons.
 */
.pswp {
  --pswp-bg: #111827;
  --pswp-placeholder-bg: #1f2937;
  --pswp-icon-color: #fff;
  --pswp-error-text-color: rgb(255 255 255 / 0.75);
  --pswp-root-z-index: 50;
  font-family: var(--ni-font-sans);
}

/* top bar: counter · (loading) · zoom · close. Controls carry their own dark backing,
   so they stay readable over bright photos and white screenshots. */
.pswp__top-bar {
  height: auto;
  align-items: center;
  gap: 0.5rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) 0.75rem 0;
}
.pswp__counter {
  height: auto;
  margin: 0 auto 0 0;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background: rgb(17 24 39 / 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  font-variant-numeric: tabular-nums;
  text-shadow: none;
  opacity: 0.9;
}
.pswp__button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 0.16);
  background: rgb(17 24 39 / 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  opacity: 1;
  transition: background-color 0.15s;
}
.pswp__button:hover,
.pswp__button:active,
.pswp__button:focus { border: 1px solid rgb(255 255 255 / 0.16); background: rgb(55 65 81 / 0.85); }
.pswp__button:focus-visible { outline: 2px solid var(--ni-color-secondary); outline-offset: 2px; }
.pswp__button--close { margin: 0; }
.pswp .pswp__icn {
  position: static;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  color: #fff;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: none;
}

/* zoom button: magnifier with "+", "−" when zoomed in */
.pswp__button--zoom .ni-pv-plus { display: inline; }
.pswp--zoomed-in .pswp__button--zoom .ni-pv-plus { display: none; }

/* previous / next: mouse only (phones swipe), hidden at the ends and with one image */
.pswp__button--arrow {
  width: 3rem;
  height: 3rem;
  margin-top: -1.5rem;
}
.pswp__button--arrow--prev { left: 1rem; }
.pswp__button--arrow--next { right: 1rem; }
.pswp__button--arrow .pswp__icn { width: 1.5rem; height: 1.5rem; margin: 0; }
.pswp__button--arrow--next .pswp__icn { transform: none; }

/* loading: small ring next to the counter (shown after 1 s) */
.pswp__preloader { width: 2.75rem; height: 2.75rem; margin: 0; display: grid; place-items: center; }
.pswp__preloader .pswp__icn { width: 1.25rem; height: 1.25rem; }
.pswp__preloader .pswp__icn circle { opacity: 0.3; }

/* caption (figure caption, else image description) */
.ni-pv-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 2.5rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  background: linear-gradient(rgb(17 24 39 / 0), rgb(17 24 39 / 0.88) 45%);
  color: rgb(255 255 255 / 0.92);
  font-size: 0.9375rem;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
.ni-pv-caption p {
  max-width: 42rem;
  margin: 0 auto;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ni-pv-caption[hidden] { display: none; }
/* zoomed in, or moved down a long image: the caption steps aside */
.ni-pv-caption { transition: opacity 0.2s; }
.pswp--zoomed-in .ni-pv-caption,
.ni-pv-scrolled .ni-pv-caption { opacity: 0; }

/* where you are in a tall image (long screenshots, zoomed-in photos) */
.ni-pv-track {
  position: absolute;
  top: 50%;
  right: 0.375rem;
  width: 0.25rem;
  height: 40vh;
  margin-top: -20vh;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.16);
  pointer-events: none;
}
.ni-pv-track[hidden] { display: none; }
.ni-pv-thumb { position: absolute; left: 0; right: 0; top: 0; min-height: 1.5rem; border-radius: inherit; background: rgb(255 255 255 / 0.7); }

.pswp__error-msg { font-size: 0.9375rem; color: var(--pswp-error-text-color); }

/* wide screens: the caption sits under the image, on the backdrop */
@media (min-width: 48rem) {
  .ni-pv-caption { padding: 0 2rem 1.25rem; background: none; }
  .ni-pv-caption p { width: fit-content; padding: 0.375rem 0.875rem; border-radius: var(--ni-radius-sm); background: rgb(17 24 39 / 0.72); -webkit-line-clamp: 2; }
}
@media (max-width: 47.99rem) {
  .pswp__top-bar { padding-inline: 0.5rem; }
}
