/* Image viewer; paired with assets/site/lightbox.js. */

html.lb-lock,
html.lb-lock body {
  overflow: hidden;
}

img.lightbox-enabled {
  cursor: zoom-in;
}

.lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  --fade: 1;
}

.lb.is-open {
  display: flex;
  flex-direction: column;
}

.lb.is-closing {
  pointer-events: none;
}

.lb__stage,
.lb__bar {
  cursor: zoom-out;
}

.lb__cap {
  cursor: auto;
}

.lb.is-closing .lb__img {
  transition: transform 0.22s cubic-bezier(0.3, 0, 0.2, 1);
}

.lb__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 14, 20, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: var(--fade);
  animation: lb-fade 0.28s ease;
}

.lb.is-closing .lb__backdrop,
.lb.is-closing .lb__bar,
.lb.is-closing .lb__btn {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lb__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 56px 64px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pinch-zoom;
}

.lb__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
  transform-origin: center center;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.12s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.lb__img.is-switching {
  opacity: 0;
}

.lb__bar {
  position: relative;
  flex: none;
  display: flex;
  gap: 1.5em;
  align-items: flex-end;
  justify-content: space-between;
  padding: 14px 24px 20px;
  animation: lb-fade 0.4s ease;
}

.lb__cap {
  flex: 1;
  max-width: 760px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
  max-height: min(30vh, 220px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lb__cap[hidden] {
  display: none;
}

.lb__cap sup a {
  color: inherit;
  pointer-events: none;
  text-decoration: none;
}

.lb__count {
  flex: none;
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

.lb__btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font: 400 22px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s;
  animation: lb-fade 0.4s ease;
}

.lb__btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lb__btn:focus-visible {
  outline: 2px solid #FFA86A;
  outline-offset: 2px;
}

.lb__btn[hidden] {
  display: none;
}

.lb__close {
  top: 8px;
  right: 10px;
  font-size: 16px;
}

.lb__prev,
.lb__next {
  top: 50%;
  margin-top: -40px;
  font-size: 30px;
}

.lb__prev { left: 10px; }
.lb__next { right: 10px; }

@media (max-width: 684px) {
  .lb__stage {
    margin: 52px 0 0;
  }
  .lb__img {
    border-radius: 0;
  }
  .lb__prev,
  .lb__next {
    display: none;
  }
  .lb__bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4em;
    padding: 12px 16px 18px;
  }
  .lb__count {
    order: -1;
  }
  .lb__cap {
    margin: 0;
    font-size: 0.8rem;
    max-height: 22vh;
  }
}

@keyframes lb-fade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lb__img,
  .lb__backdrop,
  .lb__bar,
  .lb__btn {
    transition: none !important;
    animation: none !important;
  }
}
