/* 主样式 — 提取自 _layouts/default.html 内联 <style> 块 */

/* ===== 变量与全局重置 ===== */
:root {
    --text-color: #333;
    --bg-color: #fff;
    --link-color: #0366d6;
    --border-color: #eee;
    --code-bg: #f6f8fa;
    --sidebar-width: 260px;
    --sidebar-bg: #f8f9fa;
    --sidebar-toggle-bottom: 5rem;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    background: var(--bg-color);
}
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--link-color);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 9999;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}
.skip-link:focus {
    top: 0;
}

/* ===== 布局 ===== */
/* 页面布局容器 */
.page-wrapper {
    display: flex;
    min-height: 100vh;
}
/* 主内容区域 */
.content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    max-width: calc(100% - var(--sidebar-width));
}
.content-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
/* 移动端侧边栏切换按钮 */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: var(--sidebar-toggle-bottom);
    left: 1rem;
    background: var(--link-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 1001;
    border: none;
    font-size: 1.2rem;
}
.sidebar-toggle:hover {
    background: #024ea4;
}
/* 遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.sidebar-overlay.show {
    display: block;
}
header {
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}
header h1 a {
    color: var(--text-color);
    text-decoration: none;
}
header p {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}
nav {
    margin-top: 0.5rem;
}
nav a {
    margin-right: 1rem;
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.9rem;
}
nav a:hover {
    text-decoration: underline;
}
main {
    min-height: 60vh;
}
footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: #666;
}
.busuanzi-stats {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: #999;
}

/* ===== 侧边栏 ===== */
/* 左侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1rem;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

/* ===== 目录树 ===== */
/* 目录树样式 */
.dir-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
}
.dir-tree ul {
    list-style: none;
    padding-left: 1rem;
    margin: 0;
}
.dir-tree li {
    margin: 0.2rem 0;
}
.dir-tree .tree-item {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: var(--text-color);
    width: 100%;
    text-align: left;
    font-size: inherit;
    font-family: inherit;
    border: none;
    background: none;
}
.dir-tree button.tree-item:focus {
    outline: 2px solid var(--link-color);
    outline-offset: 1px;
}
.dir-tree .tree-item:hover {
    background: rgba(0, 0, 0, 0.05);
    text-decoration: none;
}
.dir-tree .tree-item.active {
    background: rgba(3, 102, 214, 0.1);
    color: var(--link-color);
}
.dir-tree .tree-toggle {
    width: 16px;
    height: 16px;
    margin-right: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #666;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.dir-tree .tree-toggle.expanded {
    transform: rotate(90deg);
}
.dir-tree .tree-icon {
    margin-right: 0.4rem;
    font-size: 0.9rem;
}
.dir-tree .tree-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dir-tree .tree-children {
    display: none;
}
.dir-tree .tree-children.expanded {
    display: block;
}

/* ===== 搜索 ===== */
/* 搜索下拉结果 */
.search-container {
    position: relative;
}
.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 280px;
    overflow-y: auto;
}
.search-results.show {
    display: block;
}
.search-result-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover,
.search-result-item.active {
    background: rgba(3, 102, 214, 0.08);
    color: var(--link-color);
}
.search-no-results {
    padding: 0.75rem;
    color: #999;
    font-size: 0.8rem;
    text-align: center;
}
.search-loading {
    padding: 0.75rem;
    color: #999;
    font-size: 0.8rem;
    text-align: center;
}

/* ===== 回到顶部 ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--link-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    text-decoration: none;
}
.back-to-top:hover {
    background: #024ea4;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.back-to-top.show {
    display: flex;
}

/* ===== 面包屑 ===== */
.breadcrumb {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}
.breadcrumb a {
    color: var(--link-color);
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}
.breadcrumb span {
    margin: 0 0.5rem;
    color: #999;
}

/* ===== 响应式表格 ===== */
.table-wrapper {
    overflow-x: auto;
    margin: 1.2rem 0;
}

/* ===== 标题锚点 ===== */
.heading-anchor {
    opacity: 0;
    font-size: 0.8em;
    margin-left: 0.4rem;
    color: #999;
    text-decoration: none;
    transition: opacity 0.2s;
}
h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor {
    opacity: 1;
}

