/* ============================================================
   Blog 样式（首页列表 / 文章页 / 投稿弹窗）
   与全站 navbar.css、responsive.css 配合使用
   ============================================================ */

:root {
    --blog-ink: #1b1f24;
    --blog-muted: #6a7280;
    --blog-line: #e8eaf0;
    --blog-brand: #5b5bd6;
    --blog-brand-soft: #eef0ff;
    --blog-bg: #f7f8fb;
    --blog-gold: #b8873b;
    --blog-radius: 14px;
}

body.blog-body {
    margin: 0;
    background: var(--blog-bg);
    color: var(--blog-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.blog-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 88px 20px 48px;
}

/* ---------------- 顶部 Hero ---------------- */
.blog-hero {
    background: linear-gradient(135deg, #ffffff 0%, #f4f5ff 58%, #eef7f4 100%);
    border: 1px solid var(--blog-line);
    border-radius: 20px;
    padding: 34px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    box-shadow: 0 10px 30px rgba(27, 31, 36, 0.05);
}

.blog-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--blog-brand);
}

.blog-hero h1 {
    margin: 0 0 12px;
    font-size: 32px;
    line-height: 1.35;
    letter-spacing: -0.5px;
    color: #14161a;
}

.blog-hero-sub {
    margin: 0;
    max-width: 620px;
    font-size: 15px;
    line-height: 1.85;
    color: var(--blog-muted);
}

.blog-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 auto;
}

.blog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
    white-space: nowrap;
}

.blog-btn.primary {
    background: linear-gradient(135deg, #6c6cf0 0%, #4f46c9 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(91, 91, 214, .28);
}

.blog-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(91, 91, 214, .34);
}

.blog-btn.ghost {
    background: #fff;
    border-color: var(--blog-line);
    color: var(--blog-ink);
}

.blog-btn.ghost:hover {
    border-color: #c9cdf0;
    background: #fbfbff;
}

/* ---------------- 布局 ---------------- */
.blog-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 316px;
    gap: 28px;
    margin-top: 28px;
}

.blog-main {
    min-width: 0;
}

.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-card {
    background: #fff;
    border: 1px solid var(--blog-line);
    border-radius: var(--blog-radius);
    padding: 20px;
}

.sidebar-card h3 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 700;
}

.sidebar-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.8;
    color: var(--blog-muted);
}

.compose-card {
    background: linear-gradient(160deg, #1f2233 0%, #2b2f4a 100%);
    border: none;
    color: #fff;
}

.compose-card h3 {
    color: #fff;
    font-size: 17px;
}

.compose-card p {
    color: rgba(255, 255, 255, .72);
    margin-bottom: 16px;
}

.compose-card .blog-btn {
    width: 100%;
}

.cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cat-list button {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--blog-line);
    background: #fff;
    color: #4b5563;
    font-size: 12.5px;
    cursor: pointer;
    transition: all .16s ease;
}

.cat-list button:hover {
    border-color: #c7cbf5;
    color: var(--blog-brand);
}

.cat-list button.active {
    background: var(--blog-brand-soft);
    border-color: #c7cbf5;
    color: var(--blog-brand);
    font-weight: 600;
}

/* ---------------- 文章列表 ---------------- */
.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.list-head h2 {
    margin: 0;
    font-size: 20px;
    letter-spacing: -0.2px;
}

.list-head .list-count {
    font-size: 12.5px;
    color: var(--blog-muted);
    font-weight: 400;
    margin-left: 8px;
}

.blog-search {
    position: relative;
    width: 232px;
}

.blog-search input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1px solid var(--blog-line);
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.blog-search input:focus {
    border-color: #b9bdf0;
    box-shadow: 0 0 0 3px rgba(91, 91, 214, .1);
}

.blog-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #9aa1ad;
}

.post-list {
    background: #fff;
    border: 1px solid var(--blog-line);
    border-radius: var(--blog-radius);
    overflow: hidden;
}

