/* 自动标题编号样式 */

/* 重置计数器 */
body {
    counter-reset: h1-counter;
}

/* 一级标题自动编号 */
h1 {
    counter-reset: h2-counter;
}

h1::before {
    counter-increment: h1-counter;
    content: counter(h1-counter) ". ";
    color: #37352f;
    font-weight: bold;
    margin-right: 0.3em;
}

/* 二级标题自动编号 */
h2 {
    counter-reset: h3-counter;
}

h2::before {
    counter-increment: h2-counter;
    content: counter(h1-counter) "." counter(h2-counter) " ";
    color: #37352f;
    font-weight: bold;
    margin-right: 0.3em;
}

/* 三级标题自动编号 */
h3 {
    counter-reset: h4-counter;
}

h3::before {
    counter-increment: h3-counter;
    content: counter(h1-counter) "." counter(h2-counter) "." counter(h3-counter) " ";
    color: #37352f;
    font-weight: bold;
    margin-right: 0.3em;
}

/* 四级标题自动编号 */
h4::before {
    counter-increment: h4-counter;
    content: counter(h1-counter) "." counter(h2-counter) "." counter(h3-counter) "." counter(h4-counter) " ";
    color: #37352f;
    font-weight: bold;
    margin-right: 0.3em;
}

/* 排除导航栏和侧边栏的标题 */
.menu-title::before,
.chapter-title::before,
.sidebar-title::before {
    content: none;
}

/* 深色主题适配 */
.ayu h1::before,
.ayu h2::before,
.ayu h3::before,
.ayu h4::before,
.coal h1::before,
.coal h2::before,
.coal h3::before,
.coal h4::before,
.navy h1::before,
.navy h2::before,
.navy h3::before,
.navy h4::before,
.rust h1::before,
.rust h2::before,
.rust h3::before,
.rust h4::before {
    color: #c6cddb;
}

/* 打印样式 */
@media print {
    h1::before,
    h2::before,
    h3::before,
    h4::before {
        color: #000;
    }
}
