/* ============================================================
   画像ライトボックス（Simple Lightbox の置き換え・2026-09-23）
   ・ダイアログ全体を縦方向のフレックスにして、
     画像／キャプション／カウンターが重ならないようにする
   ・display は [open] のときだけ指定する
     （dialog は閉じているとき display:none なので、
       無条件に display:flex と書くと閉じても表示されてしまう）
   ============================================================ */

.qc-lightbox {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.qc-lightbox[open] {
  display: flex;
  flex-direction: column;
}

.qc-lightbox::backdrop {
  background: rgba(8, 15, 32, .92);
}

/* 背後のページ（Cookie通知バーなど）が透けてキャプションが読みにくくなるため、
   下部だけ暗く覆う。画像と文字はこの上に重ねる */
.qc-lightbox[open]::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 132px;
  background: linear-gradient(to top, rgba(8, 15, 32, .97) 45%, rgba(8, 15, 32, 0));
  pointer-events: none;
}

.qc-lightbox__figure {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 76px 8px;
  box-sizing: border-box;
}

.qc-lightbox__img {
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}

.qc-lightbox__caption {
  flex: none;
  margin: 0;
  max-width: 800px;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.qc-lightbox__counter {
  position: relative;
  z-index: 1;
  flex: none;
  margin: 0;
  padding: 10px 0 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  letter-spacing: .06em;
}

.qc-lightbox__close,
.qc-lightbox__nav {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  transition: background .2s ease;
}

.qc-lightbox__close:hover,
.qc-lightbox__nav:hover {
  background: rgba(255, 255, 255, .28);
}

.qc-lightbox__close:focus-visible,
.qc-lightbox__nav:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.qc-lightbox__close {
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  font-size: 26px;
}

.qc-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 30px;
}

.qc-lightbox__nav--prev { left: 14px; }
.qc-lightbox__nav--next { right: 14px; }

/* 画面が狭いと画像が横幅いっぱいになり、左右のボタンが画像に重なるため、
   前後ボタンをカウンターと同じ最下段へ移す */
@media (max-width: 768px) {
  .qc-lightbox__figure {
    padding: 58px 12px 8px;
  }

  .qc-lightbox__counter {
    padding: 12px 68px 22px;
  }

  .qc-lightbox__nav {
    top: auto;
    bottom: 14px;
    transform: none;
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  .qc-lightbox__nav--prev { left: 16px; }
  .qc-lightbox__nav--next { right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .qc-lightbox__close,
  .qc-lightbox__nav {
    transition: none;
  }
}
