/**
 * Public card page (card.html): gallery lightbox + zoom affordance.
 * Loaded only with card.html.
 */

#card-mount .tpl-gallery img,
#card-mount .tpl-gallery-grid img,
#card-mount .bc-t3-gallery-host img,
#card-mount .bc-t4-gallery-host img,
#card-mount .pub-carousel-main img,
body.panel-page .preview-card-wrap .tpl-gallery-grid img,
body.panel-page .preview-card-wrap .bc-t3-gallery-host img,
body.panel-page .preview-card-wrap .bc-t4-gallery-host img {
  cursor: zoom-in;
}

.bc-gal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
  box-sizing: border-box;
}

.bc-gal-lightbox.is-open {
  display: flex;
}

.bc-gal-lightbox__panel {
  position: relative;
  width: min(96vw, 1100px);
  height: min(88vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bc-gal-lightbox__img {
  max-width: 100%;
  max-height: min(88vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  user-select: none;
  -webkit-user-drag: none;
}

.bc-gal-lightbox__close {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 8px));
  right: max(8px, env(safe-area-inset-right, 8px));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
}

.bc-gal-lightbox__close:hover,
.bc-gal-lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.bc-gal-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
}

.bc-gal-lightbox__nav:hover,
.bc-gal-lightbox__nav:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.bc-gal-lightbox__nav--prev {
  left: max(6px, env(safe-area-inset-left, 6px));
}

.bc-gal-lightbox__nav--next {
  right: max(6px, env(safe-area-inset-right, 6px));
}

.bc-gal-lightbox__nav[hidden] {
  display: none !important;
}

.bc-gal-lightbox__foot {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom, 10px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  z-index: 2;
  width: min(92vw, 320px);
}

.bc-gal-lightbox__count {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.04em;
}

.bc-gal-lightbox__listing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  background: #2563eb;
  color: #fff !important;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

.bc-gal-lightbox__listing:hover,
.bc-gal-lightbox__listing:focus-visible {
  background: #1d4ed8;
  outline: none;
}

.bc-gal-lightbox__listing[hidden] {
  display: none !important;
}

.tpl-gal-cell--linked img,
.tpl-gallery-grid img,
.bc-t3-gallery-host img,
.bc-t4-gallery-host img {
  cursor: zoom-in;
}
