@charset "UTF-8";

/* ===================================================================
   Markdown / 富文本正文排版（商用级）
   高 specificity 覆盖 main.css 全局 table/ul/li 污染
   2026-08-20
   =================================================================== */

/* 基础容器 */
.postbox-single-text,
.postbox-single-text.article-content,
.article-content {
    color: #374151;
    font-size: 16px;
    line-height: 1.85;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ---------- 段落与间距 ---------- */
.postbox-single-text > p,
.postbox-single-text p,
.article-content > p,
.article-content p {
    color: #374151;
    font-size: 16px;
    line-height: 1.85;
    margin: 0 0 1.5em;
}

.postbox-single-text > p:last-child,
.article-content > p:last-child {
    margin-bottom: 0;
}

/* ---------- 标题层级（严格小于页面 H1）---------- */
.postbox-single-text h1,
.postbox-single-text h2,
.postbox-single-text h3,
.postbox-single-text h4,
.postbox-single-text h5,
.postbox-single-text h6,
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: #111827;
    font-weight: 700;
    line-height: 1.35;
    margin: 2em 0 0.75em;
    padding: 0;
    letter-spacing: -0.01em;
}

.postbox-single-text h1,
.article-content h1 {
    font-size: 24px;
    margin-top: 0;
}

.postbox-single-text h2,
.article-content h2 {
    font-size: 20px;
    padding-bottom: 0.45em;
    border-bottom: 1px solid #e5e7eb;
    margin-top: 2.2em;
}

.postbox-single-text h3,
.article-content h3 {
    font-size: 18px;
    color: #1f2937;
    margin-top: 1.8em;
    position: relative;
    padding-left: 14px;
}

.postbox-single-text h3::before,
.article-content h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.35em;
    bottom: 0.35em;
    width: 4px;
    background: #4260ff;
    border-radius: 2px;
}

.postbox-single-text h4,
.article-content h4 {
    font-size: 17px;
    color: #374151;
    margin-top: 1.6em;
}

.postbox-single-text h5,
.article-content h5 {
    font-size: 16px;
    color: #4b5563;
    margin-top: 1.5em;
}

.postbox-single-text h6,
.article-content h6 {
    font-size: 15px;
    color: #6b7280;
    margin-top: 1.4em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ---------- 列表（覆盖 main.css 的 inline-block 污染）---------- */
.postbox-single-text ul,
.postbox-single-text ol,
.article-content ul,
.article-content ol {
    padding-left: 2em;
    margin: 1em 0 1.5em;
    list-style-position: outside;
}

.postbox-single-text ul,
.article-content ul {
    list-style-type: disc;
}

.postbox-single-text ol,
.article-content ol {
    list-style-type: decimal;
}

.postbox-single-text li,
.article-content li,
.postbox-single-text ul li,
.postbox-single-text ol li,
.article-content ul li,
.article-content ol li {
    display: list-item;
    margin: 0.45em 0;
    line-height: 1.8;
    color: #374151;
    font-size: 16px;
}

.postbox-single-text li > ul,
.postbox-single-text li > ol,
.article-content li > ul,
.article-content li > ol {
    margin: 0.35em 0 0.6em;
}

.postbox-single-text li > p,
.article-content li > p {
    margin: 0.3em 0;
}

/* 任务/待办列表样式增强 */
.postbox-single-text ul li:has(> input[type="checkbox"]),
.article-content ul li:has(> input[type="checkbox"]),
.postbox-single-text ul li.contains-task,
.article-content ul li.contains-task {
    list-style-type: none;
    position: relative;
    padding-left: 1.6em;
}

/* ---------- 行内代码 ---------- */
.postbox-single-text code,
.article-content code {
    font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
}

.postbox-single-text :not(pre) > code,
.article-content :not(pre) > code {
    background: #f3f4f6;
    color: #be185d;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    border: 1px solid #e5e7eb;
    word-break: break-word;
}

/* ---------- 代码块（编辑器风格）---------- */
.postbox-single-text pre,
.article-content pre {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px 20px;
    overflow-x: auto;
    margin: 1.5em 0;
    position: relative;
}

.postbox-single-text pre code,
.article-content pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.65;
    display: block;
    white-space: pre;
    border: none;
    border-radius: 0;
}

