/**
 * CMS文章内容极简排版样式
 * 用于前台文章详情页的内容展示
 */

.cms-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 段落 */
.cms-content p {
    margin: 1.2em 0;
    line-height: 1.8;
}

/* 标题 */
.cms-content h1,
.cms-content h2,
.cms-content h3,
.cms-content h4,
.cms-content h5,
.cms-content h6 {
    margin: 1.8em 0 0.8em;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
}

.cms-content h1 {
    font-size: 2em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

.cms-content h2 {
    font-size: 1.6em;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.2em;
}

.cms-content h3 {
    font-size: 1.3em;
}

.cms-content h4 {
    font-size: 1.1em;
}

.cms-content h5,
.cms-content h6 {
    font-size: 1em;
    color: #555;
}

/* 列表 */
.cms-content ul,
.cms-content ol {
    margin: 1.2em 0;
    padding-left: 2em;
}

.cms-content li {
    margin: 0.5em 0;
    line-height: 1.7;
}

.cms-content ul li {
    list-style-type: disc;
}

.cms-content ol li {
    list-style-type: decimal;
}

.cms-content ul ul,
.cms-content ol ol,
.cms-content ul ol,
.cms-content ol ul {
    margin: 0.5em 0;
}

/* 引用 */
.cms-content blockquote {
    margin: 1.5em 0;
    padding: 0.5em 1.2em;
    border-left: 4px solid #ddd;
    background: #f9f9f9;
    color: #555;
}

.cms-content blockquote p {
    margin: 0.5em 0;
}

/* 代码 */
.cms-content code {
    padding: 0.2em 0.4em;
    margin: 0 2px;
    background: #f5f5f5;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
    color: #333;
}

.cms-content pre {
    margin: 1.5em 0;
    padding: 1em;
    background: #f5f5f5;
    border-radius: 6px;
    overflow-x: auto;
}

.cms-content pre code {
    padding: 0;
    margin: 0;
    background: transparent;
    font-size: 0.9em;
    line-height: 1.6;
}

/* 水平分割线 */
.cms-content hr {
    margin: 2em 0;
    border: none;
    border-top: 1px solid #eee;
}

/* 链接 */
.cms-content a {
    color: #0366d6;
    text-decoration: none;
}

.cms-content a:hover {
    text-decoration: underline;
}

/* 图片 */
.cms-content img {
    display: inline-block;
    vertical-align: top;
    max-width: 100%;
    height: auto;
    margin: 0.3em;
    border-radius: 4px;
}

/* 只包含图片的段落 - 使用flex布局支持图片并排和居中 */
.cms-content p:has(> img:only-child),
.cms-content p:has(> img:first-child:last-child) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5em;
}

/* 包含多个图片的段落 */
.cms-content p:has(img) {
    line-height: 0;
}

/* 表格 */
.cms-content table {
    width: 100%;
    margin: 1.5em 0;
    border-collapse: collapse;
    font-size: 0.95em;
    border: 1px solid #ddd;
}

.cms-content th,
.cms-content td {
    padding: 0.75em 1em;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}

.cms-content th {
    background: #f5f5f5;
    font-weight: 600;
}

.cms-content tbody tr:hover {
    background: #fafafa;
}

/* 强调 */
.cms-content strong,
.cms-content b {
    font-weight: 600;
}

.cms-content em,
.cms-content i {
    font-style: italic;
}

/* 删除线 */
.cms-content del,
.cms-content s {
    text-decoration: line-through;
    color: #777;
}

/* 键盘按键样式 */
.cms-content kbd {
    padding: 0.2em 0.4em;
    margin: 0 2px;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

/* 标记 */
.cms-content mark {
    background: #fff3cd;
    padding: 0.1em 0.3em;
    border-radius: 2px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .cms-content {
        font-size: 16px;
    }

    .cms-content h1 {
        font-size: 1.6em;
    }

    .cms-content h2 {
        font-size: 1.4em;
    }

    .cms-content h3 {
        font-size: 1.2em;
    }

    .cms-content pre {
        padding: 0.8em;
        font-size: 0.85em;
    }
}
