.gallery{
    padding:30px 0 0;
    text-align:center;
    font-size: 15px;
    font-weight:bold;
}

.gaiyou{
    text-align:center;
    color: #929292;
    font-size: 9.5px;
    margin:0 0 15px;
}

/* ===============================
   カテゴリボタン
=============================== */
#category-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top:16px;
  margin-bottom: 32px;
}

.category-btn {
  padding: 5px 12px;
  cursor: pointer;
  border: 1px solid #ccc;
  background-color: #f5f5f5;
  font-color: #008B8B;
  border-radius: 4px;
  transition: 0.2s;
}

.category-btn:hover {
  background-color: #ddd;
}

.category-btn.active {
  background-color: #888;
  color: #fff;
}


/* ===============================
   ギャラリー（サムネ）
=============================== */
#gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  padding: 0 10px;
  max-width: 800px;
  margin: 0 5px;
}

.post-thumb-container {
  width: 100%;
  overflow: hidden;
  border-radius: 50%;
  cursor: pointer;
}

.thumb-img {
  width: 100%;
  aspect-ratio: 1 / 1; /* 正方形で安定 */
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

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


/* ===============================
   モーダル
=============================== */
#modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.9);
  overflow-y: auto; /* 🔥スクロールの本体 */
  -webkit-overflow-scrolling: touch;
}

.modal-img-container{
  width: fit-content;
  margin: 0 auto;
}

#modal-content {
  max-width: 900px;
  margin: 20px auto;
  padding: 10px;
}

/* 画像 */
.modal-img {
  display: block;
  max-width: 100%;
  height: auto;
  margin:0;
  margin-bottom: 3px;

}

/* キャプション */
.caption {
  color: #fff;
  margin-bottom: 80px;
  margin-top:0;
  width:100%;
}

/* 閉じる */
#modal-close {
  position: fixed; /* ← absolute → fixed に変更（安定） */
  top: 15px;
  right: 20px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
}

@media (min-width: 1024px) {
  .modal-img {
    max-width: 80%;
  }
}

@media (min-width: 768px) {
  .modal-img {
    max-width: 80%;
  }
}

/* ===============================
   スマホ最適化
=============================== */
@media (max-width: 600px) {
  #gallery {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    padding: 0 6px;
  }

  #modal-content {
    margin: 10px auto;
    padding: 6px;
  }

}