/* Reading progress bar + sticky TOC for article pages */

#reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #FF6B35, #FF8A5C);
    z-index: 9999;
    box-shadow: 0 1px 4px rgba(255, 107, 53, .4);
    transition: width 100ms linear;
}

#article-toc {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    max-width: 260px;
    max-height: 70vh;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .12);
    border: 1px solid rgba(0, 0, 0, .06);
    z-index: 40;
    font-size: 14px;
    display: flex;
    flex-direction: column;
}

#article-toc .toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8A5C 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}
#article-toc .toc-title { font-weight: 700; font-size: 14px; }
#article-toc .toc-toggle {
    width: 28px; height: 28px;
    background: rgba(255,255,255,.2);
    border: none; border-radius: 50%;
    color: white; font-size: 18px; font-weight: bold;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
#article-toc .toc-toggle:hover { background: rgba(255,255,255,.35); }

#article-toc .toc-list {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    overflow-y: auto;
    max-height: calc(70vh - 56px);
}

#article-toc .toc-list li { margin: 0; padding: 0; counter-increment: toc-counter; }
#article-toc .toc-list { counter-reset: toc-counter; }
#article-toc .toc-list a {
    display: block;
    padding: 8px 16px 8px 36px;
    color: #4A5568;
    text-decoration: none;
    border-left: 3px solid transparent;
    line-height: 1.45;
    position: relative;
    transition: all .15s;
}
#article-toc .toc-list a::before {
    content: counter(toc-counter);
    position: absolute;
    left: 12px;
    top: 8px;
    width: 18px;
    height: 18px;
    background: #f3f4f6;
    border-radius: 50%;
    color: #6b7280;
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    line-height: 18px;
}
#article-toc .toc-list a:hover {
    background: rgba(255, 107, 53, 0.06);
    color: #FF6B35;
    border-left-color: #FF6B35;
}
#article-toc .toc-list a.active {
    background: rgba(255, 107, 53, 0.1);
    color: #FF6B35;
    font-weight: 600;
    border-left-color: #FF6B35;
}
#article-toc .toc-list a.active::before {
    background: #FF6B35;
    color: white;
}

#article-toc.collapsed .toc-list { display: none; }

/* Mobile: collapse by default, position bottom-right */
@media (max-width: 1024px) {
    #article-toc {
        right: 12px;
        bottom: 90px;
        top: auto;
        transform: none;
        max-width: calc(100vw - 24px);
    }
}

@media (max-width: 640px) {
    #article-toc { max-width: 280px; font-size: 13px; }
    #article-toc .toc-header { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    #reading-progress-bar, #article-toc .toc-list a { transition: none; }
}
