/* Floating TOC Styles - C Concepts Theme */
:root {
    --accent-c: #2c3e50;
    --accent-c-light: #4ca1af;
    --active-link: #3b82f6;
}

.article-wrapper {
    display: flex;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.toc-sidebar {
    width: 250px;
    position: sticky;
    top: 2rem;
    height: fit-content;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 1.5rem;
    background: #fbfbfb;
    border: 1px solid #eaeaea;
    border-radius: 6px;
    margin-right: 20px;
    margin-top: 3rem;
    font-family: var(--font-sans);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toc-sidebar h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--accent-c);
}

.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
}

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

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
    display: block;
}

.toc-list a:hover, .toc-list a.active {
    color: var(--active-link);
    font-weight: 600;
}

.toc-list ul {
    list-style: none;
    padding-left: 1rem;
    margin-top: 0.25rem;
}

/* Floating button for mobile / collapsed state */
.toc-fab {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent-c);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    z-index: 1000;
}

/* Collapsed state for desktop */
.toc-sidebar.collapsed {
    transform: translateX(-120%);
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

/* Header customization */
.article-header h1 {
    color: var(--accent-c);
}

.subtitle {
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive TOC */
@media (max-width: 1100px) {
    .toc-sidebar {
        position: fixed;
        bottom: 5rem;
        right: 2rem;
        top: auto;
        left: auto;
        margin: 0;
        z-index: 999;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        transform: translateY(120%);
        opacity: 0;
        pointer-events: none;
        width: 300px;
    }
    
    .toc-sidebar.show {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }
    
    .toc-fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .article-wrapper {
        display: block;
    }
}

/* Code block adjustments for C */
code {
    font-family: 'Fira Code', monospace;
}
pre {
    background: #f8fafc;
    border-left: 4px solid var(--accent-c-light);
    border-radius: 4px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}