/* ===== 内容排版 ===== */
a {
    color: var(--link-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
h1, h2, h3, h4, h5, h6 {
    margin: 1.5rem 0 0.5rem;
    font-weight: 600;
    line-height: 1.3;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
p {
    margin: 0.8rem 0;
}
ul, ol {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
}
li {
    margin: 0.3rem 0;
}
code {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    border: 1px solid #e1e4e8;
}
pre {
    background: var(--code-bg);
    padding: 1rem 1.2rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.2rem 0;
    border: 1px solid #e1e4e8;
    line-height: 1.6;
    position: relative;
}
pre code {
    background: none;
    padding: 0;
    border: none;
    font-size: 0.875em;
    display: block;
}
/* 代码语言标签 */
.highlight {
    position: relative;
}
.highlight > pre {
    padding-top: 1.8rem;
}
blockquote {
    border-left: 4px solid #0366d6;
    padding: 0.6rem 1rem;
    margin: 1.2rem 0;
    color: #555;
    background: #f6f8ff;
    border-radius: 0 4px 4px 0;
}
blockquote p {
    margin: 0;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2rem 0;
    font-size: 0.9rem;
}
th, td {
    border: 1px solid #dfe2e5;
    padding: 0.5rem 0.75rem;
    text-align: left;
}
th {
    background: #f6f8fa;
    font-weight: 600;
}
tbody tr:nth-child(even) td {
    background: #fafbfc;
}
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0.5rem auto;
}
.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.post-list {
    list-style: none;
    padding: 0;
}
.post-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}
.post-list li:last-child {
    border-bottom: none;
}
.post-list a {
    font-weight: 500;
}
.category-section {
    margin: 2rem 0;
}
.category-section h2 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* ===== Rouge 代码高亮 (GitHub 风格) ===== */
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #6a737d } /* Comment */
.highlight .err { color: #b31d28; background-color: #ffeef0 } /* Error */
.highlight .k { color: #d73a49 } /* Keyword */
.highlight .l { color: #005cc5 } /* Literal */
.highlight .n { color: #24292e } /* Name */
.highlight .o { color: #d73a49 } /* Operator */
.highlight .p { color: #24292e } /* Punctuation */
.highlight .cm { color: #6a737d } /* Comment.Multiline */
.highlight .cp { color: #d73a49 } /* Comment.Preproc */
.highlight .c1 { color: #6a737d } /* Comment.Single */
.highlight .cs { color: #6a737d } /* Comment.Special */
.highlight .gd { color: #b31d28; background-color: #ffeef0 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gi { color: #22863a; background-color: #f0fff4 } /* Generic.Inserted */
.highlight .kc { color: #005cc5 } /* Keyword.Constant */
.highlight .kd { color: #d73a49 } /* Keyword.Declaration */
.highlight .kn { color: #d73a49 } /* Keyword.Namespace */
.highlight .kp { color: #d73a49 } /* Keyword.Pseudo */
.highlight .kr { color: #d73a49 } /* Keyword.Reserved */
.highlight .kt { color: #005cc5 } /* Keyword.Type */
.highlight .ld { color: #032f62 } /* Literal.Date */
.highlight .m { color: #005cc5 } /* Literal.Number */
.highlight .s { color: #032f62 } /* Literal.String */
.highlight .na { color: #6f42c1 } /* Name.Attribute */
.highlight .nb { color: #005cc5 } /* Name.Builtin */
.highlight .nc { color: #6f42c1 } /* Name.Class */
.highlight .no { color: #005cc5 } /* Name.Constant */
.highlight .nd { color: #6f42c1 } /* Name.Decorator */
.highlight .ni { color: #24292e } /* Name.Entity */
.highlight .ne { color: #b31d28 } /* Name.Exception */
.highlight .nf { color: #6f42c1 } /* Name.Function */
.highlight .nl { color: #24292e } /* Name.Label */
.highlight .nn { color: #24292e } /* Name.Namespace */
.highlight .nx { color: #24292e } /* Name.Other */
.highlight .py { color: #005cc5 } /* Name.Property */
.highlight .nt { color: #22863a } /* Name.Tag */
.highlight .nv { color: #e36209 } /* Name.Variable */
.highlight .ow { color: #d73a49 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #005cc5 } /* Literal.Number.Bin */
.highlight .mf { color: #005cc5 } /* Literal.Number.Float */
.highlight .mh { color: #005cc5 } /* Literal.Number.Hex */
.highlight .mi { color: #005cc5 } /* Literal.Number.Integer */
.highlight .mo { color: #005cc5 } /* Literal.Number.Oct */
.highlight .sb { color: #032f62 } /* Literal.String.Backtick */
.highlight .sc { color: #032f62 } /* Literal.String.Char */
.highlight .sd { color: #032f62 } /* Literal.String.Doc */
.highlight .s2 { color: #032f62 } /* Literal.String.Double */
.highlight .se { color: #032f62 } /* Literal.String.Escape */
.highlight .sh { color: #032f62 } /* Literal.String.Heredoc */
.highlight .si { color: #032f62 } /* Literal.String.Interpol */
.highlight .sx { color: #032f62 } /* Literal.String.Other */
.highlight .sr { color: #032f62 } /* Literal.String.Regex */
.highlight .s1 { color: #032f62 } /* Literal.String.Single */
.highlight .ss { color: #005cc5 } /* Literal.String.Symbol */
.highlight .bp { color: #005cc5 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #e36209 } /* Name.Variable.Class */
.highlight .vg { color: #e36209 } /* Name.Variable.Global */
.highlight .vi { color: #e36209 } /* Name.Variable.Instance */
.highlight .il { color: #005cc5 } /* Literal.Number.Integer.Long */

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .content-wrapper {
        margin-left: 0;
        max-width: 100%;
    }
    .sidebar-toggle {
        display: flex;
    }
}
@media (max-width: 600px) {
    .content-inner {
        padding: 1rem;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 36px;
        height: 36px;
    }
    .sidebar-toggle {
        bottom: 4rem;
        width: 36px;
        height: 36px;
    }
    table {
        font-size: 0.85rem;
    }
}

/* 首页卡片网格 */
.home-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}
.home-card {
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 1.2rem;
    background: #f8f9fa;
}
.home-card h3 {
    margin: 0 0 0.5rem;
}
.home-card p {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 0.8rem;
}
.home-card a {
    font-size: 0.85rem;
}
.home-link-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4rem 1rem;
}
.home-link-list li {
    margin: 0;
}
.home-link-list a {
    display: block;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
}
.home-link-list a:hover {
    background: rgba(0,0,0,0.04);
    text-decoration: none;
}
