body {
  background-color: #fafafa;
}

/* ===== 一覧グリッド ===== */
/* サムネイル間の余白を 2px に（各カラム左右上下 1px のパディング） */
.gallery-grid {
  --bs-gutter-x: 2px;
  --bs-gutter-y: 2px;
}

/* Instagram風の縦長サムネイル比率 (4:5) */
.ratio-4x5 {
  --bs-aspect-ratio: 125%; /* 高さ÷幅 = 5/4 */
}

.gallery-thumb {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background-color: #eee;
}

.gallery-thumb .thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;        /* 正方形にトリミング表示 */
  display: block;
  transition: transform .2s ease;
}

.gallery-thumb:hover .thumb-img {
  transform: scale(1.04);
}

/* 右上アイコン */
.gallery-thumb .thumb-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #fff;
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  pointer-events: none;
}

/* ===== モーダル ===== */
.gallery-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background-color: #fff;
  border-radius: 50%;
  padding: .6rem;
  opacity: .9;
}

.gallery-stage {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.gallery-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: rgba(0, 0, 0, .4);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease;
}

.gallery-nav:hover:not(:disabled) {
  background: rgba(0, 0, 0, .65);
}

.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }

.gallery-nav:disabled {
  opacity: .25;
  cursor: default;
}

.gallery-caption {
  padding: .75rem 1rem .25rem;
  font-size: .95rem;
  text-align: center;
}

/* 画像に重ねるドットインジケーター（画像下辺から約10px） */
.gallery-counter {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 0;
  z-index: 5;
  pointer-events: none; /* スワイプ/クリックを妨げない */
}

.gallery-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 0 2px rgba(0, 0, 0, .5); /* 明るい画像でも視認できるように */
  transition: background .15s ease, transform .15s ease;
}

.gallery-dot.active {
  background: #fff;
  transform: scale(1.15);
}

#galleryModal{
  z-index:20000;
}
/* ===== スマホ（575.98px以下）: 全画面モーダル ===== */
@media (max-width: 575.98px) {
  /* modal-body を縦flexにして、画像エリアを残り高さいっぱいに広げる */
  .modal-fullscreen-sm-down .modal-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .gallery-stage {
    flex: 1 1 auto;   /* キャプション/カウンター以外の高さを占有 */
    min-height: 0;
  }

  .gallery-image {
    max-height: none; /* 高さは stage に追従 */
    height: 100%;
    width: 100%;
  }

  /* タップしやすいサイズに */
  .gallery-nav {
    width: 44px;
    height: 44px;
  }

  .gallery-close {
    padding: .7rem;
  }
}