.post-item {
    display: flex;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid #f1f2f6;
    transition: background .16s ease;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item:hover {
    background: #fbfbff;
}

.post-item[hidden] {
    display: none;
}

.avatar {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #7c7cf5 0%, #4f46c9 100%);
}

.avatar.green { background: linear-gradient(135deg, #37c99b 0%, #159a72 100%); }
.avatar.gold { background: linear-gradient(135deg, #e0b25f 0%, #b0802c 100%); }
.avatar.gray { background: linear-gradient(135deg, #aab2c0 0%, #7d8797 100%); }

.post-body {
    min-width: 0;
    flex: 1 1 auto;
}

.post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12.5px;
    color: var(--blog-muted);
    margin-bottom: 7px;
}

.post-meta .author {
    font-weight: 600;
    color: #414855;
}

.post-meta .dot::before {
    content: "·";
    margin-right: 6px;
}

.chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--blog-brand-soft);
    color: var(--blog-brand);
    font-size: 11.5px;
    font-weight: 600;
}

.chip.warm {
    background: #fff4e4;
    color: #a9701c;
}

.chip.green {
    background: #e9f8f1;
    color: #1a8a63;
}

.post-title {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.55;
    letter-spacing: -0.2px;
}

.post-title a {
    color: #1b1f24;
    text-decoration: none;
}

.post-title a:hover {
    color: var(--blog-brand);
}

.post-excerpt {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: #5d6572;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-foot {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: #98a0ad;
}

.post-foot a {
    color: var(--blog-brand);
    text-decoration: none;
    font-weight: 600;
}

/* 本人投稿：编辑 / 删除 */
.post-foot .owner-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.owner-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--blog-line);
    background: #fff;
    color: #5d6572;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.owner-btn:hover {
    border-color: #c9cdf0;
    color: var(--blog-brand);
    background: #fbfbff;
}

.owner-btn.is-danger:hover {
    border-color: #fecaca;
    color: #dc2626;
    background: #fff5f5;
}

.owner-btn:disabled {
    opacity: .6;
    cursor: default;
}

/* 文章详情页顶部的作者操作条 */
.article-owner-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 18px;
    padding: 10px 14px;
    border: 1px dashed #d9dcf0;
    border-radius: 12px;
    background: #f8f8ff;
}

.article-owner-bar .owner-tip {
    font-size: 13px;
    font-weight: 600;
    color: #5d6572;
}

.article-owner-bar .owner-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.post-item.compact {
    padding: 15px 22px;
    align-items: center;
}

.post-item.compact .post-title {
    font-size: 15.5px;
    margin: 0;
    font-weight: 500;
    flex: 1 1 auto;
    min-width: 0;
}

/* 紧凑条目里标题本身就是链接 */
a.post-title {
    color: #1b1f24;
    text-decoration: none;
}

a.post-title:hover {
    color: var(--blog-brand);
}

.compact-meta {
    flex: 0 0 auto;
    font-size: 12px;
    color: #98a0ad;
    white-space: nowrap;
}

.empty-tip {
    padding: 26px;
    text-align: center;
    color: var(--blog-muted);
    font-size: 13px;
}

/* 最新投稿模块 */
.latest-block {
    margin-bottom: 22px;
}

.latest-block[hidden] {
    display: none;
}

.latest-block .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 20px;
}

.section-title .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .15);
}

/* ---------------- 文章页 ---------------- */
.article-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 88px 20px 60px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 30px;
    align-items: start;
}

.article-card-main {
    background: #fff;
    border: 1px solid var(--blog-line);
    border-radius: 18px;
    padding: 38px 42px 34px;
    box-shadow: 0 10px 30px rgba(27, 31, 36, .04);
    min-width: 0;
}

.article-breadcrumb {
    font-size: 12.5px;
    color: #98a0ad;
    margin-bottom: 18px;
}

.article-breadcrumb a {
    color: #7b8492;
    text-decoration: none;
}

.article-breadcrumb a:hover {
    color: var(--blog-brand);
}

.article-h1 {
    margin: 0 0 16px;
    font-size: 31px;
    line-height: 1.45;
    letter-spacing: -0.4px;
    color: #15181d;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: var(--blog-muted);
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f1f5;
    margin-bottom: 26px;
}

.article-meta .author-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2f3540;
}

.article-meta .author-chip .avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.article-body {
    font-size: 17px;
    line-height: 1.95;
    color: #2b3038;
    word-break: break-word;
}

.article-body > p:first-of-type {
    margin-top: 0;
}

.article-body h2 {
    margin: 38px 0 16px;
    padding-left: 12px;
    border-left: 4px solid var(--blog-brand);
    font-size: 22px;
    line-height: 1.5;
    letter-spacing: -0.2px;
}

