﻿html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

header {
    position: fixed;
    top: 0;
    width: 100%;
    height: 60px;
    z-index: 1000;
}

main {
    padding-top: 60px;
}

footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;

    display: flex;
    align-items: center;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

/* 所有标题的基础样式 */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 24px;
    margin-bottom: 16px;
}

/* 特定标题样式 */
h1 {
    font-size: 2.5em;
    border-bottom: 2px solid #eaecef;
    padding-bottom: 10px;
}

h2 {
    font-size: 2em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 8px;
}

h3 {
    font-size: 1.5em;
}

/* 段落 */
p {
    line-height: 1.6;
    margin-bottom: 16px;
    color: #333;
}

/* 强调文本 */
strong {
    font-weight: 700;
    color: #000;
}

em {
    font-style: italic;
    color: #555;
}

/* 删除线 */
del {
    text-decoration: line-through;
    color: #888;
}

/* 基础链接 */
a {
    color: #0366d6;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
    word-break: break-all;
}

    a:hover {
        border-bottom: 1px solid #0366d6;
    }

    a:visited {
        color: #6f42c1;
    }

    /* 外部链接图标 */
    a[href^="http"]:after {
        content: " ↗";
        font-size: 0.8em;
        vertical-align: super;
    }

/* 行内代码 */
code {
    background-color: #f6f8fa;
    padding: 3px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #d73a49;
}

/* 代码块 */
pre {
    background-color: #f6f8fa;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    line-height: 1.45;
}

    pre code {
        background-color: transparent;
        padding: 0;
        color: inherit;
    }

/* 无序列表 */
ul {
    list-style-type: disc;
    padding-left: 2em;
    margin-bottom: 16px;
}

    ul ul {
        list-style-type: circle;
    }

        ul ul ul {
            list-style-type: square;
        }

/* 有序列表 */
ol {
    list-style-type: decimal;
    padding-left: 2em;
    margin-bottom: 16px;
}

/* 列表项 */
li {
    line-height: 1.6;
}

/* 任务列表 */
input[type="checkbox"] {
    margin-right: 8px;
}

blockquote {
    margin: 20px 0;
    padding: 10px 20px;
    border-left: 4px solid #dfe2e5;
    background-color: #f6f8fa;
    color: #6a737d;
}

    blockquote p {
        margin: 0;
    }

        blockquote p:last-child {
            margin-bottom: 0;
        }

    /* 嵌套引用 */
    blockquote blockquote {
        margin: 10px 0;
        border-left-color: #c8ccd0;
    }

/* 表格 */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
    overflow-x: auto;
    display: block;
}

thead {
    background-color: #f6f8fa;
}

th, td {
    border: 1px solid #dfe2e5;
    padding: 12px 16px;
    text-align: left;
}

th {
    font-weight: 600;
    color: #24292e;
}

tbody tr:nth-child(even) {
    background-color: #f6f8fa;
}

tbody tr:hover {
    background-color: #e1e4e8;
    transition: background-color 0.2s ease;
}

/* 基础图片 */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 响应式图片 */
@media (max-width: 768px) {
    img {
        width: 100%;
    }
}

/* 图片标题 */
img + em {
    display: block;
    text-align: center;
    font-size: 0.9em;
    color: #6a737d;
    margin-top: -15px;
    margin-bottom: 20px;
}

hr {
    border: none;
    border-top: 2px solid #eaecef;
    margin: 40px 0;
}

    /* 装饰性分割线 */
    hr.fancy {
        border-top: 3px double #dfe2e5;
        text-align: center;
        overflow: visible;
    }

        hr.fancy:after {
            content: "§";
            display: inline-block;
            position: relative;
            top: -15px;
            padding: 0 10px;
            background: white;
            color: #dfe2e5;
            font-size: 18px;
        }

/* 暗黑模式变量 */
:root {
    --bg-color: #ffffff;
    --text-color: #24292e;
    --code-bg: #f6f8fa;
    --border-color: #dfe2e5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e1e4e8;
        --code-bg: #2d2d2d;
        --border-color: #444d56;
    }
}

/* 应用变量 */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

code {
    background-color: var(--code-bg);
}

table, th, td {
    border-color: var(--border-color);
}

@media print {
    /* 移除背景色 */
    * {
        background-color: white !important;
        color: black !important;
    }

    /* 优化页面断行 */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    pre, blockquote, img {
        page-break-inside: avoid;
    }

    /* 显示链接 URL */
    a[href]:after {
        content: " (" attr(href) ")";
    }

    /* 隐藏不必要的元素 */
    nav, aside, .no-print {
        display: none;
    }
}

/* 容器 */
.markdown-body {
    max-width: 980px;
    margin: 0 auto;
    padding: 20px;
}

/* 平板 */
@media (max-width: 768px) {
    .markdown-body {
        padding: 15px;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.5em;
    }

    table {
        font-size: 0.9em;
    }
}

/* 手机 */
@media (max-width: 480px) {
    .markdown-body {
        padding: 10px;
    }

    pre {
        padding: 10px;
        font-size: 0.85em;
    }

    table {
        font-size: 0.8em;
    }

    th, td {
        padding: 8px;
    }
}

/* 使用 Prism.js 配色方案 */
.token.comment {
    color: #6a737d;
    font-style: italic;
}

.token.keyword {
    color: #d73a49;
    font-weight: bold;
}

.token.string {
    color: #032f62;
}

.token.function {
    color: #6f42c1;
}

.token.number {
    color: #005cc5;
}

.token.operator {
    color: #d73a49;
}

/* 行号 */
.line-numbers {
    position: relative;
    padding-left: 3.8em;
}

.line-numbers-rows {
    position: absolute;
    left: 0;
    width: 3em;
    user-select: none;
    counter-reset: linenumber;
}

    .line-numbers-rows > span {
        display: block;
        counter-increment: linenumber;
    }

        .line-numbers-rows > span:before {
            content: counter(linenumber);
            color: #999;
            display: block;
            text-align: right;
            padding-right: 0.8em;
        }