/**
 * 文章 / 合集侧栏章节目录（整页态）
 *
 * 2026-08-12：从 b2child 那套白底卡片（边框 + 阴影 + 16px 带下划线的标题）换成极简样式，
 * 与知识库阅读页「本页目录」同款（plugins/mytheme-kb/assets/css/reader.css 的
 * .mytheme-kb-page-toc-*）：无卡片底，标题是 13px 灰小标。
 * 文章页列表仍是 text-subhead 15 / 1.5；合集整页压成 14 / 20（见下方
 * .single-tool_collection），与知识库左右栏同一档。面板态 PostPanelToc 合集分支
 * 同样 14 / 20（collection-front.css）。
 */

.mytheme-sidebar-toc {
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin-top: 0;
    margin-bottom: 0;
}

.mytheme-sidebar-toc__title {
    font-size: 13px;
    font-weight: 600;
    color: #999999;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    text-align: left;
}

/* 导轨只跟着列表走：标题在 ol 之外，不会被这条线顶到旁边 */
.mytheme-sidebar-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid #ededed;
}

/* 子级共用外层那条导轨，自己不再画线，否则 H3 旁边会出现第二条竖线 */
.mytheme-sidebar-toc__list--sub {
    border-left: 0;
    margin-top: 0;
    padding-left: 0;
}

.mytheme-sidebar-toc__item {
    margin-bottom: 0;
}

.mytheme-sidebar-toc__link {
    display: block;
    color: #666666;
    font-size: 15px; /* 文章页：text-subhead */
    font-weight: 400;
    line-height: 1.5;
    padding: 5px 0 5px 12px;
    text-decoration: none;
    /* 负 margin 让 2px 的激活线正好盖住 1px 导轨，而不是并排显示成两条 */
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.mytheme-sidebar-toc__link:hover {
    color: #222222;
    background: none;
    border-left-color: transparent;
}

.mytheme-sidebar-toc__link--h3 {
    padding-left: 28px;
}

.mytheme-sidebar-toc__link.is-active {
    color: #e03030;
    background-color: transparent;
    border-left-color: #e03030;
    font-weight: 500;
}

/* 合集整页：与知识库左右栏同一档 14 / 20。文章页仍用上面的 15 / 1.5 */
.single-tool_collection .mytheme-sidebar-toc__link {
    font-size: 14px;
    line-height: 20px;
}

/* 进度环 + 回到顶部：留着功能，但去掉分隔线和卡片感，跟列表左缘对齐 */
.mytheme-sidebar-toc__footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 14px 0 0 12px;
    margin-top: 4px;
    border-top: 0;
    color: #999999;
}

.mytheme-sidebar-toc__ring {
    position: relative;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.mytheme-sidebar-toc__ring svg {
    width: 26px;
    height: 26px;
    transform: rotate(-90deg);
    display: block;
}

.mytheme-sidebar-toc__ring .ring-bg {
    fill: none;
    stroke: #ededed;
    stroke-width: 2.5;
}

.mytheme-sidebar-toc__ring .ring-fill {
    fill: none;
    stroke: #e03030;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.mytheme-sidebar-toc__ring-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* WHY: 环内数字属于装饰性微标，13px 塞不进 26px 的圆环 */
    font-size: 9px;
    font-weight: 500;
    color: #999999;
    line-height: 1;
}

.mytheme-sidebar-toc__backtop {
    cursor: pointer;
    color: #999999;
    font-size: 13px;
    transition: color 0.15s ease;
}

.mytheme-sidebar-toc__backtop:hover {
    color: #222222;
}

/* 锚点跳转时预留顶栏高度，与 sidebar-toc.js 的 SCROLL_OFFSET 保持一致 */
.single .entry-content h2[id],
.single .entry-content h3[id],
.single-tool_collection .entry-content h2[id],
.single-tool_collection .entry-content h3[id] {
    scroll-margin-top: 90px;
}

/* 桌面端：大纲顶部与左侧正文卡片顶部对齐 */
@media (min-width: 1024px) {
    .single .mytheme-single-grid {
        align-items: start;
    }

    .single .mytheme-single-grid > aside {
        align-self: start;
    }

    .single .mytheme-sidebar-toc,
    .single-tool_collection .mytheme-sidebar-toc {
        margin-top: 0;
    }
}
