/**
 * 文章详情页样式
 * @author WorkBuddy
 * @date 2026-05-21
 */

/* ============ 文章正文字体与基础样式 ============ */
.article-content {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 1.0625rem;
    line-height: 1.85;
    color: #374151;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ============ H1/H2/H3 标题美化 ============ */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin-top: 1.75em;
    margin-bottom: 0.75em;
    font-weight: 700;
    line-height: 1.4;
    color: #111827;
}

/* H1 - 简洁主标题，无背景，靠字号和线条区分 */
.article-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0 0 0.5rem 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    margin-bottom: 1em;
    color: #111827;
    border: none;
    border-bottom: 2px solid #e5e7eb;
    background: none;
    box-shadow: none;
    position: relative;
}

/* H1 底部高光线 */
.article-content h1::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: #2563eb;
}

/* H2 - 简洁二级标题，左侧竖线 */
.article-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.25rem 0 0.25rem 0.875rem;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    color: #1e3a5f;
    border: none;
    border-left: 3px solid #3b82f6;
    background: none;
    box-shadow: none;
}

.article-content h2::before,
.article-content h2::after {
    display: none;
}

/* H3 - 简洁三级标题，更细的竖线 */
.article-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.2rem 0 0.2rem 0.75rem;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1.25em;
    margin-bottom: 0.625em;
    color: #374151;
    border: none;
    border-left: 2px solid #93c5fd;
    background: none;
    box-shadow: none;
}

.article-content h3::before,
.article-content h3::after {
    display: none;
}

/* H4 - 四级标题 */
.article-content h4 {
    font-size: 1.1rem;
    color: #1f2937;
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: 0.5rem;
}

.article-content h4::before {
    content: '◆ ';
    color: #93c5fd;
}

/* H5/H6 - 更小标题 */
.article-content h5 {
    font-size: 1rem;
    color: #4b5563;
}

.article-content h6 {
    font-size: 0.9rem;
    color: #6b7280;
}

/* ============ 段落美化 ============ */
.article-content p {
    margin: 1em 0;
    text-align: justify;
}

/* 首行缩进（可选，取消注释即可启用）
.article-content p:not(:first-child) {
    text-indent: 2em;
}
*/

/* 首字放大（可选，取消注释即可启用）
.article-content p:first-of-type::first-letter {
    float: left;
    font-size: 3.2em;
    line-height: 1;
    font-weight: 700;
    color: #2563eb;
    margin-right: 0.1em;
    margin-top: 0.05em;
}
*/

/* ============ 引用块美化 ============ */
.article-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem 1rem 1.5rem;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid #f59e0b;
    border-radius: 0 10px 10px 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}

.article-content blockquote::before {
    content: '"';
    position: absolute;
    top: -8px;
    left: 12px;
    font-size: 3rem;
    color: #fbbf24;
    font-family: Georgia, serif;
    line-height: 1;
    opacity: 0.6;
}

.article-content blockquote p {
    margin: 0;
    color: #78350f;
    font-style: italic;
}

.article-content blockquote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85em;
    color: #92400e;
    font-style: normal;
}

/* ============ 链接美化 ============ */
.article-content a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px dashed #93c5fd;
    transition: all 0.2s ease;
    padding: 0 2px;
}

.article-content a:hover {
    color: #1d4ed8;
    border-bottom-color: #2563eb;
    background: #eff6ff;
    border-radius: 2px;
}

/* ============ 列表美化 ============ */
.article-content ul,
.article-content ol {
    margin: 1em 0;
    padding-left: 1.5rem;
}

.article-content ul {
    list-style: none;
}

.article-content ul li {
    position: relative;
    padding-left: 1.25rem;
    margin: 0.5em 0;
}

.article-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    border-radius: 50%;
}

.article-content ol {
    list-style-type: none;
    counter-reset: list-counter;
}

.article-content ol li {
    position: relative;
    padding-left: 2rem;
    margin: 0.5em 0;
    counter-increment: list-counter;
}

