/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', '思源宋体', 'Times New Roman', Georgia, serif;
    background-color: #f9f7f2;
    color: #2c2a28;
    line-height: 1.7;
    font-size: 18px;
    overflow-x: hidden; /* 防止横向滚动条 */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== 头部区域 ========== */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e6e0d4;
    padding: 20px 0;
    position: sticky;
    top: 0;
    backdrop-filter: blur(8px);
    background: rgba(255,255,245,0.95);
    z-index: 100;
}

/* 头部内容使用 flex 布局，方便移动端按钮对齐 */
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.logo {
    flex: 0 0 auto;
}

.logo a {
    font-size: 28px;
    font-weight: 400;
    text-decoration: none;
    color: #3f3a32;
    letter-spacing: 2px;
}

.site-desc {
    font-size: 14px;
    color: #8e8a7c;
    margin-left: 12px;
}

/* 桌面端导航菜单 */
.main-nav {
    flex: 1 1 auto;
    text-align: right;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 32px;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
}

.main-nav a {
    text-decoration: none;
    color: #4a453c;
    font-weight: 400;
}

.main-nav a:hover {
    color: #b08a5c;
}

/* 移动端菜单按钮 - 桌面端隐藏 */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

/* 三条杠图标 */
.navicon {
    display: block;
    width: 25px;
    height: 2px;
    background-color: #333;
    position: relative;
}

.navicon::before,
.navicon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #333;
    left: 0;
    transition: transform 0.3s ease;
}

.navicon::before {
    top: -8px;
}

.navicon::after {
    top: 8px;
}

/* 移动端样式 */
@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
        order: 2;
        margin-left: auto;
    }

    .main-nav {
        display: none;
        width: 100%;
        order: 3;
        background: #fff;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        text-align: left;
        margin-top: 20px;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }

    .main-nav li {
        border-bottom: 1px solid #eee;
    }

    .main-nav a {
        display: block;
        padding: 12px 20px;
    }
}

/* ========== 首页Banner ========== */
.home-banner {
    text-align: center;
    padding: 60px 20px;
    background: #fffdf9;
    margin-bottom: 40px;
    border-radius: 24px;
}

.home-banner h1 {
    font-size: 42px;
    font-weight: 300;
}

.home-banner p {
    font-size: 22px;
    color: #6c5e4e;
    max-width: 800px;
    margin: 20px auto 0;
}

/* ========== 分类模块（首页聚合模式） ========== */
.category-module {
    margin-bottom: 50px;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #e0d6c8;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.module-header h3 {
    font-size: 24px;
    font-weight: 400;
    color: #3f3a32;
}

.module-header a {
    font-size: 14px;
    color: #b08a5c;
    text-decoration: none;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.grid-item {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    transition: 0.3s;
    border: 1px solid #eae4d8;
}

.grid-item h4 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
}

.grid-item h4 a {
    text-decoration: none;
    color: #2f2b24;
}

.grid-item .item-meta {
    font-size: 13px;
    color: #9b8e7c;
    margin-bottom: 12px;
}

.grid-item .item-intro {
    font-size: 14px;
    color: #5e5a54;
    line-height: 1.5;
}

@media (max-width: 992px) {
    .article-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .article-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== 传统文章列表模式 ========== */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.post-item {
    border-bottom: 1px solid #eae4d8;
    padding-bottom: 32px;
}

.post-item h2 {
    font-size: 28px;
    font-weight: 400;
}

.post-item h2 a {
    text-decoration: none;
    color: #2f2b24;
}

.post-meta {
    font-size: 14px;
    color: #9b8e7c;
    margin: 12px 0;
}

.post-excerpt {
    color: #4e4a44;
    margin: 16px 0;
}

.read-more {
    color: #b08a5c;
    text-decoration: none;
    border-bottom: 1px solid #dccfb8;
}

/* ========== 文章页 ========== */
.post-full {
    max-width: 880px;
    margin: 0 auto;
    background: #fffdf9;
    padding: 40px;
    border-radius: 28px;
}

.post-title {
    font-size: 36px;
    font-weight: 300;
    line-height: 1.3;
}

.post-content {
    font-size: 18px;
    margin: 32px 0;
    overflow-x: auto;
    word-wrap: break-word;
}

.post-content h2, .post-content h3 {
    margin-top: 40px;
    font-weight: 400;
}

.post-content p {
    margin-bottom: 1.5em;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 20px 0;
}

.post-content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    border-collapse: collapse;
    width: 100%;
}

.post-content table td,
.post-content table th {
    border: 1px solid #ddd;
    padding: 8px;
}

/* 防止任何内容溢出 */
.post-content * {
    max-width: 100%;
    box-sizing: border-box;
}

/* 分页样式 */
.pagination {
    text-align: center;
    margin: 40px 0;
}

.page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    background: #fff;
    border: 1px solid #e0d6c8;
    border-radius: 30px;
    text-decoration: none;
    color: #5e4c39;
}

.page-numbers.current {
    background: #b08a5c;
    color: #fff;
    border-color: #b08a5c;
}

/* ========== 页脚 ========== */
.site-footer {
    background: #2c2822;
    color: #cbc5b8;
    text-align: center;
    padding: 40px 0;
    margin-top: 80px;
    font-size: 14px;
}

.footer-info a {
    color: #dccfb8;
    text-decoration: none;
}
/* ========== 修复卡片图片溢出 ========== */
.grid-item img,
.post-excerpt img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    border-radius: 8px;
}

/* 强制卡片内文字换行，防止溢出 */
.grid-item,
.post-item {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 统一卡片最小高度（可选，避免高度不一致） */
.grid-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.grid-item h4 {
    flex-shrink: 0;
}

.grid-item .item-intro {
    flex-grow: 1;
}