@charset "UTF-8";

/* ---------------- 基本設定 ---------------- */
#topics {
  background: var(--gray2, rgba(228, 228, 228, 0.6));
}
.page-title {
  padding-bottom: 0;
}
#topics section {
  padding: 4rem 4%;
}

/* --- メタ情報 --- */
.topic-meta {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.9rem;
  color: #333;
}
.topic-label {
  display: inline-block;
  background-color: #eef6f8;
  color: #007b94;
  padding: 0.2em 0.6em;
  border-radius: 0.5em;
  font-weight: 600;
}
.topic-meta time {
  color: #666;
  font-size: 0.85em;
}

/* --- カード共通 --- */
.topics-container {
  list-style: none;
  margin: 0;
  padding: 0;
}
.topics-item {
  border-radius: 8px;
  border: var(--gray, #ccc) solid 1px;
  overflow: hidden;
  background: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* リンク化 */
.topics-item > a {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

/* --- 画像部分 --- */
.topics-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.topics-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- テキスト部分 --- */
.topics-text {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex-grow: 1;
  color: #333;
}
.topics-text p {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  line-height: 1.4em;
  max-height: calc(1.4em * 2);
  min-height: calc(1.4em * 2);
}

/* --- 背景画像タイプ（オーバーレイ） --- */
.topics-item.topics-bg-item {
  position: relative;
  background-size: cover;
  background-position: center;
  color: #fff;
}
.topics-item.topics-bg-item .topics-image {
  display: none;
}
.topics-item.topics-bg-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1;
	pointer-events: none; 
}
.topics-item.topics-bg-item .topics-text {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  color: #fff;
}
.topics-item.topics-bg-item .topic-meta,
.topics-item.topics-bg-item time,
.topics-item.topics-bg-item p {
  color: #fff;
}

/* ---------------- モバイル（初期） ---------------- */
.topics-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

/* ---------------- タブレット（3列） ---------------- */
@media (min-width: 768px) {
  .topics-container {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    align-items: stretch;
  }

  /* 通常カード */
  .topics-item {
    display: flex;
    flex-direction: column;
  }

  /* 2列ぶち抜きカード */
  .topics-item.t-item-1 {
    grid-column: span 2;
  }

  /* ぶち抜きカードも高さを小カードと揃える */
  .topics-item.t-item-1 .topics-image {
    aspect-ratio: 8 / 3; /* 幅2倍なので比率を調整して高さ一致 */
  }
  .topics-item.t-item-1 .topics-image img {
    object-fit: cover;
  }

  /* Pタグ調整 */
  .topics-text p {
    font-size: 1.4rem;
    line-height: 1.3;
  }
}

/* ---------------- PC（4列） ---------------- */
@media (min-width: 1024px) {
  .topics-container {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    align-items: stretch;
  }

  /* 2列ぶち抜きカード */
  .topics-item.t-item-1 {
    grid-column: span 2;
  }

  .topics-item.t-item-1 .topics-image {
    aspect-ratio: 8 / 3;
  }

  .topics-item.t-item-1 .topics-image img {
    object-fit: cover;
  }

  .topics-text p {
    font-size: 1.6rem;
    line-height: 1.4;
  }
}
