/* ==================================================
   0. カラーテーマの一元管理（CSS変数を利用）
================================================== */
.theme-light {
  --theme-color: rgb(95, 95, 95);   /* 明るい背景用の線色 */
}

.theme-dark {
  --theme-color: rgb(226, 226, 226); /* 暗い背景用の線色 */
}
:root {
  --modal-radius: 0;     /* モーダル本体の角丸 */
  --image-radius: 0;     /* モーダル画像の角丸 */
}

/* ==================================================
   1. モーダル背景（デフォルト）
================================================== */
.modal-backdrop.show {
  background-color: rgba(0, 0, 0, 0.5); /* Bootstrapの標準半透明黒 */
}

/* ==================================================
   2. モーダル本体
================================================== */
.modal-content {
  background-color: #fff;
  border: none;
  border-radius: var(--modal-radius);  /* ← 角丸を変数に */
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  overflow: hidden;
  color: #212529;
}

/* ==================================================
   3. ナビゲーションボタン（← / →）
================================================== */

/* --- 共通ボタンスタイル --- */
.arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 1055;
  display: inline-block;
  color: var(--theme-color); /* カラーテーマを反映 */
}

/* --- 擬似要素（矢印パーツ） --- */
.arrow-btn::before,
.arrow-btn::after {
  content: '';
  position: absolute;
  background: currentColor;
  border-radius: 1px;
}

/* 横棒 */
.arrow-btn::before {
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

/* 縦棒 */
.arrow-btn::after {
  top: 0;
  right: 0;
  bottom: 0;
  width: 2px;
}

/* ← 左矢印 */
.arrow-left {
  left: 1rem;
  transform: translateY(-50%) rotate(225deg);
}

/* → 右矢印 */
.arrow-right {
  right: 1rem;
  transform: translateY(-50%) rotate(45deg);
}

/* ==================================================
   4. 閉じるボタン（✕アイコン）
================================================== */
.modal-close-btn {
  display: block;
  position: absolute;
  top: 19px;
  right: 12px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  z-index: 1060;
}

/* ✕の線 */
.modal-close-btn span {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 2px;
  background-color: var(--theme-color); /* カラーテーマを反映 */
  border-radius: 4px;
  transition: all 0.3s ease;
  transform-origin: center;
}

/* 1本目：右下へ */
.modal-close-btn span:nth-child(1) {
  transform: translate(-50%, -50%) rotate(45deg);
}

/* 2本目（中央線は非表示） */
.modal-close-btn span:nth-child(2) {
  display: none;
}

/* 3本目：左下へ */
.modal-close-btn span:nth-child(3) {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* ==================================================
   5. モーダル画像と中央揃え
================================================== */
.modal-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #fff;
  min-height: 90vh;
  position: relative;
}

#modalImage {
  max-width: 80%;     /* 横幅は親の%まで */
  max-height: 80%;    /* 高さは親の%まで */
  width: auto;
  height: auto;
  object-fit: contain; 
  border-radius: 0;    /* 画像の角丸なし */
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
  display: block;
  margin: 0 auto;
}


/* ==================================================
   6. キャプション
================================================== */
#modalCaption {
  font-size: 0.9rem;
  color: #6c757d; /* Bootstrap mutedカラー */
  margin-top: 0.5rem;
  text-align: center;
  user-select: none;
  line-height: 1.4;
}
