/* ==========================================================================
   Topics (WinterBlog) - 一覧・詳細共通スタイル
   ========================================================================== */

/* ---------- 共通ヘッダー部分 ---------- */
.topics-header {
    margin-bottom: 2rem;
    text-align: center;
}

.topics-header h1 {
    margin: 0 0 0.5rem;
    color: #003366;
    letter-spacing: 0.5px;
}

.topics-lead {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

.topics-empty {
    text-align: center;
    color: #888;
    padding: 3rem 0;
}

/* ---------- 一覧：カードグリッド ---------- */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 0 0 2.5rem;
}

.topic-card {
    border: 1px solid #eee;
    border-radius: 12px;
    background: #f9f9f9;
    overflow: hidden;
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.topic-card:hover {
    box-shadow: 0 6px 16px rgba(0, 51, 102, 0.12);
    transform: translateY(-2px);
}

.topic-card-link {
    display: flex;
    flex-direction: column; /* PC：縦並び */
    height: 100%;
    color: inherit;
    text-decoration: none;
}
/* サムネ：正方形 */
.topic-card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #eef2f7;
    flex-shrink: 0;
}

.topic-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.topic-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px 18px 20px;
}

.topic-card-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 550;
    color: #222;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-card-summary {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* カテゴリ・掲載日：本文の下端に揃える */
.topic-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.topic-card-category {
    display: inline-block;
    background: #eef2f7;
    color: #003366;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.topic-card-date {
    font-size: 0.78rem;
    color: #999;
}

/* ---------- 一覧：ページネーション ---------- */
.topics-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.topics-pagination a {
    background-color: #f2f2f2;
    padding: 0.3rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: #337ab7;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.topics-pagination a:hover {
    background-color: #337ab7;
    color: #fff;
}

.topics-pagination-status {
    font-size: 0.85rem;
    color: #888;
}

/* ---------- 詳細ページ ---------- */
.topic-detail {
    max-width: 760px;
    margin: 0 auto;
}

.topic-detail-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.topic-detail-category {
    display: inline-block;
    background: #eef2f7;
    color: #003366;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.topic-detail-title {
    margin: 0 0 10px;
    color: #003366;
    line-height: 1.5;
}

.topic-detail-date {
    display: block;
    font-size: 0.85rem;
    color: #999;
}

.topic-detail-thumb {
    margin: 0 0 2rem;
    border-radius: 12px;
    overflow: hidden;
}

.topic-detail-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

/* 記事本文（content_html）のスタイル */
.topic-detail-content {
    font-size: 0.98rem;
    line-height: 1.9;
    color: #333;
}

.topic-detail-content p {
    margin: 0 0 1.4em;
}

.topic-detail-content h2 {
    margin: 2em 0 1em;
    font-size: 1.3rem;
    color: #003366;
    font-weight: 550;
}

.topic-detail-content h3 {
    margin: 1.8em 0 0.8em;
    font-size: 1.1rem;
    color: #003366;
    font-weight: 550;
}

.topic-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
}

.topic-detail-content a {
    color: #337ab7;
}

.topic-detail-content ul,
.topic-detail-content ol {
    margin: 0 0 1.4em;
    padding-left: 1.4em;
}

.topic-detail-content blockquote {
    margin: 1.5em 0;
    padding: 0.8em 1.2em;
    border-left: 3px solid #337ab7;
    background: #f9f9f9;
    color: #555;
}

.topic-detail-content code {
    background: #eef2f7;
    color: #003366;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.topic-detail-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    text-align: center;
}

.topic-detail-back {
    display: inline-block;
    background-color: #f2f2f2;
    padding: 0.4rem 1.1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: #337ab7;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.topic-detail-back:hover {
    background-color: #337ab7;
    color: #fff;
}

.topic-detail-notfound {
    text-align: center;
    color: #888;
    padding: 3rem 0;
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 600px) {
    .topics-grid {
        grid-template-columns: 1fr;
    }

        /* カードを横並びに */
    .topic-card-link {
        flex-direction: row;
        align-items: stretch;
    }

    .topic-card-thumb {
        width: 35%;
        aspect-ratio: 1 / 1;
    }

    .topic-card-body {
        padding: 12px 14px;
    }

    .topic-card-title {
        font-size: 0.92rem;
        -webkit-line-clamp: 2;
    }

    .topic-card-summary {
        font-size: 0.8rem;
        -webkit-line-clamp: 2; /* 横幅が狭くなるので3行→2行に短縮 */
    }

    .topic-card-meta {
        gap: 8px;
    }

    .topic-detail-content {
        font-size: 0.95rem;
    }
}