/* ============================================================
   公告页（目录 + 详情）
   ============================================================ */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body.posts-page {
    font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.8;
    color: #616161;
    background: #CFCFCF;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============ 头部 ============ */
.posts-header {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px 8px;
}
.back-link {
    display: inline-block;
    font-size: 14px;
    color: #616161;
    text-decoration: none;
    opacity: .7;
    transition: opacity .15s;
}
.back-link:hover { opacity: 1; }

.posts-title {
    margin: 12px 0 0;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #3a3a3a;
}

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* ============ 主体 ============ */
.posts-main {
    flex: 1;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px 60px;
}

.empty {
    color: #808080;
    text-align: center;
    padding: 60px 0;
}

/* ============ 目录列表 ============ */
.posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.post-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.post-item:last-child { border-bottom: none; }

.post-link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 4px;
    text-decoration: none;
    color: #616161;
    transition: color .15s, padding .15s;
}
.post-link:hover {
    color: #2a2a2a;
    padding-left: 10px;
}
.post-title {
    font-size: 16px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
}
.post-date {
    flex: 0 0 auto;
    font-size: 13px;
    color: #8a8a8a;
    font-variant-numeric: tabular-nums;
}

/* ============ 详情 ============ */
.post-article {
    padding: 8px 0 0;
}
.post-heading {
    margin: 8px 0 8px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: .8px;
    color: #3a3a3a;
    line-height: 1.4;
}
.post-meta {
    font-size: 13px;
    color: #8a8a8a;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.post-meta .edited { margin-left: 8px; opacity: .8; }

.post-body p {
    margin: 0 0 1.2em;
    color: #4a4a4a;
    word-wrap: break-word;
}
.post-body p:last-child { margin-bottom: 0; }

/* ============ 页脚 ============ */
.posts-footer {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 24px 40px;
    text-align: center;
    font-size: 12px;
    color: #8a8a8a;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ============ 响应式 ============ */
@media (max-width: 640px) {
    .posts-header { padding: 24px 20px 8px; }
    .posts-title  { font-size: 24px; }
    .posts-main   { padding: 12px 20px 40px; }
    .post-heading { font-size: 22px; }
    .post-link { flex-direction: column; gap: 4px; align-items: flex-start; }
}

/* ============ Markdown 渲染 ============ */
.post-body-md { color: #4a4a4a; }
.post-body-md p { margin: 0 0 1.2em; }

.post-body-md h1,
.post-body-md h2,
.post-body-md h3,
.post-body-md h4 {
    margin: 1.6em 0 .7em;
    color: #2a2a2a;
    font-weight: 700;
    line-height: 1.4;
}
.post-body-md h1 { font-size: 24px; }
.post-body-md h2 { font-size: 21px; }
.post-body-md h3 { font-size: 18px; }
.post-body-md h4 { font-size: 16px; }

.post-body-md a {
    color: #3a7fd0;
    text-decoration: none;
    border-bottom: 1px solid rgba(58, 127, 208, 0.35);
    transition: border-color .15s;
}
.post-body-md a:hover { border-bottom-color: #3a7fd0; }

.post-body-md ul,
.post-body-md ol {
    margin: 0 0 1.2em;
    padding-left: 1.6em;
}
.post-body-md li { margin: .3em 0; }

.post-body-md blockquote {
    margin: 1.2em 0;
    padding: 8px 16px;
    border-left: 3px solid #b0b0b0;
    color: #6a6a6a;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0 6px 6px 0;
}

.post-body-md code {
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 4px;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 13px;
    color: #c7254e;
}
.post-body-md pre {
    margin: 1.2em 0;
    padding: 14px 18px;
    background: #2b2b2b;
    color: #e8e8e8;
    border-radius: 8px;
    overflow-x: auto;
    line-height: 1.6;
    font-size: 13px;
}
.post-body-md pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.post-body-md img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.2em auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.post-body-md hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.10);
    margin: 2em 0;
}

.post-body-md table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    font-size: 14px;
}
.post-body-md th,
.post-body-md td {
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    text-align: left;
}
.post-body-md th {
    background: rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

/* ============ 页脚导航 ============ */
.posts-footer .post-nav {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 14px;
}
.posts-footer .footer-copy {
    color: #8a8a8a;
}

/* ============ Markdown 工具栏（后台） ============ */
.md-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding: 8px;
    margin-top: 6px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}
.md-toolbar .mini-btn {
    min-width: 30px;
    text-align: center;
    padding: 4px 8px;
    font-size: 12px;
}
.md-toolbar .md-hint {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-3);
}
#postContent {
    border-radius: 0 0 8px 8px !important;
}