/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.3;
    /* ✅ 统一：所有文本默认 1.3 倍行距 */
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    display: grid;
    grid-template-areas:
        "header header"
        "main sidebar"
        "footer footer";
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr 300px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px;
    gap: 20px;
}

/* 响应式：小屏下堆叠 */
@media (max-width: 768px) {
    .container {
        grid-template-areas:
            "header"
            "main"
            "sidebar"
            "footer";
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 15px;
    }
}

/* 头部 */
.header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.8rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 导航 */
.nav {
    position: relative;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 15px;
}

.nav-list a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.3s;
}

.nav-list a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 汉堡菜单 */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 小屏显示汉堡菜单 */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-list {
        position: absolute;
        top: 100%;
        right: 0;
        background: white;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        flex-direction: column;
        width: 200px;
        padding: 10px 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
    }

    .nav-list.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-list li {
        margin: 0;
    }

    .nav-list a {
        color: #333;
        padding: 10px 20px;
    }

    .nav-list a:hover {
        background: #f5f5f5;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}

.markdown-body,
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body li,
.markdown-body table,
.markdown-body td,
.markdown-body th,
.markdown-body dl,
.markdown-body dt,
.markdown-body dd {
    line-height: 1.3;
    margin: 0.65em 0;
    /* 统一底部间距 */
}

/* 主内容 */
.main {
    grid-area: main;
    background: white;
    border-radius: 12px;
    padding: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    line-height: inherit;
    /* ✅ 继承 body 的 1.3 */
}

/* ========== 统一非代码内容的行距与间距 ========== */

/* 所有块级文本元素：统一行距 + 底部间距 */

/* 标题：保留自己的 margin，不继承统一 margin */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    color: #2c5282;
    /* margin-top: 0; */
    /* 避免与上文间距叠加 */
}

/* 增强的标题样式 */
.markdown-body h1 {
    font-size: 2.2rem;
    font-weight: 700;
    border-bottom: 2px solid #4299e1;
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

.markdown-body h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 1em 0;
    color: #2b6cb0;
}

.markdown-body h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.8em 0;
    color: #2c5282;
}

.markdown-body h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
}

.markdown-body h5 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #4a5568;
}

.markdown-body h6 {
    font-size: 1rem;
    font-weight: 500;
    color: #718096;
    text-transform: lowercase;
    font-style: italic;
}

.markdown-body li {
    margin-left: 1.5em;
}

/* 链接 */
.markdown-body a {
    color: #4299e1;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

/* 代码块：例外处理 */
.markdown-body pre {
    line-height: 1.6;
    /* ✅ 保持宽松 */
    background: #f7fafc;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
    /* 与段落间距一致 */
}

.markdown-body blockquote {
    background: #f1f3f5cc;
    line-height: 1.6;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.markdown-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    /* background: #f1f3f5; */
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.95em;
    line-height: 1;
    /* 紧凑显示 */
    background: #f7fafc;
}

/* ========== 表格样式 ========== */

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    /* 加粗的表格外线 */
    border: 2px solid #2c5282;
    table-layout: auto;
    overflow: hidden;
    border-radius: 8px;
    /* 阴影增强可读性 */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* 确保边框可见 */
    border-spacing: 0;
}

.markdown-body th,
.markdown-body td {
    padding: 12px 15px;
    text-align: left;
    /* 普通的表格内线 */
    border: 1px solid #ccc;
}

/* 表头样式 */
.markdown-body thead th {
    background: #4299e1;
    /* 蓝色背景 */
    color: white;
    /* 白色文字 */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* 加粗的表头与内容分隔线 */
    border-bottom: 2px solid #2c5282;
}

/* 表格主体（内容）背景色 */
.markdown-body tbody tr {
    background: #f7fafc;
    /* 浅灰蓝背景 */
}

/* 鼠标悬停效果（可选） */
.markdown-body tbody tr:hover {
    background: #ebf8ff;
    transition: background 0.2s;
}

/* 修正：确保第一行和最后一行圆角 */
.markdown-body thead tr:first-child th:first-child {
    border-top-left-radius: 6px;
}

.markdown-body thead tr:first-child th:last-child {
    border-top-right-radius: 6px;
}

[align="right"] {
    text-align: right;
}

[align="center"] {
    text-align: center;
}

