/* Article navigation is an enhancement: no headings or no JS keeps the original layout. */
.post-layout.has-toc {
    display: grid;
    grid-template-areas: "toc" "article";
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 24px;
}
.post-layout > .post-main {
    grid-area: article;
    min-width: 0;
}
.post-toc[hidden] {
    display: none;
}
.post-toc {
    grid-area: toc;
    position: sticky;
    top: 12px;
    z-index: 10;
    min-width: 0;
    align-self: start;
    color: #66717e;
    font-size: 13px;
    line-height: 1.45;
    letter-spacing: 0;
}
.post-toc-panel {
    border: 1px solid #e6e9ed;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgb(30 45 65 / 4%);
}
.post-toc-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    cursor: pointer;
    list-style: none;
}
.post-toc-summary::-webkit-details-marker {
    display: none;
}
.post-toc-title {
    flex: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: #788390;
}
.post-toc-current {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    color: #445264;
}
.post-toc-chevron {
    flex: none;
    transition: transform 160ms ease;
}
.post-toc-panel[open] .post-toc-chevron {
    transform: rotate(180deg);
}
.post-toc-nav {
    max-height: calc(70vh - 54px);
    max-height: calc(70dvh - 54px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d4dae2 transparent;
    padding: 0 12px 12px;
}
.post-toc-nav::-webkit-scrollbar {
    width: 4px;
}
.post-toc-nav::-webkit-scrollbar-thumb {
    background: #d4dae2;
    border-radius: 4px;
}
.post-toc-list,
.post-toc-list ol {
    padding: 0;
    margin: 0;
    list-style: none;
}
.post-toc-list ol {
    padding-left: 14px;
}
.post-toc-list a {
    display: block;
    margin: 2px 0;
    padding: 7px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    color: #75808d;
    overflow-wrap: anywhere;
    text-decoration: none;
    transition: background-color 140ms ease, color 140ms ease;
}
.post-toc-list > li > a {
    color: #586574;
    font-weight: 500;
}
.post-toc-list a:hover {
    color: #263e56;
    background: #f5f7fa;
}
.post-toc-list a.is-active {
    color: #2876ad;
    border-left-color: #428bca;
    background: #edf5fb;
    font-weight: 600;
}
.post-toc-summary:focus-visible,
.post-toc-nav:focus-visible,
.post-toc-list a:focus-visible {
    outline: 2px solid #428bca;
    outline-offset: 3px;
}
.post-page .post-md :is(h1, h2, h3, h4, h5, h6),
.post-page .post-md :is(h1, h2, h3, h4, h5, h6) > [id] {
    scroll-margin-top: 100px;
}
.post-page .post-md :is(h1, h2, h3, h4, h5, h6):focus {
    outline: none;
}
@media (min-width: 1180px) {
    /* 目录列宽为 0，目录本身向右溢出到内容栏外侧的留白里，正文占满内容栏 */
    .post-layout.has-toc {
        grid-template-areas: "article toc";
        grid-template-columns: minmax(0, 1fr) 0;
        gap: 0;
    }
    .post-toc {
        width: 224px;
        margin-left: 40px;
        top: 32px;
        z-index: 1;
        padding-top: 4px;
    }
    .post-toc-panel {
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
    .post-toc-summary {
        padding: 0 0 16px 12px;
        cursor: default;
    }
    .post-toc-current,
    .post-toc-chevron {
        display: none;
    }
    .post-toc-nav {
        max-height: var(--toc-available-height, calc(100vh - 112px));
        max-height: var(--toc-available-height, calc(100dvh - 112px));
        padding: 0 10px 4px 0;
        border-left: 1px solid #e9edf1;
    }
    .post-toc-list a {
        margin-left: -1px;
        padding: 7px 11px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .post-page,
    html {
        scroll-behavior: auto;
    }
    .post-toc-chevron,
    .post-toc-list a {
        transition: none;
    }
}
@media print {
    .post-toc {
        display: none;
    }
    .post-layout.has-toc {
        display: block;
    }
}
