/* assets/css/components/card.css
   Card component (clean, layer: comp)
===================================== */

@layer comp {

  /* ===============================
     Base
  =============================== */
  .c-card{
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    border-radius: 14px;
    overflow: hidden;
    color: var(--cd-fg);
    display: block;
    transition:
      border-color .18s ease,
      background-color .18s ease,
      transform .18s ease;
  }

  /* Link wrapper */
  .c-card__link{
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
  }

  /* ===============================
     Media
  =============================== */
  .c-card__media{
    position: relative;
    aspect-ratio: 16/10; /* 既定。下の r-* で上書き可 */
    overflow: hidden;
  }

  .c-card__img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Pill */
  .c-card__pill{
    position: absolute;
    left: 10px;
    top: 10px;
  }

  /* ===============================
     Body
  =============================== */
  .c-card__body{
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* Title (2 lines) */
  .c-card__title{
    font-weight: 600;
    font-size: clamp(14px, 1.5vw, 16px);
    line-height: 1.35;
    margin: 0;
    color: var(--cd-fg);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Meta / Excerpt */
  .c-card__meta{
    font-size: 12px;
    opacity: .75;
    color: var(--cd-muted);
  }

  .c-card__excerpt{
    display: none !important; /* 今は抜粋非表示運用 */
  }

  /* ===============================
     Ratio modifiers
  =============================== */
  .c-card.r-16-10 .c-card__media{ aspect-ratio: 16/10; }
  .c-card.r-3-2   .c-card__media{ aspect-ratio: 3/2; }
  .c-card.r-1-1   .c-card__media{ aspect-ratio: 1/1; }

  /* ===============================
     Hover / Focus
  =============================== */
  .c-card:hover{
    border-color: color-mix(in oklab, var(--cd-accent), var(--cd-border) 60%);
    background: color-mix(in oklab, var(--cd-bg), white 4%);
    transform: translateY(-1px);
  }

  .c-card:has(.c-card__link:focus-visible){
    outline: 2px solid var(--cd-accent);
    outline-offset: 2px;
  }

  /* ===============================
     Mobile tweaks（スマホの縦幅を少し詰める）
  =============================== */
  @media (max-width: 600px){
    .c-card__body{
      padding: 10px 10px 12px; /* 横パディングだけ少し詰める */
      gap: 4px;                /* タイトル〜日付の間隔を半分に */
    }

    .c-card__title{
      font-size: 0.95rem;
      line-height: 1.45;
    }

    .c-card__meta{
      font-size: 0.78rem;
      line-height: 1.4;
      margin-top: 0;
    }
  }

} /* @layer comp */
