/* ========================================
   ニュースのカード（トップページ・ニュース一覧・ニュース記事下部で共通）
   マークアップ：template-parts/news-card.php
   PC：3列 / タブレット：2列 / スマホ：縦並び。角丸・片側だけの色線は使わない。
======================================== */
.nw-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nw-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid var(--color-border, #e2e8f0);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    color: var(--color-text, #0f172a);
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.nw-card-link:hover,
.nw-card-link:focus-visible {
    transform: translateY(-6px);
    border-color: rgba(30, 64, 175, 0.35);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.nw-card-link:focus-visible {
    outline: 2px solid var(--color-primary, #1e40af);
    outline-offset: 3px;
}

.nw-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--color-base-dark, #f1f5f9);
}

.nw-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.nw-card-link:hover .nw-card-image img {
    transform: scale(1.04);
}

.nw-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
    padding: 20px 24px 24px;
}

.nw-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.nw-card-date {
    color: var(--color-text-light, #64748b);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.nw-card-cat {
    padding: 1px 10px;
    border: 1px solid var(--color-primary, #1e40af);
    color: var(--color-primary, #1e40af);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.6;
}

.nw-card-title {
    margin: 0;
    color: var(--color-text, #0f172a);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.nw-card-link:hover .nw-card-title {
    color: var(--color-primary, #1e40af);
}

.nw-card-excerpt {
    margin: 0;
    color: var(--color-text-light, #64748b);
    font-size: 1.35rem;
    line-height: 1.75;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nw-card-excerpt:empty {
    display: none;
}

.nw-card-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 4px;
    color: var(--color-primary, #1e40af);
    font-size: 1.3rem;
    font-weight: 700;
}

.nw-card-more svg {
    transition: transform 0.3s ease;
}

.nw-card-link:hover .nw-card-more svg {
    transform: translateX(3px);
}

/* 横に並んだカードで「画像・日付・タイトル・抜粋・リンク」の高さをそろえる（subgrid 対応ブラウザ） */
@supports (grid-template-rows: subgrid) {
    .nw-grid {
        row-gap: 0;
    }

    .nw-card {
        display: grid;
        grid-row: span 5;
        grid-template-rows: subgrid;
        row-gap: 0;
        margin-bottom: 28px;
    }

    .nw-card-link {
        display: grid;
        grid-row: 1 / span 5;
        grid-template-rows: subgrid;
        row-gap: 0;
    }

    .nw-card-body {
        display: contents;
    }

    .nw-card .nw-card-image { grid-row: 1; }
    .nw-card .nw-card-meta { grid-row: 2; margin: 20px 24px 0; }
    .nw-card .nw-card-title { grid-row: 3; margin: 10px 24px 0; }
    .nw-card .nw-card-excerpt { grid-row: 4; margin: 8px 24px 0; }
    .nw-card .nw-card-excerpt:empty { display: block; }
    .nw-card .nw-card-more { grid-row: 5; align-self: end; margin: 14px 24px 24px; padding-top: 0; }
}

@media (max-width: 1024px) {
    .nw-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }
}

@media (max-width: 767px) {
    .nw-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    @supports (grid-template-rows: subgrid) {
        .nw-card .nw-card-meta { margin: 16px 18px 0; }
        .nw-card .nw-card-title { margin: 8px 18px 0; }
        .nw-card .nw-card-excerpt { margin: 6px 18px 0; }
        .nw-card .nw-card-more { margin: 12px 18px 20px; }
    }

    .nw-card-body {
        padding: 16px 18px 20px;
    }

    .nw-card-title {
        font-size: 1.5rem;
    }
}
