:root {
    --bg-color: #f2f5f7;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --primary-light: #e0e7ff;
    --border-radius: 12px;
    --shadow: 0 2px 10px rgba(0,0,0,0.04);
    --shadow-hover: 0 8px 20px rgba(0,0,0,0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* 顶部导航 */
.site-header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}
.main-nav {
    display: flex;
    gap: 24px;
}
.main-nav a {
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
}
.main-nav a:hover, .main-nav a.active {
    color: var(--text-main);
}
.header-actions {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    cursor: pointer;
}

/* 网格布局 */
.container {
    max-width: 1280px;
    margin: 24px auto;
    padding: 0 24px;
}
.layout-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

/* 卡片通用 */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

/* ===== 左侧边栏 ===== */
/* 1. 个人名片 */
.profile-card {
    text-align: center;
    padding-bottom: 16px;
}
.profile-bg {
    height: 100px;
    background-size: cover;
    background-position: center;
    position: relative;
}
.profile-avatar img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid var(--card-bg);
    margin-top: -36px;
    position: relative;
    z-index: 2;
}
.profile-name {
    font-size: 1.1rem;
    margin-top: 8px;
}
.profile-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 4px 0 12px;
}
.profile-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.profile-stats span {
    margin: 0 4px;
}
.profile-btns {
    display: flex;
    gap: 8px;
    padding: 0 16px;
}
.btn {
    flex: 1;
    padding: 6px 0;
    border-radius: 6px;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-outline {
    background: var(--bg-color);
    color: var(--text-main);
}

/* 2. 日期卡片 */
.calendar-card {
    padding: 16px;
}
.cal-header {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.cal-body {
    display: flex;
    align-items: center;
    gap: 16px;
}
.cal-date .day {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    line-height: 1;
}
.cal-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 3. 进度条卡片 */
.countdown-card {
    padding: 16px;
}
.countdown-title {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 12px;
}
.countdown-days {
    color: var(--primary);
    font-size: 1.2rem;
}
.progress-item {
    margin-bottom: 12px;
}
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}
.progress-inner {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
}

/* 4. 归档卡片 */
.archive-card {
    padding: 16px;
}
.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 12px;
    color: var(--text-muted);
}
.archive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.arc-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 6px 0;
    border-radius: 6px;
}
.arc-item span:last-child {
    font-weight: bold;
    color: var(--text-main);
}

/* 5. 标签云 */
.tags-card {
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag-item {
    font-size: 0.8rem;
    background: #f3f4f6;
    color: #4b5563;
    padding: 4px 10px;
    border-radius: 20px;
    transition: all 0.2s;
}
.tag-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.tag-item sup {
    font-size: 0.6rem;
    color: #9ca3af;
    margin-left: 2px;
}

/* ===== 右侧主内容区 ===== */
/* ===== 顶部筛选导航 (支持换行) ===== */
.filter-nav {
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;       /* 🔑 关键：允许换行，替代原来的横向滚动 */
    align-items: center;
    gap: 8px;              /* 项目之间的间距 */
    /* overflow-x: auto;     删除或注释掉这一行 */
    line-height: 1.8;      /* 换行后行与行之间更舒展 */
}

.filter-nav a {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 6px;    /* 圆角按钮样式 */
    color: var(--text-muted);
    white-space: nowrap;   /* 保证单个分类名不被截断 */
    text-decoration: none;
    transition: all 0.2s ease;
}

.filter-nav a:hover,
.filter-nav a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3); /* 加一点微阴影提升质感 */
}