.article-body h3 {
    margin: 26px 0 12px;
    font-size: 18px;
    line-height: 1.6;
}

.article-body p {
    margin: 15px 0;
}

.article-body ul,
.article-body ol {
    margin: 14px 0;
    padding-left: 24px;
}

.article-body li {
    margin: 8px 0;
}

.article-body a {
    color: var(--blog-brand);
    text-decoration: none;
    border-bottom: 1px solid rgba(91, 91, 214, .35);
}

.article-body a:hover {
    border-bottom-color: var(--blog-brand);
}

.article-body blockquote {
    margin: 20px 0;
    padding: 14px 18px;
    background: #f8f9fd;
    border-left: 4px solid #cfd3f5;
    border-radius: 0 8px 8px 0;
    color: #4b5260;
    font-size: 15.5px;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14.5px;
}

.article-body th,
.article-body td {
    border: 1px solid #e6e8ef;
    padding: 9px 12px;
    text-align: left;
}

.article-body th {
    background: #f5f6fb;
    font-weight: 600;
}

.article-body code {
    background: #f4f5fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    color: #b4326b;
}

.article-body pre {
    background: #21242e;
    color: #f4f6fb;
    padding: 18px 20px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 13.5px;
    line-height: 1.7;
}

.article-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.article-body hr {
    border: none;
    border-top: 1px solid #eef0f5;
    margin: 30px 0;
}

/* 文章内特殊块 */
.answer-box {
    margin: 22px 0;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f1f3ff 0%, #eefaf6 100%);
    border: 1px solid #dfe3ff;
    border-radius: 12px;
    font-size: 15.5px;
    line-height: 1.9;
}

.answer-box strong.label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    letter-spacing: 1px;
    color: var(--blog-brand);
}

.note-box {
    margin: 22px 0;
    padding: 16px 18px;
    background: #fff9ef;
    border: 1px solid #f5e3c2;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.85;
    color: #5c4a2a;
}

.prompt-box {
    margin: 18px 0;
    border: 1px solid #e6e8ef;
    border-radius: 12px;
    overflow: hidden;
}

.prompt-box .prompt-head {
    padding: 9px 14px;
    background: #f5f6fb;
    font-size: 12.5px;
    color: #6a7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prompt-box pre {
    margin: 0;
    border-radius: 0;
    background: #21242e;
}

/* 文章内的图表 / 公式 / 对比图 */
.fig {
    margin: 24px 0 20px;
    padding: 16px 16px 10px;
    background: #fbfcff;
    border: 1px solid #e8eaf0;
    border-radius: 12px;
}

.fig svg {
    display: block;
    width: 100%;
    height: auto;
}

.fig figcaption {
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.7;
    color: #8a919e;
    text-align: center;
}

.formula-block {
    margin: 22px 0;
    padding: 14px 16px;
    background: #fbfcff;
    border: 1px solid #e8eaf0;
    border-radius: 10px;
    text-align: center;
    overflow-x: auto;
    font-size: 16px;
}

.formula-note {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    color: #8a919e;
}

.compare-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.compare-pair > div {
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.8;
}

.compare-pair .before {
    background: #fff5f5;
    border: 1px solid #f7d6d6;
}

.compare-pair .after {
    background: #f2fbf6;
    border: 1px solid #cdeedb;
}

.compare-pair h4 {
    margin: 0 0 6px;
    font-size: 13px;
}

.compare-pair p {
    margin: 6px 0;
    font-size: 14px;
    line-height: 1.8;
}

.compare-pair p:last-child {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .compare-pair {
        grid-template-columns: 1fr;
    }
}