.article-content ol li::before {
    content: counter(list-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.5rem;
    height: 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.5rem;
    border-radius: 4px;
}

.article-content li {
    margin: 0.4em 0;
}

/* 嵌套列表 */
.article-content ul ul,
.article-content ol ol,
.article-content ul ol,
.article-content ol ul {
    margin: 0.4em 0 0.4em 1em;
}

/* ============ 代码块美化 ============ */
.article-content code {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Consolas', monospace;
    font-size: 0.875em;
    background: #f1f5f9;
    color: #dc2626;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.article-content pre {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
}

.article-content pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
    border-radius: 10px 10px 0 0;
    pointer-events: none;
}

.article-content pre code {
    background: transparent;
    color: #e2e8f0;
    padding: 0;
    border: none;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* 行内代码 */
.article-content :not(pre) > code {
    font-size: 0.9em;
}

/* ============ 图片美化 ============ */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-content img:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* 图片说明（figcaption） */
.article-content figure {
    margin: 1.5rem 0;
}

.article-content figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
    font-style: italic;
}

/* ============ 表格美化 ============ */
/* border-collapse: collapse + box-shadow 模拟外框（兼容 rowspan 合并单元格） */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.9rem;
    border-radius: 10px;
    overflow: hidden;
    box-shadow:
        0 0 0 1.5px #d1d5db,
        0 2px 12px rgba(0, 0, 0, 0.06);
}

.article-content table th,
.article-content table td {
    padding: 0.75rem 1rem;
    text-align: center;
    border: 1px solid #d1d5db;
}

.article-content table th {
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
}

.article-content table td {
    color: #374151;
    background: #fff;
}

.article-content table tbody tr:hover td {
    background: #f8fafc;
}

/* 斑马纹 */
.article-content table tbody tr:nth-child(even) td {
    background: #fafbfc;
}

.article-content table tbody tr:nth-child(even):hover td {
    background: #f1f5f9;
}

/* ============ 水平线美化 ============ */
.article-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5e7eb 20%, #e5e7eb 80%, transparent);
    margin: 2rem 0;
    position: relative;
}

.article-content hr::before {
    content: '✦';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 0 1rem;
    color: #d1d5db;
    font-size: 0.75rem;
}

/* ============ 强调文本 ============ */
.article-content strong {
    color: #dc2626;
    font-weight: 700;
}

.article-content em {
    color: #059669;
    font-style: italic;
}

.article-content mark,
.article-content .highlight {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* ============ 删除线 ============ */
.article-content del,
.article-content s {
    color: #9ca3af;
    text-decoration: line-through;
}

/* ============ 上标/下标 ============ */
.article-content sup,
.article-content sub {
    font-size: 0.75em;
    color: #6b7280;
}

/* ============ details/summary 手风琴 ============ */
.article-content details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

.article-content summary {
    cursor: pointer;
    font-weight: 600;
    color: #2563eb;
    outline: none;
}

.article-content details[open] summary {
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.75rem;
}

/* ============ 响应式适配 ============ */
@media (max-width: 768px) {
    .article-content {
        font-size: 1rem;
        line-height: 1.8;
    }

    .article-content h1 {
        font-size: 1.35rem;
    }

    .article-content h2 {
        font-size: 1.15rem;
    }

    .article-content h3 {
        font-size: 1.05rem;
    }

    .article-content blockquote {
        padding: 0.875rem 1rem 0.875rem 1.25rem;
    }

    .article-content pre {
        padding: 1rem;
        border-radius: 8px;
    }

    .article-content img {
        border-radius: 8px;
    }
}

/* ============ 打印样式 ============ */
@media print {
    .article-content {
        color: #000;
    }

    .article-content h1,
    .article-content h2,
    .article-content h3 {
        background: none;
        box-shadow: none;
        color: #000;
        padding-left: 0;
    }

    .article-content h1::after,
    .article-content h2::before,
    .article-content h2::after,
    .article-content h3::before,
    .article-content h3::after {
        display: none;
    }

    .article-content a {
        color: #000;
        border-bottom: 1px solid #000;
    }

    .article-content pre {
        background: #f5f5f5;
        color: #000;
        box-shadow: none;
    }
}
