﻿/* ============================================================
   终极补丁：不管是 single-layout 还是 single-post-wrap 都用 grid
   ============================================================ */
.single-layout, .single-post-wrap {
    display: grid !important;
    grid-template-columns: 1fr 300px !important;
    gap: 48px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 40px 24px 0px !important;
    align-items: start !important;
    flex-wrap: unset !important;
}
.single-layout .single-main, .single-post-wrap .single-main {
    flex: none !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
}
.single-layout .sidebar, .single-post-wrap .sidebar {
    flex: none !important;
    width: 300px !important;
    max-width: 300px !important;
    min-width: 0 !important;
    display: block !important;
    grid-column: 2 !important;
}
@media (max-width: 768px) {
    .single-layout, .single-post-wrap {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }
    .single-layout .sidebar, .single-post-wrap .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        grid-column: auto !important;
    }
}
/* ================================================
   page-blog.css —— 博客列表 + 文章详情 + 侧边栏 + 分页
   ================================================ */

/* ========== 博客列表页 ========== */
.archive-section, .default-section {
    padding: 80px 0;
    background: var(--color-bg, #f8f9fa);
    min-height: 60vh;
}
.archive-header {
    text-align: center;
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 2px solid var(--color-border, #e2e6ea);
}
.archive-title {
    font-size: 36px;
    font-weight: 800;
    color: var(--color-primary-dark, #0d2f5f);
    margin-bottom: 12px;
}
.archive-description {
    max-width: 700px;
    margin: 0 auto;
    color: var(--color-text-light, #6c757d);
    font-size: 16px;
}

/* 博客卡片网格 */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
.post-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    transition: transform .3s, box-shadow .3s;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border, #e2e6ea);
}
.post-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(26,77,143,.15);
}
.post-thumb {
    display: block;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #eef2f7;
}
.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s;
}
.post-card:hover .post-thumb img { transform: scale(1.05); }
.post-body {
    padding: 20px 22px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.post-meta {
    font-size: 12px;
    color: var(--color-text-light, #6c757d);
    margin-bottom: 10px;
}
.post-meta .post-category a {
    color: var(--color-primary, #1a4d8f);
    font-weight: 600;
}
.post-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
    color: #1a2a40;
    margin-bottom: 10px;
}
.post-title a { color: inherit; text-decoration: none; }
.post-title a:hover { color: var(--color-primary, #1a4d8f); }
.post-excerpt {
    font-size: 14px;
    color: var(--color-text-light, #6c757d);
    line-height: 1.7;
    flex: 1;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.read-more {
    display: inline-block;
    color: var(--color-primary, #1a4d8f);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
}
.read-more:hover { color: var(--color-primary-dark, #0d2f5f); }

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 48px;
    flex-wrap: wrap;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--color-border, #e2e6ea);
    color: var(--color-text, #333);
    font-weight: 600;
    text-decoration: none;
}
.pagination .page-numbers:hover {
    background: var(--color-primary, #1a4d8f);
    color: #fff;
    border-color: var(--color-primary, #1a4d8f);
}
.pagination .current {
    background: var(--color-primary, #1a4d8f);
    color: #fff;
    border-color: var(--color-primary, #1a4d8f);
}

/* ========== 文章详情页（用 grid 替代 flex） ========== */
.single-layout {
    display: grid !important;
    grid-template-columns: 1fr 300px !important;
    gap: 48px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 40px 24px 0px !important;
    align-items: start !important;
}
.single-layout .single-main {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
}
.single-layout .sidebar {
    width: 300px !important;
    max-width: 300px !important;
    min-width: 0 !important;
    flex: none !important;
}

/* 文章正文 */
.post-content {
    font-size: 16px;
    line-height: 1.85;
    color: #2c3e50;
}
.post-content p { margin-bottom: 22px; }
.post-content h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-primary-dark, #0d2f5f);
    margin: 40px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-alt, #eef2f7);
}
.post-content h3 {
    font-size: 21px;
    font-weight: 700;
    color: #1a2a40;
    margin: 32px 0 14px;
}
.post-content ul, .post-content ol {
    margin: 0 0 22px 24px;
    line-height: 1.9;
}
.post-content li { margin-bottom: 6px; }
.post-content blockquote {
    border-left: 4px solid var(--color-secondary, #f4a300);
    background: #faf6ec;
    padding: 18px 24px;
    margin: 24px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #5a4a1e;
}
.post-content a {
    color: var(--color-primary, #1a4d8f);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.post-content img {
    border-radius: 10px;
    margin: 24px auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 15px;
}
.post-content th {
    background: var(--color-primary, #1a4d8f);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
}
.post-content td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border, #e2e6ea);
}
.post-content tr:nth-child(even) td { background: var(--color-bg, #f8f9fa); }

/* 上下篇导航 */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid var(--color-border, #e2e6ea);
}
.post-navigation > div {
    background: var(--color-bg, #f8f9fa);
    padding: 18px 20px;
    border-radius: 10px;
}
.post-navigation a {
    color: var(--color-primary, #1a4d8f);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    display: block;
    line-height: 1.5;
}
.post-navigation .nav-next { text-align: right; }

/* ========== 侧边栏 ========== */
.sidebar {
    max-width: 300px;
}
.widget {
    background: #fff;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
    margin-bottom: 20px;
    border: 1px solid var(--color-border, #e2e6ea);
}
.widget-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary-dark, #0d2f5f);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-alt, #eef2f7);
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--color-border, #e2e6ea);
}
.widget li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.widget a {
    color: var(--color-text, #333);
    font-size: 14px;
    line-height: 1.5;
    text-decoration: none;
}
.widget a:hover { color: var(--color-primary, #1a4d8f); }
.widget .cat-count {
    color: var(--color-text-light, #6c757d);
    font-size: 12px;
    margin-left: 4px;
}
.widget .recent-date {
    display: block;
    font-size: 12px;
    color: var(--color-text-light, #6c757d);
    margin-top: 4px;
}

/* 搜索表单 */
.search-form { display: flex; gap: 8px; }
.search-field {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--color-border, #e2e6ea);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}
.search-field:focus { border-color: var(--color-primary, #1a4d8f); }
.search-submit {
    background: var(--color-primary, #1a4d8f);
    color: #fff;
    border: none;
    padding: 0 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}
.search-submit:hover { background: var(--color-primary-dark, #0d2f5f); }

/* CTA widget */
.widget-cta {
    background: linear-gradient(135deg, var(--color-primary, #1a4d8f) 0%, var(--color-primary-dark, #0d2f5f) 100%) !important;
    color: #fff;
    text-align: center;
    border: none !important;
}
.widget-cta .widget-title {
    color: #fff;
    border-bottom-color: rgba(255,255,255,.3);
}
.widget-cta p {
    color: rgba(255,255,255,.9);
    font-size: 14px;
    margin-bottom: 14px;
}
.btn-block { width: 100%; display: block; text-align: center; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr); }

    /* 文章页：grid → 单列 */
    .single-layout {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }
    .single-layout .sidebar {
        width: 100% !important;
        max-width: 100% !important;
    }
}
@media (max-width: 768px) {
    .posts-grid { grid-template-columns: 1fr; }
    .archive-section, .default-section { padding: 48px 0; }
    .archive-title { font-size: 26px; }
    .single-layout {
        padding: 24px 16px 0px !important;
        gap: 24px !important;
    }
    /* 移动端：sidebar 显示在正文上方，底部紧贴 footer */
    .single-layout .single-main { order: 1; }
    .single-layout .sidebar { order: 2; margin-top: 24px; }
    .post-content { font-size: 15px; }
    .post-navigation { grid-template-columns: 1fr; }
}
/* ========== 归档列表页（archive.php + index.php） ========== */
.archive-page-header .container { text-align: center; }
.archive-page-header h1 { font-size: 40px; font-weight: 800; color: #fff; margin-bottom: 10px; line-height: 1.2; }
.archive-page-header .page-subtitle { font-size: 15px; color: rgba(255,255,255,.85); margin: 0; max-width: 680px; margin-left: auto; margin-right: auto; }

.archive-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: #f4a300;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.archive-body {
    padding: 48px 0 60px;
    background: #f8f9fa;
    min-height: 60vh;
}

/* 主内容 + sidebar 的 grid —— 和 single-layout 一致 */
.archive-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    align-items: start;
}
.archive-main { min-width: 0; }

/* 3 列卡片 grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* 卡片 */
.post-card {
    background: #fff;
    border: 1px solid #e2e6ea;
    border-radius: 10px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}

/* 缩略图 */
.post-card .post-thumb {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #eef4fb;
    display: block;
}
.post-card .post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
    display: block;
}
.post-card:hover .post-thumb img { transform: scale(1.05); }

/* 卡片正文 */
.post-body { padding: 18px 20px 20px; flex: 1; display: flex; flex-direction: column; }

.post-meta { margin-bottom: 6px; }
.post-category {
    font-size: 11.5px;
    font-weight: 700;
    color: #f4a300;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.post-card .post-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.4;
    color: #1a2e4a;
}
.post-card .post-title a { color: inherit; text-decoration: none; }
.post-card .post-title a:hover { color: #1a4d8f; }

.post-excerpt {
    font-size: 14px;
    color: #6c757d;
    margin: 0 0 14px;
    line-height: 1.55;
    flex: 1;
}

.post-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #adb5bd;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed #e9ecef;
}

.post-card .read-more {
    font-size: 13px;
    font-weight: 700;
    color: #1a4d8f;
    text-decoration: none;
}
.post-card .read-more:hover { text-decoration: underline; }

.empty-message {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e6ea;
}

/* sidebar 在 archive-layout 里 */
.archive-layout .sidebar {
    width: 300px;
    max-width: 300px;
    min-width: 0;
    position: sticky;
    top: 88px;
    align-self: start;
}

/* 分页 */
.pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .archive-layout { grid-template-columns: 1fr 280px; gap: 32px; }
    .archive-layout .sidebar { width: 280px; max-width: 280px; }
}
@media (max-width: 768px) {
    .posts-grid { grid-template-columns: 1fr; }
    .archive-layout { grid-template-columns: 1fr; gap: 32px; }
    .archive-layout .sidebar { width: 100%; max-width: 100%; position: static; }
    .archive-page-header h1 { font-size: 28px; }
    .archive-body { padding: 32px 0 40px; }
}
