/* 自定义中文字体 */
body {
    font-family: "PingFang SC", "Microsoft YaHei", SimHei, sans-serif;
}
code, pre {
    font-family: Consolas, "Monaco", monospace;
}

/* ========== 侧边栏导航强制展开 ========== */
.wy-menu-vertical li.current ul {
    display: block !important;
}
.wy-menu-vertical li.toctree-l1 a { padding-left: 1.2em !important; }
.wy-menu-vertical li.toctree-l2 a { padding-left: 2.4em !important; }
.wy-menu-vertical li.toctree-l3 a { padding-left: 3.6em !important; font-size: 0.9em !important; }
.wy-menu-vertical li.toctree-l4 a { padding-left: 4.8em !important; font-size: 0.85em !important; }

/* ========== 目录层级图标：黑圆→白圆→黑方→白方 ========== */
/* 正文 toctree 目录（.rst-content .toctree-wrapper）的符号来自浏览器默认嵌套 ul：
   L1=disc(黑圆●) L2=circle(白圆○) L3=square(黑方■) L4=square(黑方■→改白方□) */
/* 第4层：黑方 → 白方 □（空心方块） */
li.toctree-l4 {
    list-style-type: square !important;
}
li.toctree-l4::marker {
    content: "□";
    color: #999;
    font-size: 0.75em;
}
/* 兼容：部分浏览器 ::marker content 限制时，用 ::before 兜底（仅当 li 有直接文字时生效） */

/* ========== 爱马仕力学块内：隐藏第4层（白方块层级） ========== */
/* 结构：li.l1(力学) > ul > li.l2(爱马仕力学) > ul > li.l3 > ul > li.l4(写在前面等) */
/* 精确定位：爱马仕力学 l2 的 href 为 URL 编码（%E7%88%B1%E9%A9%AC%E4%BB%95%E5%8A%9B%E5%AD%A6=爱马仕力学） */
.toctree-wrapper li.toctree-l2:has(> a[href*="%E7%88%B1%E9%A9%AC%E4%BB%95%E5%8A%9B%E5%AD%A6/%E7%88%B1%E9%A9%AC%E4%BB%95%E5%8A%9B%E5%AD%A6.html"]) li.toctree-l4 {
    display: none !important;
}
/* 兜底：部分浏览器不支持 :has() 时，用 JS 在页面加载后处理（见下方脚本） */

/* ========== 创业维艰块内：隐藏第4层（白方块层级，主目录过长） ========== */
/* 结构：li.l1(创业维艰) > ul > li.l2(团队等) > ul > li.l3 > ul > li.l4(一、二、三...) */
/* 精确定位：创业维艰 l1 的 href 为 URL 编码（%E5%88%9B%E4%B8%9A%E7%BB%B4%E8%89%B0=创业维艰） */
.toctree-wrapper li.toctree-l1:has(> a[href*="%E5%88%9B%E4%B8%9A%E7%BB%B4%E8%89%B0/%E5%88%9B%E4%B8%9A%E7%BB%B4%E8%89%B0.html"]) li.toctree-l4 {
    display: none !important;
}
/* 兜底：部分浏览器不支持 :has() 时，用 JS 在页面加载后处理（见下方脚本） */

/* ========== sphinx-copybutton 样式 ========== */
button.copybtn {
    transition: all 0.3s ease;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 8px;
}
button.copybtn:hover {
    background: #3a3a3a;
    border-color: #e94560;
}

/* ========== sphinx-design 卡片样式 ========== */
.sd-card {
    border-radius: 8px !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
}
.sd-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
}
.sd-card-title {
    font-weight: 600 !important;
}

/* ========== sphinx-inline-tabs 样式 ========== */
.tab-set {
    border-radius: 6px;
    overflow: hidden;
    margin: 1em 0;
}
.tab-set > label {
    background: #f0f0f0;
    padding: 8px 16px;
    font-weight: 500;
    transition: background 0.2s;
}
.tab-set > label:hover {
    background: #e0e0e0;
}
.tab-set > input:checked + label {
    background: #2980b9 !important;
    color: white !important;
}
.tab-set > .tab-content {
    border: 1px solid #ddd;
    border-top: none;
    padding: 16px;
    background: #fafafa;
}

/* ========== 移动端响应式优化 ========== */
@media screen and (max-width: 768px) {
    /* 在小屏幕上缩小字体 */
    body {
        font-size: 15px;
    }
    .wy-nav-content {
        padding: 12px !important;
    }
    /* 代码块在小屏上可横向滚动 */
    div[class*="highlight"] {
        overflow-x: auto;
    }
    /* 表格在小屏上可横向滚动 */
    .wy-table-responsive table td {
        white-space: normal !important;
    }
    /* 首页更新日志表格 */
    .wy-table-responsive {
        overflow-x: auto;
    }
}

/* ========== 首页特殊样式 ========== */
/* "新增内容"提示框 */
div[style*="background: #fff3e0"] {
    border-left: 4px solid #e94560 !important;
}

/* ========== 更新日志（可滚动、占空间小） ========== */
.update-log-scroll {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    background: #fafafa;
    scrollbar-width: thin;
    scrollbar-color: #bbb #f0f0f0;
}
.update-log-scroll::-webkit-scrollbar {
    width: 6px;
}
.update-log-scroll::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}
.update-log-scroll::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 3px;
}
.update-log-scroll::-webkit-scrollbar-thumb:hover {
    background: #999;
}
.update-log-title {
    font-weight: 600;
    margin: 6px 0 4px;
    font-size: 0.95em;
    color: #1a1a2e;
}
.update-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    margin-bottom: 6px;
}
.update-log-table th {
    text-align: left;
    font-weight: 600;
    background: #f0f0f0;
    padding: 3px 8px;
    border: 1px solid #e0e0e0;
}
.update-log-table td {
    padding: 3px 8px;
    border: 1px solid #e0e0e0;
    vertical-align: top;
}
.update-log-table tr:nth-child(even) td {
    background: #f5f5f5;
}
.log-date {
    white-space: nowrap;
    font-weight: 500;
    color: #555;
}

/* ========== 深色模式适配 ========== */
@media (prefers-color-scheme: dark) {
    .tab-set > label {
        background: #2d2d2d;
        color: #ccc;
    }
    .tab-set > label:hover {
        background: #3a3a3a;
    }
    .tab-set > .tab-content {
        background: #1e1e1e;
        border-color: #444;
    }
    .sd-card {
        background: #2d2d2d !important;
        border-color: #444 !important;
    }
    .sd-card-text {
        color: #ccc !important;
    }
}
