/* ==========================================================================
   A. 目录 / 导航组件
   ========================================================================== */
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    margin: 0;
    padding: 0;
    min-width: 960px;
}
/* ---------- A1. 悬浮抽屉 TOC（右侧滑入） ---------- */
.toc-wrapper { position: relative; }

.toc {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 260px;
    max-height: 85vh;
    overflow-y: auto;
    background: #222222;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 10px;
    color: #fff;
    z-index: 900;
    transform: translateX(calc(100% + 12px)); /* 默认隐藏在右侧 */
    transition: transform 0.25s ease;
}
.toc.open { transform: translateX(0); }       /* 展开状态 */

.toc-title {
    font-weight: bold;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #444;
}

.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 4px 0; }
.toc a { color: #ffdd00; text-decoration: none; }
.toc a:visited { color: #ffdd00; }
.toc a:hover { color: #fff280; text-decoration: underline; }
.toc a:active { color: #ffffff; }
.toc a.active { color: #ffcc44; font-weight: bold; }

/* 目录层级缩进 */
.toc-item-h1 { padding-left: 0px; }
.toc-item-h1 a { font-size: 15px; }
.toc-item-h2 { padding-left: 16px; }
.toc-item-h2 a { font-size: 14px; }
.toc-item-h3 { padding-left: 32px; }
.toc-item-h3 a { font-size: 13px; }

/* 抽屉开关按钮 */
.toc-toggle {
    position: fixed;
    z-index: 901;
    top: 1rem;
    right: 1rem;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 6px 10px;
}

/* ---------- A2. 页面内两栏静态目录（sticky 侧边栏） ---------- */
.page-toc-wrapper {
    display: grid;
    grid-template-columns: 240px 1fr;  /* 左栏240px + 右栏自适应 */
    gap: 20px;
    background: #632000;
    padding: 16px;
    border-radius: 8px;
}

.page-toc {
    position: sticky;
    top: 80px;                         /* 滚动时吸顶偏移 */
    height: calc(100vh - 100px);
    overflow-y: auto;
    border: 1px solid #555555;
    border-radius: 8px;
    padding: 12px;
    background: #382214;
}

.page-toc-title {
    font-weight: bold;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #444444;
}

#page-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
#page-toc-list li { margin: 6px 0; }

/* 移动端目录切换按钮（默认隐藏） */
.page-toc-toggle {
    display: none;
    padding: 8px 12px;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 10px;
    background: #4b2b18;
    color: #fff;
    border: 1px solid #666;
    border-radius: 4px;
}

.page-toc-content {}


/* ==========================================================================
   B. 主题系统
   ========================================================================== */

/* ---------- B1. 三套深色主题 ---------- */
body.dark-theme  { background: #2c2c2c; color: #ffffff; line-height: 1.7; }
body.dark-theme-c { background: #1a1a1a; color: #ffffff; line-height: 1.7; }
body.dark-theme-b { background: #1A497A; color: #ffffff; line-height: 1.7; }

/* ---------- B2. 全局 a 链接颜色规则 ---------- */
body.dark-theme a, body.dark-theme-c a, body.dark-theme-b a {
    color: #ffdd00; text-decoration: none;
}
body.dark-theme a:visited, body.dark-theme-c a:visited, body.dark-theme-b a:visited {
    color: #ffdd00;
}
body.dark-theme a:hover, body.dark-theme-c a:hover, body.dark-theme-b a:hover {
    color: #fff280; text-decoration: underline;
}
body.dark-theme a:active, body.dark-theme-c a:active, body.dark-theme-b a:active {
    color: #ffffff;
}

/* 兜底：非 body 类下的链接默认色 */
a { color: #ffdd00; text-decoration: none; }


/* ==========================================================================
   C. Markdown 阅读器
   ========================================================================== */

/* Markdown 主内容滚动区域 */
.md-main-wrap {
    margin-top: 100px;
    height: calc(100% - 100px);
    overflow-y: auto;
    scroll-padding-top: 110px;
}

/* 锚点跳转偏移（避免被固定导航遮挡） */
#markdownContent [id] { scroll-margin-top: 110px; }

/* Markdown 内容主体卡片 */
#markdownContent {
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
    background-color: #37383a;
    color: #eeeeee;
    border-radius: 6px;
}

/* Markdown 页面内导航链接 */
.md-nav-link {
    font-size: 16px;
    color: #ffdd00;
    text-decoration: underline;
    cursor: pointer;
    margin: 0 12px;
}
.md-nav-link:hover { color: #fff280; }


/* ==========================================================================
   D. 正文卡片（业务变体）
   ========================================================================== */

/* ---------- D1. 正文卡片容器 + 所有业务主题色 ---------- */
main.toc-content {
    display: block;
    width: 960px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    box-sizing: border-box;
    background: #632000;        /* 默认：棕色 */
    color: #ffffff;
    line-height: 1.7;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    border-radius: 8px;
}
main.toc-content.b   { background: #1A497A; }  /* 蓝色 */
main.toc-content.it  { background: #2c2c2c; }  /* 深灰 */
main.toc-content.gr  { background: #1D6F06; }  /* 绿色 */
main.toc-content.nv  { background: #7f1cad; }  /* 紫色 */
main.toc-content.ws1 { background: #326496; }  /* 钢蓝 */
main.toc-content.ws2 { background: #1A497A; }  /* 深蓝 */
main.toc-content.ws3 { background: #12385F; }  /* 藏青 */
main.toc-content.ws4 { background: #0B2744; }  /* 暗蓝 */
main.toc-content.ws5 { background: #071A30; }  /* 极暗蓝 */
main.toc-content.proj{ background: #283822; }  /* 橄榄绿 */
main.toc-content.arc { background: #382430; }  /* 暗紫红 */

/* ---------- D2. 正文卡片内部文字、列表 ---------- */
main.toc-content h1, main.toc-content h2, main.toc-content h3,
main.toc-content h4, main.toc-content p, main.toc-content li,
main.toc-content td, main.toc-content th, main.toc-content dd, main.toc-content dt {
    color: #ffffff;
}

main.toc-content ul {
    margin: 0.8em 0;
    list-style-position: outside;
    padding-left: 1.6em;
}
main.toc-content ol {
    margin: 0.8em 0;
    padding-left: 1.6em;
}

/* ---------- D3. 表格 ---------- */
main.toc-content table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
main.toc-content th, main.toc-content td {
    border: 1px solid rgba(255,255,255,0.25);
    padding: 8px 12px;
}
main.toc-content th { background: rgba(0,0,0,0.3); font-weight: bold; }
main.toc-content tr:nth-child(even) td { background: rgba(0,0,0,0.1); }


/* ==========================================================================
   E. 代码块（深色主题 + 浅色兜底）
   ========================================================================== */

/* 行内 code */
body.dark-theme code, body.dark-theme-c code, body.dark-theme-b code,
main.toc-content code {
    background-color: rgba(0,0,0,0.35);
    color: #f8f8f2;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: Consolas, Menlo, monospace;
    font-size: 0.92em;
}

/* 代码块 pre */
body.dark-theme pre, body.dark-theme-c pre, body.dark-theme-b pre,
main.toc-content pre {
    background-color: rgba(0,0,0,0.45);
    color: #f8f8f2;
    border-radius: 6px;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: Consolas, Menlo, monospace;
    font-size: 0.92em;
    line-height: 1.55;
    border: 1px solid rgba(255,255,255,0.12);
}

/* pre 内的 code 重置背景 */
body.dark-theme pre code, body.dark-theme-c pre code, body.dark-theme-b pre code,
main.toc-content pre code { background: transparent; padding: 0; border-radius: 0; }

/* 浅色模式兜底 */
pre {
    background: #f4f4f4;
    color: #222;
    border-radius: 6px;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: Consolas, Menlo, monospace;
    border: 1px solid #ddd;
}
code {
    background: #eee;
    padding: 0.15em 0.4em;
    border-radius: 4px;
}
pre code { background: transparent; padding: 0; }