.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 (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;
    }
}