/**
 * Project - Post Card
 * 投稿カード・一覧（case / news / aio-lab / post 共通）
 * 使用: template-parts/case-card.php, news-card.php, aio-lab-card.php, post-card.php
 */

.p-caseHeadingWrapper {
  margin-bottom: 46px;
}

/* テーブル風：各 li に全面 border を付け、隣接する辺を nth-child で除去して 1px に見せる
 * ※ 親に border-top/left を持たせる方式は親が 100% 幅のため最終行が不完全な場合に上線が突き抜ける */
.p-caseList {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  list-style: none;
  margin: 40px 0 0 0;
  padding: 0;

  @media (max-width: 1024px) {
    grid-template-columns: repeat(2, 1fr);
  }
  @media (max-width: 767px) {
    grid-template-columns: 1fr;
  }
}

.p-caseList > li {
  border: 1px solid var(--color-border-black);
}

/* 3列: 2列目以降の left・2行目以降の top を除去 */
@media (min-width: 1025px) {
  .p-caseList > li:not(:nth-child(3n + 1)) {
    border-left: none;
  }
  .p-caseList > li:nth-child(n + 4) {
    border-top: none;
  }
}

/* 2列: 2列目の left・2行目以降の top を除去 */
@media (min-width: 768px) and (max-width: 1024px) {
  .p-caseList > li:not(:nth-child(2n + 1)) {
    border-left: none;
  }
  .p-caseList > li:nth-child(n + 3) {
    border-top: none;
  }
}

/* 1列: 2件目以降の top を除去 */
@media (max-width: 767px) {
  .p-caseList > li:not(:first-child) {
    border-top: none;
  }
}

.p-caseCard {
  height: 100%;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background-color: var(--color-bg-white);
  border: none;
  position: relative;
  cursor: pointer;

  &.--hasYellowObject {
    &::before {
      content: "";
      display: inline-block;
      width: 20px;
      height: 20px;
      background-color: #ebb700;
      clip-path: polygon(0 0, 100% 0, 100% 100%);
      position: absolute;
      top: 0;
      right: 0;
    }
  }
}
.p-caseCardFigure {
  margin: 0;

  img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 16 / 9;
  }
}
.p-caseCardBody {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.p-caseCardTags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.5rem;
}
.p-caseCardTitle {
  margin: 0 0 0.5rem;
  min-height: 2.8em;
  display: flex;
  align-items: center;
}
.p-caseCardTitle__inner {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.p-caseCardText {
  margin: 0;
  flex: 1;
  min-height: 0;
  font-size: 0.875rem;
  line-height: 1.8;
  letter-spacing: 0.02em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  max-height: calc(1.8em * 3); /* line-height × 行数でクランプを確実に */
  margin-bottom: 0.75rem;
}
.p-caseCardFooter {
  margin-top: auto;
}
.p-caseCardLink {
  font-weight: 700;
  line-height: 1;
  padding-block: 0.5rem;
  padding-right: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;

  /* 矢印アイコン */
  &::before {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-image: url("../../../images/icon_arrow_right_black.svg");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    order: 1;
  }

  /* カード全体をリンク範囲にする stretched link */
  &::after {
    content: "";
    position: absolute;
    inset: 0;
  }
}
