
/* 共通のサムネイルスタイル */
.thumbnail-section {
  display: grid;
  gap: 10px;
  margin-bottom: 30px;
}

.thumbnail-item {
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  padding: 10px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.thumbnail-item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.thumbnail-item .comment {
  margin-top: 10px;
  padding: 5px;
  font-size: 14px;
  line-height: 1.5;
}

/* 上部セクション：最小1枚、最大2枚 */
.top-section {
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .top-section {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 中部セクション：最小1枚、最大1枚 */
.middle-section {
  grid-template-columns: 1fr;
}

/* 下部セクション：最小2枚、最大4枚 */
.bottom-section {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 600px) {
  .bottom-section {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 800px) {
  .bottom-section {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 下部セクション：最小1枚、最大3枚 */
.bottom-section-3 {
  grid-template-columns: repeat: 1fr;
}

@media (min-width: 600px) {
  .bottom-section-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 800px) {
  .bottom-section-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* 下部セクションのクリック可能なアイテム */
.thumbnail-item.clickable {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.thumbnail-item.clickable .image-wrapper {
  position: relative;
  overflow: hidden;
}

.thumbnail-item.clickable .image-wrapper img {
  transition: transform 0.3s ease;
}

.thumbnail-item.clickable .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0);
  transition: background-color 0.3s ease;
  pointer-events: none;
}

/* ホバーエフェクト */
.thumbnail-item.clickable:hover .image-wrapper img {
  transform: scale(1.1);
}

.thumbnail-item.clickable:hover .overlay {
  background-color: rgba(255, 255, 255, 0.3);
}

/* レスポンシブ対応：600px未満の画面向け */
@media (max-width: 599px) {
  /* ✔ body全体の余白は0にして、ズレの根本原因を排除 */
  body {
    padding: 0;
  }

  /* ✔ サムネイル全体の表示エリアにのみ余白を付与 */
  .thumbnail-section {
    padding: 10px;
    box-sizing: border-box;
  }

  /* ✔ フッターにも余白を付与して、コンテンツが端にくっつかないようにする */
  footer {
    padding: 10px;
    box-sizing: border-box;
    margin: 0;       /* 念のため左右中央寄せを防止 */
    width: 100%;     /* 幅が狭くならないようにする */
  }

  /* 必要に応じてコメントのフォント調整は維持 */
  .thumbnail-item .comment {
    font-size: 13px;
  }
}