/* 表格：窄屏横向滚动，题注统一 */
.table-wrap {
    margin: 20px 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table {
    margin: 0;
    min-width: 420px;
}

.article-body .table-caption {
    margin: 0 0 22px;
    font-size: 12.5px;
    line-height: 1.7;
    color: #8a919e;
    text-align: center;
}

.author-box {
    display: flex;
    gap: 16px;
    margin-top: 40px;
    padding: 20px 22px;
    background: #f8f9fd;
    border: 1px solid #edeef4;
    border-radius: 14px;
}

.author-box .avatar {
    width: 52px;
    height: 52px;
    font-size: 19px;
}

.author-box h4 {
    margin: 2px 0 6px;
    font-size: 15px;
}

.author-box p {
    margin: 0;
    font-size: 13px;
    line-height: 1.8;
    color: #67707e;
}

.article-cta {
    margin-top: 26px;
    padding: 22px 24px;
    border-radius: 14px;
    background: linear-gradient(135deg, #23263a 0%, #3b3f63 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.article-cta h4 {
    margin: 0 0 6px;
    font-size: 16px;
}

.article-cta p {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, .72);
    line-height: 1.7;
}

.article-cta .blog-btn {
    background: #fff;
    color: #23263a;
    flex: 0 0 auto;
}

/* 文章目录 */
.toc-card {
    position: sticky;
    top: 92px;
    background: #fff;
    border: 1px solid var(--blog-line);
    border-radius: var(--blog-radius);
    padding: 18px;
    font-size: 13px;
}

.toc-card h4 {
    margin: 0 0 12px;
    font-size: 13px;
    letter-spacing: 1px;
    color: #98a0ad;
    text-transform: uppercase;
}

.toc-card a {
    display: block;
    padding: 6px 0;
    color: #5d6572;
    text-decoration: none;
    line-height: 1.6;
    border-left: 2px solid transparent;
    padding-left: 10px;
}

.toc-card a:hover {
    color: var(--blog-brand);
    border-left-color: var(--blog-brand);
}

/* ---------------- 投稿弹窗 ---------------- */
.bp-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    background: rgba(16, 18, 24, .55);
    z-index: 2000;
    overflow-y: auto;
}

.bp-modal.open {
    display: flex;
}

.bp-dialog {
    width: 100%;
    max-width: 720px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
    overflow: hidden;
}

.bp-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid #f0f1f5;
}

.bp-head h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.bp-head p {
    margin: 0;
    font-size: 12.5px;
    color: var(--blog-muted);
}

.bp-close {
    border: none;
    background: none;
    font-size: 20px;
    color: #9aa1ad;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.bp-body {
    padding: 18px 24px 22px;
}

.bp-row {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.bp-field {
    flex: 1 1 0;
    min-width: 0;
}

.bp-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #4b5260;
}

.bp-field input,
.bp-field select,
.bp-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #e2e5ec;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    color: #1b1f24;
    outline: none;
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.bp-field textarea {
    min-height: 210px;
    line-height: 1.8;
    resize: vertical;
}

.bp-field input:focus,
.bp-field select:focus,
.bp-field textarea:focus {
    border-color: #b9bdf0;
    box-shadow: 0 0 0 3px rgba(91, 91, 214, .1);
}

.bp-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #5d6572;
    cursor: pointer;
    user-select: none;
}

.bp-check input {
    width: 15px;
    height: 15px;
    accent-color: var(--blog-brand);
}

.bp-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: #9aa1ad;
    line-height: 1.7;
}

.bp-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px 20px;
    border-top: 1px solid #f0f1f5;
}

.bp-foot .bp-status {
    font-size: 12.5px;
    color: #98a0ad;
}

.bp-foot .bp-status.error {
    color: #dc2626;
}

.bp-foot .bp-status.ok {
    color: #15803d;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
    .blog-grid,
    .article-shell {
        grid-template-columns: 1fr;
    }

    .toc-card {
        position: static;
    }

    .article-shell .blog-sidebar {
        order: 2;
    }
}

@media (max-width: 768px) {
    .blog-shell,
    .article-shell {
        padding-top: 72px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .blog-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px 20px;
    }

    .blog-hero h1 {
        font-size: 24px;
    }

    .blog-hero-sub {
        font-size: 14px;
    }

    .blog-hero-actions {
        width: 100%;
        flex-direction: row;
    }

    .blog-hero-actions .blog-btn {
        flex: 1 1 0;
    }

    .article-card-main {
        padding: 24px 18px 26px;
    }

    .article-h1 {
        font-size: 23px;
    }

    .article-body {
        font-size: 16px;
    }

    .article-body h2 {
        font-size: 19px;
    }

    .article-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .blog-search {
        width: 100%;
    }

    .post-item {
        padding: 18px 16px;
    }

    .post-item.compact {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .bp-row {
        flex-direction: column;
        gap: 12px;
    }

    .bp-body {
        padding: 16px 16px 20px;
    }

    .bp-head,
    .bp-foot {
        padding-left: 16px;
        padding-right: 16px;
    }
}
