/* crimson · 阅读增强（目录 TOC / 阅读进度条） */

/* 阅读进度条：顶部细红线 */
.cr-rbar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: #b91c1c;
    z-index: 9999;
    pointer-events: none;
    transition: width .08s linear;
}

/* 目录盒 */
.cr-toc {
    margin: 0 0 22px;
    padding: 12px 16px 12px 22px;
    border: 1px solid #eee;
    border-left: 3px solid #b91c1c;
    border-radius: 4px;
    background: #fafafa;
    font-size: 14px;
}

.cr-toc-title {
    font-weight: 700;
    margin: 0 0 8px;
    color: #b91c1c;
    cursor: pointer;
    user-select: none;
}

.cr-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cr-toc li {
    margin: 3px 0;
    line-height: 1.6;
}

.cr-toc li.cr-toc-h3 {
    padding-left: 16px;
}

.cr-toc a {
    color: #444;
    text-decoration: none;
    border-bottom: 1px dotted transparent;
}

.cr-toc a:hover,
.cr-toc a.cr-toc-on {
    color: #b91c1c;
    border-bottom-color: #b91c1c;
}

@media (min-width: 1024px) {
    /* 文章区较宽时收纳为可折叠小盒，避免占满首屏 */
    .cr-toc {
        padding: 10px 14px 10px 20px;
    }
}

/* 阅读工具栏（A-/A+ 字号、行距、明暗主题） */
.cr-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
    font-size: 13px;
}

.cr-tools button {
    border: 1px solid #e3e5e8;
    background: #fff;
    color: #444;
    border-radius: 4px;
    padding: 3px 10px;
    cursor: pointer;
    line-height: 1.5;
}

.cr-tools button:hover {
    border-color: #b91c1c;
    color: #b91c1c;
}

.cr-tools .cr-tools-label {
    color: #888;
    margin-right: 2px;
}

.cr-tools .cr-fs-val {
    display: inline-block;
    min-width: 46px;
    text-align: center;
    color: #666;
    font-variant-numeric: tabular-nums;
}

body.night .cr-tools .cr-fs-val {
    color: #aaa;
}

/* 暗色主题下的阅读组件 */
body.night .cr-tools button {
    background: #1e1e1e;
    border-color: #333;
    color: #c9c9c9;
}

body.night .cr-toc {
    background: #171717;
    border-color: #333;
    border-left-color: #e04b4b;
}

body.night .cr-toc a {
    color: #bbb;
}

body.night .cr-toc a:hover,
body.night .cr-toc a.cr-toc-on {
    color: #ff8f8f;
}

/* 行距/主题按钮固定最小宽度，避免文字切换时抖动 */
.cr-tools .cr-lh-btn { min-width: 78px; }
.cr-tools .cr-theme-btn { min-width: 92px; }

/* 移动端：工具栏收纳（隐藏字号百分比、取消最小宽度、按钮可换行） */
@media screen and (max-width: 640px) {
    .cr-tools {
        gap: 5px;
        font-size: 12px;
    }
    .cr-tools .cr-fs-val {
        display: none;
    }
    .cr-tools button {
        padding: 4px 8px;
    }
    .cr-tools .cr-lh-btn,
    .cr-tools .cr-theme-btn {
        min-width: 0;
    }
}

/* 正文段落统一样式：替代旧文章内联 style（仅作用于启用首行缩进的正文） */
.article-body .indent p {
    margin: 5px 0;
    text-indent: 2em;
    text-align: left;
}
.article-body br {
    margin: 0;
}

/* 行距切换通过 --cr-lh 级联到正文段落（默认 1.9 与主题一致） */
.article-body p {
	line-height: var(--cr-lh, 1.9);
}
