/*******************************************************************************
CUSTOM STYLES

Override default styles for better readability of long technical notes.
*******************************************************************************/

/* === 字体大小适配 === */
html {
    font-size: 12pt;
}

/* === 内容列宽度适配 === */
/* 加宽主内容列从 55% 到 65%，更适合长篇技术笔记 */
.article-byline {
    width: 65%;
}

section > img,
section > svg {
    max-width: 65%;
    left: 32.5%;
}

pre {
    width: 65%;
}

figure[role="math"] {
    width: 65%;
}

div[style*="border-inline-start"] {
    width: 65% !important;
}

.blog-entry {
    width: 65%;
}

/* 裸表居中适配 */
section > table {
    left: 32.5%;
}

/* === TOC 侧边栏优化 === */
.toc-sidebar {
    width: 16%;
    left: 2%;
    top: 12rem;
    max-height: calc(100vh - 14rem);
    font-size: 0.9rem;
}

/* 所有 TOC 条目统一左对齐基线 */
.toc-sidebar li {
    padding-left: 0;
}

/* h2 顶层标题（第一章、第二章...） */
.toc-sidebar .toc-h2 {
    font-weight: 600;
    margin-top: 0.6em;
}

/* h3 二级标题缩进 */
.toc-sidebar .toc-h3 {
    padding-left: 1.2em;
}

/* h4 三级标题缩进 */
.toc-sidebar .toc-h4 {
    padding-left: 2.4em;
    font-size: 0.85em;
    opacity: 0.85;
}

.toc-sidebar a:any-link {
    font-size: 0.9rem;
    line-height: 1.3;
    padding-left: 0.5em;
}

/* 降低 TOC 显示阈值从 1200px 到 1024px */
@media (min-width: 1024px) {
    .toc-sidebar {
        display: block;
    }
}

/* === 章节号样式 === */
.section-number {
    font-weight: 600;
    margin-right: 0.3em;
    color: var(--theme-text, inherit);
}

/* TOC 中的章节号 */
.toc-sidebar .section-number {
    font-weight: 600;
    margin-right: 0.2em;
}

/* === 表格适配 === */
table {
    font-size: 1.3rem;
}

/* === 移动端适配 === */
@media (max-width: 760px) {
    html {
        font-size: 13pt;
    }

    .toc-sidebar {
        display: none !important;
    }

    .article-byline,
    section > img,
    section > svg,
    pre,
    figure[role="math"],
    div[style*="border-inline-start"],
    .blog-entry {
        width: 90% !important;
        left: 5% !important;
        transform: none !important;
    }

    section > table {
        left: 0 !important;
        transform: none !important;
    }
}
