/* ===================================
   popup-swipe.css
   独自ライトボックス（GLightbox廃止）
   =================================== */

/* ---- オーバーレイ ---- */
.tdslb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000; /* WP adminbar(99999)より上 */
  background: rgba(0,0,0,.8);
  touch-action: none;
  -webkit-text-size-adjust: 100%;
}
.tdslb-overlay.tdslb-open {
  display: flex;
  flex-direction: column;
}
body.tdslb-lightbox-open {
  overflow: hidden;
}

/* ---- 上部バー：カウンター（中央）＋閉じるボタン（右端） ---- */
.tdslb-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  height: 52px;
  flex-shrink: 0;
  z-index: 11;
  box-sizing: border-box;
}
/* 左スペーサー：閉じるボタン(60px)と対称にしてカウンターを視覚的中央に */
.tdslb-bar-spacer {
  display: block;
  width: 60px;
  flex-shrink: 0;
}
.tdslb-counter {
  flex: 1;
  font-size: 2rem;
  color: #fff;
  letter-spacing: .05em;
  pointer-events: none;
  text-align: center;
}
.tdslb-close {
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.tdslb-close svg { width: 32px; height: 32px; }
.tdslb-close path { stroke: #fff; }

/* ---- スライダー ---- */
.tdslb-slider {
  flex: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
}
.tdslb-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  box-sizing: border-box;
}
.tdslb-slide.tdslb-current {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* ---- キャプション（スライダー内） ---- */
.tdslb-caption {
  width: 100%;
  max-width: 1280px;
  padding: .6em 1em;
  color: #fff;
  font-size: 1.8rem;
  line-height: 1.5;
  background: rgba(0,0,0,.55);
  box-sizing: border-box;
  text-align: center;
  flex-shrink: 0;
}
.tdslb-caption.tdslb-overlay-caption {
  position: absolute;
  bottom: 0;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: 10;
  text-shadow: 1px 1px 6px #000, -1px -1px 6px #000;
}

/* ---- 下部スペーサー（スマホ：送りボタン分の高さ確保） ---- */
.tdslb-bottom-bar {
  width: 100%;
  height: 60px;
  flex-shrink: 0;
  box-sizing: border-box;
  pointer-events: none;
}
.tdslb-prev,
.tdslb-next {
  position: fixed;
  bottom: 0;
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 11;
}
.tdslb-prev { left: 0; }
.tdslb-next { right: 0; }
.tdslb-prev svg,
.tdslb-next svg { width: 28px; height: 28px; }
.tdslb-prev path,
.tdslb-next path { stroke: #fff; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.tdslb-prev.tdslb-hidden,
.tdslb-next.tdslb-hidden { visibility: hidden; }

/* ---- GLightbox風スライドアニメーション ---- */
.tdslb-slide.tdslb-enter-right,
.tdslb-slide.tdslb-current.tdslb-enter-right {
  visibility: visible;
  animation: tdslb-slideInRight .3s ease forwards;
}
.tdslb-slide.tdslb-enter-left,
.tdslb-slide.tdslb-current.tdslb-enter-left {
  visibility: visible;
  animation: tdslb-slideInLeft .3s ease forwards;
}
.tdslb-slide.tdslb-exit-left {
  visibility: visible;
  animation: tdslb-slideOutLeft .3s ease forwards;
  pointer-events: none;
}
.tdslb-slide.tdslb-exit-right {
  visibility: visible;
  animation: tdslb-slideOutRight .3s ease forwards;
  pointer-events: none;
}
@keyframes tdslb-slideInRight {
  from { opacity: 0; transform: translate3d(60%, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes tdslb-slideInLeft {
  from { opacity: 0; transform: translate3d(-60%, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes tdslb-slideOutLeft {
  from { opacity: 1; transform: translate3d(0, 0, 0); }
  to   { opacity: 0; transform: translate3d(-60%, 0, 0); }
}
@keyframes tdslb-slideOutRight {
  from { opacity: 1; transform: translate3d(0, 0, 0); }
  to   { opacity: 0; transform: translate3d(60%, 0, 0); }
}
.tdslb-overlay.tdslb-closing {
  animation: tdslb-overlayClose .3s ease forwards;
}
@keyframes tdslb-overlayClose {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(.85); }
}
.tdslb-overlay.tdslb-opening {
  animation: tdslb-overlayOpen .3s ease forwards;
}
@keyframes tdslb-overlayOpen {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---- 画像 ---- */
.tdslb-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  position: relative;
}
.tdslb-media img {
  max-width: 100%;
  max-height: calc(100vh - 172px); /* 上部バー52px + 下部バー60px + キャプション想定60px */
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* ---- 動画（iframe） ---- */
.tdslb-video-wrap {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: auto;
}
.tdslb-video-wrap iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  outline: none;
}

/* ---- 縦動画（Shorts など 9:16） ---- */
.tdslb-video-wrap.tdslb-vertical {
  width: auto;
  max-width: 100%;
  height: calc(100vh - 160px);
  margin: auto;
}
.tdslb-video-wrap.tdslb-vertical iframe {
  width: auto;
  height: 100%;
  aspect-ratio: 9/16;
  max-width: 100vw;
}

/* ---- ローダー ---- */
.tdslb-loader {
  width: 26px; height: 26px;
  border: 3px solid #fff;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tdslb-spin .8s linear infinite;
  position: absolute;
  top: 50%; left: 50%;
  margin: -13px 0 0 -13px;
}
@keyframes tdslb-spin {
  to { transform: rotate(360deg); }
}

/* ---- PC（769px以上）：矢印を左右固定、ボトムバー非表示 ---- */
@media (min-width: 769px) {
  .tdslb-bar {
    height: 50px;
  }
/* PC：スペーサー不要 */
.tdslb-bottom-bar {
  display: none;
}
/* PC：矢印を左右中央にfixed配置（上書き） */
.tdslb-prev,
.tdslb-next {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 50px; height: 80px;
  background: rgba(0,0,0,.4);
  border-radius: 4px;
  transition: background .2s;
}
.tdslb-prev { left: 10px; }
.tdslb-next { right: 10px; }
.tdslb-prev:hover,
.tdslb-next:hover { background: rgba(0,0,0,.75); }
  .tdslb-media img {
    max-height: calc(100vh - 160px);
  }
}

/* ---- 横向きスマホ ---- */
@media screen and (orientation: landscape) and (max-height: 480px) {
  .tdslb-bar { height: 40px; }
  .tdslb-counter { font-size: 1.6rem; }
  .tdslb-close { width: 40px; height: 40px; }
  .tdslb-bar-spacer { width: 40px; }
  .tdslb-bottom-bar { height: 44px; }
  .tdslb-prev,
  .tdslb-next {
    position: fixed;
    top: 50%; transform: translateY(-50%);
    width: 5vw; height: 50vh;
    background: rgba(0,0,0,.4);
    justify-content: center; padding: 0;
  }
  .tdslb-prev { left: 0; }
  .tdslb-next { right: 0; }
}

/* ---- サムネイル（投稿内） ---- */
.tdslb-item {
  display: block;
  width: 100%;
  max-width: 100%;
}
.tdslb-yt-thumb {
  position: relative;
  display: block;
  width: 100%;
  background: #000;
}
.tdslb-yt-thumb img {
  display: block;
  width: 100%;
  height: auto;
}
.tdslb-yt-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 68px; height: 48px;
  opacity: .85;
  pointer-events: none;
}
/* ---- MP4サムネなしの場合 ---- */
.tdslb-no-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  background: #111;
}

/* ---- MP4 video要素 ---- */
.tdslb-video-wrap video {
  display: block;
  width: 100%;
  max-height: 80vh;
  background: #000;
}
/* ---- 送りボタン：スワイプ誘導アニメーション（ポップアップ開時1回） ---- */
@keyframes tdslb-hint-prev {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(-10px); }
  60%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
@keyframes tdslb-hint-next {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(10px); }
  60%  { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}
.tdslb-prev.tdslb-hint {
  animation: tdslb-hint-prev 0.6s ease 0.4s 1 both;
}
.tdslb-next.tdslb-hint {
  animation: tdslb-hint-next 0.6s ease 0.4s 1 both;
}