/* 画像群の外箱。これ自体を右に寄せることで「本文 ⇨ 画像群」を実現 */
.image-group-container {
  display: flex;
flex-wrap: wrap;
  gap: 10px;            /* 枠同士の横の隙間 */
}

/* 本文と画像の重なり（回り込み）を正しく制御 */
.clearfix::after {
  content: "";
  display: table;
  clear: both; 
}


.image-text-box {
  border: 1px solid #eee; /* 薄いグレーの線 */
  padding: 0;           /* 枠内余白ゼロ（省スペースの肝） */
  background-color: #fff;
  text-align: center;
  border-radius: 8px;
  overflow: hidden;     /* 画像の角を枠に合わせる */
  display: inline-block; 
  vertical-align: top;
  flex-shrink: 0;       /* 画像が潰れるのを防止 */
}

/* サイズ設定 */
.image-text-box  { width: 440px; }

.image-text-box img {
  width: 100%;
  height: auto;
  display: block;       /* 画像下の謎の隙間を消す */
  cursor: pointer;
}

.image-text-box p, .image-text-boxs p {
  margin: 0;
  padding: 12px 12px;     /* 必要最低限の余白 */
  font-size: 0.80em;
  line-height: 1.5;
}


.modal {
  display: none;
  position: fixed;
  z-index: 5000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #fff;
  padding: 10px;
  width: 95%;
  max-width: 870px;
  border-radius: 4px;
  position: relative;
  text-align: center;
}

.modal-content img {
  max-width: 100%;
  max-height: 90vh;
  display: block;
  margin: 0 auto;
}

#caption {
  margin: 10px 0 5px 0;
  font-size: 1rem;
  font-weight: bold;
}

/* ====================================
   4. 前後ボタン（下線・枠線排除）
   ==================================== */
.modal .prev, .modal .next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: 35px;
  
  /* 下線とクリック時の枠線を完全に消去 */
  text-decoration: none !important;
  outline: none;
  
  border-radius: 5px;
  transition: 0.3s;
  cursor: pointer;
  z-index: 6000;
}

/* ホバー・クリック時も下線を出さない */
.modal .prev:hover, .modal .next:hover,
.modal .prev:focus, .modal .next:focus {
  text-decoration: none !important;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal .prev { left: 10px; }
.modal .next { right: 10px; }

/* ====================================
   5. スマホ表示（500px以下）
   ==================================== */
@media (max-width: 500px) {
  /* 本文 ⇨ 画像群 の順序に入れ替え */
  .jyunban {
    display: flex;
    flex-direction: column;
  }
  .pre-line { order: 1; width: 100%; padding: 0 10px; box-sizing: border-box; }
  
  .image-group-container {
    order: 2;
    float: none;
    display: flex;
    flex-direction: column; /* 縦並び */
    align-items: center;
    gap: 15px;              /* 画像同士の上下の隙間 */
    margin: 15px 0;
  }
  
  .image-text-box, .image-text-boxs {
    width: 90% !important;
    margin: 0 auto;
  }
  
  /* スマホはボタンを画面端ではなく画像付近に配置 */
  .modal .prev, .modal .next {
    position: absolute;
    width: 45px; height: 70px; font-size: 25px;
    background-color: rgba(0, 0, 0, 0.4);
  }
  .modal .prev { left: 5px; }
  .modal .next { right: 5px; }
}