/* Replacing entire file with game-mod-block based lightbox styles */
/* Inline Gallery Lightbox - Frontend Styles (game-mod-blockベース、クラス名変更済み) */

.inline-gallery-lightbox {
  padding: 2px;
  margin-bottom: 1.5em;
  background-color: transparent;
  border: none;
  box-shadow: none;
  transition: none;
  overflow: hidden;
}

.inline-gallery-lightbox a {
  text-decoration: none;
  transition: opacity 0.2s;
}
.inline-gallery-lightbox a:hover {
  opacity: 0.8;
}

.igl-images,
.igl-images-more {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  padding: 10px; /* 追加：同一の内側余白 */
  border: 1px solid #eee; /* 追加：同一の枠線 */
  border-radius: 4px; /* 追加：同一の角丸 */
  box-sizing: border-box; /* 幅計算を安定させる */
}
.igl-images-more {
  display: none;
} /* JSで中身は移動するが、一応非表示維持 */

/* 続き/閉じるボタン（中央下・余白あり・見た目を整える） */
.igl-show-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  margin: 12px auto 0; /* ここで"上がくっつく"のを防ぐ + 中央寄せ */
  border: 1px solid #ddd;
  border-radius: 9999px; /* pill形状 */
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.igl-show-more:hover {
  background: #f7f7f9;
}
.igl-show-more:focus-visible {
  outline: 2px solid #4c9aff;
  outline-offset: 2px;
}

/* アスペクト比強制適用のCSSを padding-top 方式に変更して互換性を向上 */
/* アスペクト比強制適用 */
.igl-images[data-aspect-ratio] .igl-image,
.igl-images[data-aspect-ratio] .igl-video,
.igl-images-more[data-aspect-ratio] .igl-image,
.igl-images-more[data-aspect-ratio] .igl-video {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: var(--aspect-ratio-percent, 56.25%); /* 16:9フォールバック */
  overflow: hidden;
}

/* 各アスペクト比のCSS変数定義をpadding-top用に変更 */
.igl-images[data-aspect-ratio="1:1"],
.igl-images-more[data-aspect-ratio="1:1"] {
  --aspect-ratio-percent: 100%; /* 1:1 = 100% */
}

.igl-images[data-aspect-ratio="4:3"],
.igl-images-more[data-aspect-ratio="4:3"] {
  --aspect-ratio-percent: 75%; /* 3/4 = 75% */
}

.igl-images[data-aspect-ratio="3:4"],
.igl-images-more[data-aspect-ratio="3:4"] {
  --aspect-ratio-percent: 133.33%; /* 4/3 = 133.33% */
}

.igl-images[data-aspect-ratio="16:9"],
.igl-images-more[data-aspect-ratio="16:9"] {
  --aspect-ratio-percent: 56.25%; /* 9/16 = 56.25% */
}

.igl-images[data-aspect-ratio="9:16"],
.igl-images-more[data-aspect-ratio="9:16"] {
  --aspect-ratio-percent: 177.78%; /* 16/9 = 177.78% */
}

.igl-images[data-aspect-ratio="3:2"],
.igl-images-more[data-aspect-ratio="3:2"] {
  --aspect-ratio-percent: 66.67%; /* 2/3 = 66.67% */
}

.igl-images[data-aspect-ratio="2:3"],
.igl-images-more[data-aspect-ratio="2:3"] {
  --aspect-ratio-percent: 150%; /* 3/2 = 150% */
}

.igl-images[data-aspect-ratio="21:9"],
.igl-images-more[data-aspect-ratio="21:9"] {
  --aspect-ratio-percent: 42.86%; /* 9/21 = 42.86% */
}

.igl-images[data-aspect-ratio="5:4"],
.igl-images-more[data-aspect-ratio="5:4"] {
  --aspect-ratio-percent: 80%; /* 4/5 = 80% */
}

.igl-images[data-aspect-ratio="4:5"],
.igl-images-more[data-aspect-ratio="4:5"] {
  --aspect-ratio-percent: 125%; /* 5/4 = 125% */
}

/* アスペクト比適用時の画像とビデオサムネイルのスタイル調整 */
.igl-images[data-aspect-ratio] .igl-image img.igl-thumbnail,
.igl-images[data-aspect-ratio] .igl-video .igl-video-thumbnail,
.igl-images-more[data-aspect-ratio] .igl-image img.igl-thumbnail,
.igl-images-more[data-aspect-ratio] .igl-video .igl-video-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 1;
  visibility: visible;
}

/* ビデオサムネイルの背景画像もアスペクト比に対応 */
.igl-images[data-aspect-ratio] .igl-video .igl-video-thumbnail,
.igl-images-more[data-aspect-ratio] .igl-video .igl-video-thumbnail {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: absolute; /* 絶対配置を明示 */
  top: 0;
  left: 0;
}

