
  .gallery {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
  }
  /* 1セット（画像＋文字） */
  .gallery figure {
    /* figure の幅＝画像の幅（キャプションも同じ幅になる） */
    width: fit-content;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center; /* 画像中心とキャプション中心を揃える */
  }

  /* 画像サイズはお好みで。固定でも、可変でもOK */
  .gallery img {
    display: block;
    width: 400px;       /* ←必要に応じて変更。可変にしたいなら max-width に */
    height: auto;
    /* アスペクト比を固定したい場合は下記を使う（対応ブラウザのみ）
    aspect-ratio: 4 / 3;
    object-fit: cover;
    */
  }

  /* キャプションは画像と同じ横幅で中央揃え */
  .gallery figcaption {
    width: 100%;
    text-align: center;
    margin-top: 6px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #333;
    font-weight: bold;
  }

  /* 画像を自動で縮めてレスポンシブにしたい場合の例（オプション） */
  @media (max-width: 600px) {
    .gallery img { width: 150px; }
  }

    .thumbnail {
      width: 150px;
      height: auto;
      cursor: pointer;
      transition: transform 0.2s;
  }
  .thumbnail:hover {
      transform: scale(1.1);
  }
  /* モーダルのスタイル */
  .modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.8);
      justify-content: center;
      align-items: center;
      z-index: 1000; /* モーダルを最前面に */

  }
  .modal img {
      max-width: 90%;
      max-height: 90%;
  }
