/**
 * Markdown 排版样式
 * 用于 .article-body 和 .page-body 内的文章内容排版
 *
 * @package blocks
 */

/* 基础容器 */
.article-body {
    background: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 25px;
    box-shadow: none;
    overflow-wrap: break-word;
}

.page-body {
    padding: 0;
    margin-bottom: 25px;
    overflow-wrap: break-word;
}

/* 段落 */
.article-body p,
.page-body p {
    font-size: clamp(15px, 0.5vw + 14px, 17px);
    line-height: 1.9;
    color: #374151;
    margin-bottom: 20px;
    text-indent: 2em;
}

/* 标题 */
.article-body h1,
.page-body h1 {
    font-size: clamp(22px, 1.5vw + 18px, 28px);
    font-weight: 700;
    color: #1a1a2e;
    margin: 35px 0 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.article-body h2,
.page-body h2 {
    font-size: clamp(19px, 1vw + 16px, 24px);
    font-weight: 700;
    color: #1a1a2e;
    margin: 30px 0 15px;
    padding-left: 10px;
    border-left: 4px solid #0f52ba;
}

.article-body h3,
.page-body h3 {
    font-size: clamp(17px, 0.5vw + 15px, 20px);
    font-weight: 600;
    color: #1a1a2e;
    margin: 25px 0 12px;
}

.article-body h4,
.page-body h4 {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 22px 0 10px;
}

.article-body h5,
.page-body h5 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 20px 0 10px;
}

.article-body h6,
.page-body h6 {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    margin: 18px 0 10px;
}

/* 图片 */
.article-body img,
.page-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 15px auto;
    display: block;
}

.article-body img {
    max-width: 600px;
}

@media (max-width: 640px) {
    .article-body img {
        max-width: 100%;
    }
    .article-body p,
    .page-body p {
        text-indent: 1em;
    }
}

/* 视频 */
.article-body video,
.page-body video {
    width: 100%;
    max-width: 100%;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    background: #000;
}

/* 音频 */
.article-body audio,
.page-body audio {
    width: 100%;
    max-width: 100%;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
}

/* 列表 */
.article-body ul,
.article-body ol,
.page-body ul,
.page-body ol {
    padding-left: 30px;
    margin-bottom: 20px;
}

.article-body li,
.page-body li {
    font-size: 16px;
    line-height: 1.9;
    color: #374151;
    margin-bottom: 8px;
}

.article-body li > ul,
.article-body li > ol,
.page-body li > ul,
.page-body li > ol {
    margin-top: 8px;
    margin-bottom: 8px;
}

/* 引用 */
.article-body blockquote,
.page-body blockquote {
    border-left: 4px solid #0f52ba;
    padding: 15px 20px;
    margin: 20px 0;
    color: #64748b;
    font-style: italic;
    background: #f8fafc;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.article-body blockquote p,
.page-body blockquote p {
    text-indent: 0;
    margin-bottom: 10px;
    color: #64748b;
}

.article-body blockquote p:last-child,
.page-body blockquote p:last-child {
    margin-bottom: 0;
}

/* 代码 */
.article-body pre,
.page-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 18px 20px;
    padding-top: 42px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 20px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    position: relative;
}

.article-body pre code,
.page-body pre code {
    background: none;
    color: inherit;
    font-size: inherit;
    padding: 0;
    border-radius: 0;
}

.article-body code,
.page-body code {
    background: #f1f5f9;
    color: #e11d48;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.article-body pre::-webkit-reveal,
.article-body pre::-webkit-scrollbar-button,
.page-body pre::-webkit-reveal,
.page-body pre::-webkit-scrollbar-button {
    display: none !important;
}

/* 行内元素 */
.article-body strong,
.page-body strong {
    font-weight: 700;
    color: #1a1a2e;
}

.article-body em,
.page-body em {
    font-style: italic;
}

.article-body del,
.page-body del {
    text-decoration: line-through;
    color: #94a3b8;
}

/* 链接 */
.article-body a,
.page-body a {
    color: #0f52ba;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.article-body a:hover,
.page-body a:hover {
    border-bottom-color: #0f52ba;
}

/* 分割线 */
.article-body hr,
.page-body hr {
    height: 1px;
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 30px 0;
    background: none;
}

/* 表格 */
.article-body table,
.page-body table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.7;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
}

.article-body thead,
.page-body thead {
    background: linear-gradient(135deg, #0f52ba 0%, #3b82f6 100%);
}

.article-body thead th,
.page-body thead th {
    padding: 12px 16px;
    border: none;
    font-weight: 600;
    color: #fff;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    width: auto;
}

.article-body thead th:last-child,
.page-body thead th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.article-body thead th:first-child,
.page-body thead th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.article-body td,
.page-body td {
    padding: 11px 16px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    color: #374151;
    font-size: 14px;
    white-space: normal;
    word-break: break-word;
    min-width: 80px;
}

.article-body td:last-child,
.page-body td:last-child {
    border-right: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
}

.article-body td:not(:last-child):hover,
.page-body td:not(:last-child):hover {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    position: relative;
    z-index: 1;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.article-body table tbody tr,
.page-body table tbody tr {
    transition: background 0.2s;
}

.article-body table tbody tr:hover,
.page-body table tbody tr:hover {
    background: #eff6ff;
}

.article-body table tbody tr:last-child td,
.page-body table tbody tr:last-child td {
    border-bottom: none;
}

.article-body table tbody tr:last-child td:first-child,
.page-body table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-md);
}

.article-body table tbody tr:last-child td:last-child,
.page-body table tbody tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-md) 0;
}

/* 其他 */
.article-body input[type="checkbox"],
.page-body input[type="checkbox"] {
    margin-right: 6px;
}

.article-body br + br,
.page-body br + br {
    display: none;
}
