/* 图片放大预览（灯箱）
   投票列表里的 64px 缩略图、投完票后结果里的 26px 小图、以及本期封面，
   点一下都会在整屏里放大看原图。 */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  opacity: 0;
  transition: opacity 200ms ease;
}

.lightbox[hidden] {
  display: none;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  touch-action: none;
  background: rgba(19, 23, 19, 0.8);
  -webkit-backdrop-filter: blur(7px) saturate(1.04);
  backdrop-filter: blur(7px) saturate(1.04);
}

.lightbox-figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  opacity: 0.35;
  transform: scale(0.965);
  transition:
    transform 260ms cubic-bezier(0.2, 0.75, 0.2, 1),
    opacity 200ms ease;
}

.lightbox.is-open .lightbox-figure {
  opacity: 1;
  transform: none;
}

.lightbox-image {
  display: block;
  max-width: min(92vw, 1040px);
  max-height: calc(100vh - 150px);
  max-height: calc(100svh - 150px);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.05);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.85);
  object-fit: contain;
}

.lightbox-caption {
  max-width: min(92vw, 620px);
  margin: 0;
  padding: 7px 15px;
  border-radius: 999px;
  color: rgba(255, 253, 248, 0.92);
  background: rgba(0, 0, 0, 0.34);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}

.lightbox-caption:empty {
  display: none;
}

.lightbox-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 2;
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: 50%;
  color: #fffdf8;
  background: rgba(24, 28, 24, 0.55);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background 160ms ease,
    transform 200ms ease;
}

.lightbox-close:hover {
  background: rgba(233, 101, 69, 0.92);
  transform: rotate(90deg);
}

.lightbox-close:focus-visible {
  outline: 2px solid rgba(255, 253, 248, 0.85);
  outline-offset: 3px;
}

.lightbox-close svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* 提示这些图是可以点开看大图的 */
.option-photo,
.result-thumb,
#topic-cover-image {
  cursor: zoom-in;
}

/* 悬停时一圈很淡的墨色描边：看得出能点，又不会和"已选中"混在一起 */
.option-photo:hover,
#topic-cover-image:hover {
  outline: 2px solid rgba(31, 44, 35, 0.2);
  outline-offset: 2px;
}

.result-thumb {
  transition: transform 160ms ease;
}

.result-thumb:hover {
  transform: scale(1.14);
}

html.is-lightbox-open {
  overflow: hidden;
  padding-right: var(--lightbox-gap, 0px);
}

@media (max-width: 640px) {
  .lightbox {
    padding: 16px;
  }

  .lightbox-image {
    max-height: calc(100vh - 140px);
    max-height: calc(100svh - 140px);
    border-radius: 13px;
  }

  .lightbox-close {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox-figure {
    transition: none;
  }
}
