/* ==================================================================
   作品集 / 說明列表：四欄卡片版面
   ------------------------------------------------------------------
   桌機由左到右一行 4 個；中型螢幕 2 個；手機 1 個。
   只套用 .post-list--four，不影響標籤頁或其他文章列表。
   ================================================================== */

/* ---------- 作品集標題與標籤 ---------- */
.portfolio-hero__title {
  margin-bottom: var(--space-2);
  white-space: nowrap;
}

.portfolio-hero__tags {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
}

.portfolio-hero__tags .tag {
  font-size: 0.88rem;
  white-space: nowrap;
}

.portfolio-hero .hero__desc {
  margin-top: var(--space-2);
}

.post-list--four {
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 2rem 1.5rem;
  align-items: start;
}

.post-list--four .post-card {
  min-width: 0;
  height: 100%;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.post-list--four .post-card__body {
  min-width: 0;
}

/* 四欄版的文章標題與介紹稍微放大，讓卡片更容易閱讀 */
.post-list--four .post-card__title {
  font-size: 1.28rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.post-list--four .post-card__excerpt {
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-list--four .post-card__meta,
.post-list--four .tag {
  font-size: 0.82rem;
}

/*
 * 說明頁第一篇有封面、p5.js 沒有封面。
 * 替沒有封面的卡片預留相同的 16:9 封面高度，
 * 讓兩張卡片都從同一條「文字起跑線」開始。
 */
@media (min-width: 40rem) {
  .post-list--guide .post-card:not(:has(.post-card__thumb))::before {
    content: "";
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  /*
   * 作品集與說明頁共用固定文字列：
   * 1. 主題
   * 2. 介紹
   * 3. 日期
   * 4. 標籤
   * 讓同一排的主題、介紹、日期各自水平對齊。
   */
  .post-list--four .post-card__body {
    display: grid;
    grid-template-rows: 7.68rem 9.45rem 1.4rem auto;
    row-gap: 0.8rem;
    align-content: start;
  }

  .post-list--four .post-card__title {
    grid-row: 1;
    height: 7.68rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }

  .post-list--four .post-card__excerpt {
    grid-row: 2;
    height: 9.45rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    align-self: start;
  }

  /* 日期放在介紹下方 */
  .post-list--four .post-card__meta {
    grid-row: 3;
    min-height: 1.4rem;
    margin: 0;
    align-self: start;
  }

  .post-list--four .tag-list {
    grid-row: 4;
    align-self: start;
  }
}

/* 兩欄 */
@media (min-width: 40rem) {
  .post-list--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 桌機四欄，由左到右排列 */
@media (min-width: 58rem) {
  .post-list--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