/* レスポンシブ対応：小さい画面では強制的に列数を調整 */
@media (max-width: 600px) {
  .igl-images,
  .igl-images-more {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 400px) {
  .igl-images,
  .igl-images-more {
    grid-template-columns: 1fr !important;
  }
}

.igl-image,
.igl-video {
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

/* アスペクト比が適用されていない場合のデフォルトスタイルを明示 */
.igl-image:not([data-aspect-ratio] *) img.igl-thumbnail,
.igl-video:not([data-aspect-ratio] *) .igl-video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
  display: block;
  opacity: 1;
  visibility: visible;
  background-color: #f5f5f5;
}

/* YouTube動画のプレイボタン */
.igl-video .play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background-color: rgba(255, 0, 0, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  z-index: 100; /* ライトボックスのナビゲーションボタンより低いz-index */
}

.igl-video:hover .play-button {
  background-color: rgba(255, 0, 0, 1);
}

.igl-video .play-button i {
  color: white;
  font-size: 20px;
  margin-left: 2px;
}

/* モダンライトボックス */
.igl-lightbox {
  display: none;
  position: fixed;
  z-index: 1000000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.igl-lightbox.show {
  opacity: 1;
}

.igl-lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
}

.igl-lightbox-content {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 20px;
}

.igl-lightbox-media-container {
  max-width: 90%;
  max-height: 90%;
  position: relative;
}

.igl-lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.igl-lightbox-video {
  width: 90vw;
  height: 50.625vw; /* 16:9 aspect ratio */
  max-width: 1200px;
  max-height: 675px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.igl-lightbox-video iframe {
  width: 100%;
  height: 100%;
}

.igl-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1000001;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.igl-lightbox-close:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

.igl-lightbox-prev,
.igl-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: none;
  border-radius: 50%;
  font-size: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1000001;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* 左右のボタンを確実に分離して配置 */
.igl-lightbox-prev {
  left: 30px; /* 10px から 30px に変更してより左側に */
}

.igl-lightbox-next {
  right: 30px; /* 10px ���ら 30px に変更してより右側に */
}

/* ホバー時の変形を修正して位置がずれないようにする */
.igl-lightbox-prev:hover,
.igl-lightbox-next:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.igl-lightbox-close:hover {
  transform: scale(1.1);
}

/* 疑似要素でのアイコン描画を削除してSVGアイコンを使用 */
.igl-lightbox-prev::before,
.igl-lightbox-next::before,
.igl-lightbox-close::before {
  display: none; /* 疑似要素のアイコンを無効化 */
}

/* SVGアイコンのスタイリング */
.igl-lightbox-prev svg,
.igl-lightbox-next svg,
.igl-lightbox-close svg {
  pointer-events: none;
  transition: transform 0.2s ease;
}

.igl-lightbox-prev:hover svg,
.igl-lightbox-next:hover svg,
.igl-lightbox-close:hover svg {
  transform: scale(1.1);
}

.igl-lightbox-thumbnails {
  box-sizing: border-box;
  padding: 15px 20px 25px; /* パディングを調整 */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable both-edges;
  background: rgba(0, 0, 0, 0.7); /* 背景を少し濃く */
  /* スクロールバーのスタイリング */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.igl-lightbox-thumbnails::-webkit-scrollbar {
  height: 8px;
}

.igl-lightbox-thumbnails::-webkit-scrollbar-track {
  background: transparent;
}

.igl-lightbox-thumbnails::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.igl-lightbox-thumbnails::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.igl-lightbox-thumbnails-container {
  display: flex;
  gap: 12px; /* 8px から 12px に拡大 */
  padding: 0 5px; /* 左右に少し余白 */
  align-items: center; /* 縦方向の中央配置 */
  min-height: 60px; /* 最小高さを設定して縦スクロール防止 */
}

.igl-lightbox-thumbnail {
  flex: 0 0 auto;
  width: 80px; /* 70px から 80px に拡大 */
  height: 60px; /* 50px から 60px に拡大 */
  border-radius: 6px; /* 4px から 6px に拡大 */
  overflow: hidden;
  opacity: 0.6; /* .7 から .6 に変更 */
  position: relative;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease; /* トランジション時間を延長 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); /* シャドウを追加 */
}

.igl-lightbox-thumbnail.active {
  opacity: 1;
  border-color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); /* アクティブ時のシャドウを強化 */
  transform: scale(1.05); /* アクティブ時の拡大効果 */
}

.igl-lightbox-thumbnail:hover {
  opacity: 0.9; /* ホバー時の透明度調整 */
  transform: scale(1.02); /* ホバー時の軽い拡大 */
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.igl-lightbox-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.igl-lightbox-thumbnail .play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px; /* 20px から 24px に拡大 */
  height: 24px; /* 20px から 24px に拡大 */
  background-color: rgba(255, 0, 0, 0.9); /* 不透明度を上げる */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); /* シャドウを追加 */
}

.igl-lightbox-thumbnail .play-overlay i {
  color: white;
  font-size: 10px; /* 8px から 10px に拡大 */
  margin-left: 2px; /* 1px から 2px に調整 */
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .igl-lightbox-content {
    padding: 80px 10px 10px;
  }

  .igl-lightbox-video {
    width: 95vw;
    height: 53.4375vw;
  }

  .igl-lightbox-prev,
  .igl-lightbox-next {
    width: 44px; /* モバイルでは少し小さく */
    height: 44px;
  }

  /* モバイルでも左右の分離を維持 */
  .igl-lightbox-prev {
    left: 20px; /* モバイルでも十分な間隔を保つ */
  }

  .igl-lightbox-next {
    right: 20px; /* モバイルでも十分な間隔を保つ */
  }

  .igl-lightbox-close {
    width: 40px; /* 36px から 40px に拡大 */
    height: 40px; /* 36px から 40px に拡大 */
    top: 15px;
    right: 15px;
  }

  .igl-lightbox-close::before {
    width: 20px;
    height: 20px;
  }

  .igl-lightbox-thumbnails {
    padding: 12px 15px 20px; /* モバイル用パディング調整 */
  }

  .igl-lightbox-thumbnail {
    width: 70px; /* モバイルでは少し小さく */
    height: 52px;
  }

  .igl-lightbox-thumbnails-container {
    gap: 10px; /* モバイルでは間隔を狭く */
  }
}