/* ---------- 引用块 ---------- */
.postbox-single-text blockquote,
.article-content blockquote {
    border-left: 4px solid #4260ff;
    background: #f8fafc;
    padding: 14px 18px;
    margin: 1.5em 0;
    color: #4b5563;
    border-radius: 0 8px 8px 0;
    font-style: normal;
}

.postbox-single-text blockquote p,
.article-content blockquote p {
    margin: 0 0 0.6em;
    color: #4b5563;
}

.postbox-single-text blockquote p:last-child,
.article-content blockquote p:last-child {
    margin-bottom: 0;
}

/* ---------- 表格（强覆盖 main.css）---------- */
.postbox-single-text table,
.article-content table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5em 0;
    font-size: 15px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* 强制还原 table-row/table-cell，覆盖 main.css 的 block 污染 */
.postbox-single-text table thead,
.postbox-single-text table tbody,
.postbox-single-text table tr,
.article-content table thead,
.article-content table tbody,
.article-content table tr {
    display: table-row !important;
    border: none !important;
    padding: 0 !important;
    width: auto !important;
}

.postbox-single-text table th,
.postbox-single-text table td,
.article-content table th,
.article-content table td {
    display: table-cell !important;
    border: 1px solid #e5e7eb;
    border-width: 0 0 1px 0;
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
    width: auto !important;
    font-size: 15px;
    line-height: 1.6;
}

.postbox-single-text table th,
.article-content table th {
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
    border-bottom-width: 2px;
    border-bottom-color: #d1d5db;
    white-space: nowrap;
}

.postbox-single-text table tbody tr:last-child th,
.postbox-single-text table tbody tr:last-child td,
.article-content table tbody tr:last-child th,
.article-content table tbody tr:last-child td {
    border-bottom: none;
}

.postbox-single-text table tbody tr:nth-child(even) td,
.article-content table tbody tr:nth-child(even) td {
    background: #f9fafb;
}

.postbox-single-text table tbody tr:hover td,
.article-content table tbody tr:hover td {
    background: #f3f4f6;
}

/* ---------- 链接 ---------- */
.postbox-single-text a,
.article-content a {
    color: #4260ff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.postbox-single-text a:hover,
.article-content a:hover {
    border-bottom-color: currentColor;
}

/* ---------- 图片 ---------- */
.postbox-single-text img,
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
    display: block;
}

/* ---------- 分隔线 ---------- */
.postbox-single-text hr,
.article-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 2.2em 0;
}

/* ---------- 暗色主题兜底（如站点支持）---------- */
@media (prefers-color-scheme: dark) {
    .postbox-single-text,
    .article-content,
    .postbox-single-text p,
    .article-content p,
    .postbox-single-text li,
    .article-content li {
        color: #d1d5db;
    }

    .postbox-single-text h1,
    .postbox-single-text h2,
    .postbox-single-text h3,
    .postbox-single-text h4,
    .postbox-single-text h5,
    .postbox-single-text h6,
    .article-content h1,
    .article-content h2,
    .article-content h3,
    .article-content h4,
    .article-content h5,
    .article-content h6 {
        color: #f3f4f6;
    }

    .postbox-single-text h3,
    .article-content h3 {
        color: #e5e7eb;
    }

    .postbox-single-text h2,
    .article-content h2 {
        border-bottom-color: #374151;
    }

    .postbox-single-text table,
    .article-content table {
        background: #1f2937;
        border-color: #374151;
    }

    .postbox-single-text table th,
    .postbox-single-text table td,
    .article-content table th,
    .article-content table td {
        border-color: #374151;
    }

    .postbox-single-text table th,
    .article-content table th {
        background: #111827;
        border-bottom-color: #4b5563;
    }

    .postbox-single-text table tbody tr:nth-child(even) td,
    .article-content table tbody tr:nth-child(even) td {
        background: #27303f;
    }

    .postbox-single-text pre,
    .article-content pre {
        background: #0f172a;
        border-color: #1e293b;
    }
}