/* 文章瀑布流 */
.post-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.post-card {
    margin-bottom: 0;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.sticky-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(37, 99, 235, 0.9);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 10;
}
.post-thumb {
    position: relative;
    height: 180px;
    overflow: hidden;
}
.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.post-card:hover .post-thumb img {
    transform: scale(1.05);
}
.post-category {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
}
.post-info {
    padding: 16px;
}
.post-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    line-height: 1.4;
}
.post-excerpt {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.post-tags a {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.post-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #9ca3af;
    border-top: 1px solid #f3f4f6;
    padding-top: 12px;
}

/* 分页 */
.pagination {
    margin-top: 24px;
    text-align: center;
}
.page-nav a, .page-nav span {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 4px;
    border-radius: 6px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    color: var(--text-main);
    font-size: 0.9rem;
}
.page-nav .active {
    background: var(--primary);
    color: white;
}
/* 页脚 */
.site-footer { text-align: center; padding: 24px 0; color: var(--text-muted); font-size: 0.85rem; }
/* 响应式设计 */
@media (max-width: 1024px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none; /* 移动端隐藏侧边栏，可改为抽屉式 */
    }
}
@media (max-width: 768px) {
    .post-grid {
        grid-template-columns: 1fr;
    }
    .header-inner {
        padding: 0 16px;
    }
    .main-nav {
        display: none; /* 移动端隐藏顶部导航 */
    }
}



/* ===== 文章详情页 & 独立页面样式 ===== */
.post-single {
    padding: 30px;
}

.post-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e5e7eb;
}

.post-header .post-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.4;
}

.post-meta-single {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.post-meta-single a {
    color: var(--text-muted);
}
.post-meta-single a:hover {
    color: var(--primary);
}

/* 正文内容排版 (核心) */
.post-content-body {
    font-size: 1rem;
    line-height: 1.8;
    color: #374151;
    word-wrap: break-word;
}

/* 段落 */
.post-content-body p {
    margin-bottom: 1.2em;
}

/* 标题 */
.post-content-body h2, 
.post-content-body h3, 
.post-content-body h4 {
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    font-weight: 600;
    color: var(--text-main);
}
.post-content-body h2 { font-size: 1.4rem; border-left: 4px solid var(--primary); padding-left: 10px; }
.post-content-body h3 { font-size: 1.2rem; }

/* 链接 */
.post-content-body a {
    color: var(--primary);
    border-bottom: 1px solid transparent;
    transition: border 0.2s;
}
.post-content-body a:hover {
    border-bottom: 1px solid var(--primary);
}

/* 图片 */
.post-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 20px auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* 引用 */
.post-content-body blockquote {
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    padding: 15px 20px;
    margin: 20px 0;
    color: #64748b;
    border-radius: 0 8px 8px 0;
}

/* 行内代码 */
.post-content-body code {
    background: #f1f5f9;
    color: #ef4444;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9em;
}

/* 代码块 */
.post-content-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9em;
    line-height: 1.5;
}
.post-content-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* 表格 */
.post-content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
}
.post-content-body th, .post-content-body td {
    border: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
}
.post-content-body th {
    background: #f8fafc;
    font-weight: 600;
}

/* 文章底部标签 */
.post-footer-tags {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #e5e7eb;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.post-footer-tags a {
    display: inline-block;
    background: #f3f4f6;
    padding: 3px 10px;
    border-radius: 15px;
    margin: 0 5px 5px 0;
    color: #4b5563;
    transition: all 0.2s;
}
.post-footer-tags a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* 上一篇/下一篇 */
.post-near {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    gap: 20px;
}
.near-item {
    flex: 1;
    font-size: 0.9rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.near-item.next {
    text-align: right;
}
.near-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.near-item a {
    color: var(--text-main);
    font-weight: 500;
}
.near-item a:hover {
    color: var(--primary);
}

/* 评论样式优化 */
.comment-form input, .comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 15px;
    font-family: inherit;
    font-size: 0.9rem;
    background: #f9fafb;
    transition: border 0.2s;
}
.comment-form input:focus, .comment-form textarea:focus {
    border-color: var(--primary);
    outline: none;
    background: #fff;
}
.comment-form button[type="submit"] {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.comment-form button[type="submit"]:hover {
    background: #1d4ed8;
}

/* 移动端适配补充 */
@media (max-width: 768px) {
    .post-single { padding: 20px 15px; }
    .post-header .post-title { font-size: 1.4rem; }
    .post-near { flex-direction: column; }
    .near-item.next { text-align: left; }
}