/* 侧边栏 */
.sidebar {
    grid-area: sidebar;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    align-self: start;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid #4299e1;
    padding-bottom: 5px;
}

.sidebar ul {
    list-style: none;
    margin: 0 0 1.5em 0;
}

.sidebar li {
    margin: 0.75em 0;
}

.sidebar a {
    color: #4a5568;
    text-decoration: none;
    transition: color 0.2s;
}

.sidebar a:hover {
    color: #2b6cb0;
}

/* 页脚 */
.footer {
    grid-area: footer;
    text-align: center;
    color: white;
    font-size: 0.9rem;
    padding: 20px;
    margin-top: 20px;
}

/* ========== 新增：文章摘要卡片样式 =========== */

/* 主内容区用于显示多篇文章摘要 */
#posts-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.post-card h1 {
    font-size: 1.8rem;
    color: #2c5282;
    margin: 0 0 1rem 0;
    font-weight: 700;
    border-bottom: 2px solid #4299e1;
    padding-bottom: 0.5em;
}

.post-card p {
    margin: 0.5em 0;
    color: #4a5568;
    line-height: 1.5;
}

.post-card strong {
    color: #2d3748;
    font-weight: 600;
}

.btn-read-more {
    display: inline-block;
    margin-top: 1.2em;
    padding: 0.8em 1.5em;
    background: #4299e1;
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 6px;
    transition: background 0.3s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.3);
}

.btn-read-more:hover {
    background: #3182ce;
    transform: scale(1.03);
}

.btn-read-more:active {
    transform: scale(1);
}

/* ========== 暗色模式适配 =========== */

@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #0d1117 0%, #21262d 100%);
        color: #e6e6e6;
    }

    .header,
    .main,
    .sidebar {
        background: rgba(30, 41, 59, 0.4);
        backdrop-filter: blur(10px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    .header h1,
    .nav-list a {
        color: #e6e6e6;
    }

    .nav-list a:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .main,
    .sidebar {
        background: rgba(30, 41, 59, 0.7);
    }

    .markdown-body h1 {
        color: #63b3ed;
        border-bottom-color: #4299e1;
    }

    .markdown-body h2 {
        color: #63b3ed;
    }

    .markdown-body h3 {
        color: #81e6d9;
    }

    .markdown-body h4 {
        color: #d69e2e;
    }

    .markdown-body h5 {
        color: #d53f8c;
    }

    .markdown-body h6 {
        color: #a0aec0;
    }

    .markdown-body a {
        color: #63b3ed;
    }

    .markdown-body pre {
        background: #2d3748;
    }

    .markdown-body code {
        background: #2d3748;
        color: #e2e8f0;
    }

    .markdown-body blockquote {
        background: #4a5568cc;
    }

    .markdown-body table {
        border: 2px solid #63b3ed;
    }

    .markdown-body th,
    .markdown-body td {
        border: 1px solid #4a5568;
    }

    .markdown-body thead th {
        background: #2b6cb0;
        color: white;
        border-bottom: 2px solid #63b3ed;
    }

    .markdown-body tbody tr {
        background: #2d3748;
    }

    .markdown-body tbody tr:hover {
        background: #3a435a;
    }

    .sidebar h3 {
        color: #f7fafc;
        border-bottom-color: #63b3ed;
    }

    .sidebar a {
        color: #e2e8f0;
    }

    .sidebar a:hover {
        color: #63b3ed;
    }

    .footer {
        color: #a0aec0;
    }

    /* 暗色模式下卡片样式 */
    .post-card {
        background: rgba(30, 41, 59, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    .post-card h1 {
        color: #63b3ed;
        border-bottom-color: #4299e1;
    }

    .post-card p {
        color: #e2e8f0;
    }

    .post-card strong {
        color: #f7fafc;
    }

    .btn-read-more {
        background: #3182ce;
        box-shadow: 0 2px 4px rgba(49, 130, 206, 0.4);
    }

    .btn-read-more:hover {
        background: #4299e1;
    }
}

/* 响应式：小屏优化 */
@media (max-width: 768px) {
    .markdown-body table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .post-card {
        padding: 20px;
    }

    .btn-read-more {
        padding: 0.7em 1.2em;
        font-size: 0.95rem;
    }
}