section.recomend {
  margin-top: 48px;
}

h3.recommend-title {
  margin-top: 32px;
  margin-bottom: 12px;
  display: inline-block; /* h3の幅を文字だけにする */
  position: relative;    /* 擬似要素の位置基準 */
}

h3.recommend-title::after {
  content: "";
  display: block;
  border-bottom: 2px solid var(--text-color);
  margin-top: 4px; /* 文字と線の間隔 */
}


.card-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 常に4列 */
  grid-auto-rows: 1fr; /* 全ての行を同じ高さに */
}

.recommend-post-card {
  background: #fff;
  border: 2px solid #dbd8d8;
  overflow: hidden;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  height: 100%;
}

.recommend-post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.recommend-post-card a {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.recommend-post-card-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  padding-bottom: 40px; /* カテゴリ用のスペース */
}

.recommend-post-card-container p{
  margin:0;
  padding: 0 10px;
}

.recommend-post-card img.thumbnail {
  border-bottom: 2px solid var(--border-color);
  width: 100%;
  height: 130px; /* 固定の高さを設定 */
  object-fit: cover; /* 画像をトリミングして表示 */
  display: block;
}

/* 1024px以上の画面でレスポンシブ対応 */
@media (min-width: 1025px) {
  .recommend-post-card img.thumbnail {
    height: auto;
    aspect-ratio: 4 / 3; /* アスペクト比を設定 */
  }
  
  .recommend-post-card h4.top-h4 {
    font-size: clamp(0.75rem, 1vw, 1rem); /* 画面サイズに応じて文字サイズを調整 */
    padding: clamp(6px, 1vw, 12px) 10px;
    min-height: 80px; /* 大画面での最小高さ */
  }
  
  .card-container {
    gap: clamp(15px, 2vw, 12px); /* 画面サイズに応じてギャップを調整 */
  }
}

.recommend-post-card h4.top-h4 {
  padding: 8px 10px;
  font-size: 0.85rem;
  text-align: center;
  margin: 0;
  min-height: 60px; /* 最小高さを設定 */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

p.card-category {
  position: absolute;
  bottom: 10px;
  right: 10px;
  text-align: center;
  font-size: 10px;
  margin: 0;
  padding: 2px 4px;
  border: 1px solid #dbd8d8;
  border-radius: 5px;
  background-color: rgba(255, 255, 255, 0.9);
  font-weight: bold;
}

/* カテゴリー別の色設定 */
p.card-category-spiritual {
  border-color: var(--category-spiritual);
  background-color: var(--category-spiritual);
}

p.card-category-positive {
  border-color: var(--category-positive);
  background-color: var(--category-positive);
}

p.card-category-health {
  border-color: var(--category-health);
  background-color: var(--category-health);
}



/* タブレット時は2列 */
@media (max-width: 1024px) {
  .card-container {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr; /* 全ての行を同じ高さに */
    gap: 10px; /* 画面サイズに応じてギャップを調整 */
  }
}

/* スマホ時は2列 */
@media (max-width: 767px) {
  h3.recommend-title {
    display: table; /* 文字の幅に合わせる */
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
  
  h3.recommend-title::after {
    width: 100%; /* 文字の幅に合わせる */
  }

  .card-container {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr; /* 全ての行を同じ高さに */
    gap: 10px; /* 狭い画面では間隔を小さく */
  }
}

.reccomend-read-more {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  padding-right: 10px;
}

.reccomend-read-more a {
  display: inline-block;
  text-decoration: none;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  color: var(--text-color);
}

.reccomend-read-more a:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  color: var(--text-color);
}

.read-more-spiritual a{
  border: 1px solid var(--category-spiritual);
  background-color: var(--category-spiritual);
}

.read-more-positive a{
  border: 1px solid var(--category-positive);
  background-color: var(--category-positive);
}

.read-more-health a{
  border: 1px solid var(--category-health);
  background-color: var(--category-health); 
}