
/* ================================================================
   TOC SIDEBAR — окремий файл /css/blog/toc-sidebar.css
   ================================================================ */

/* ── Grid layout: стаття + sidebar ── */
.post-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
    align-items: start;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 3rem;
}

/* Скидаємо старі стилі post-container всередині grid */
.post-layout .post-container {
    max-width: 100%;
    margin: 0;
}

/* ── Sticky sidebar ── */
.toc-sidebar {
    position: sticky;
    top: 90px;                        /* відступ від navbar */
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 136, 0.3) transparent;
    /* важливо: sidebar — самостійний grid-item, не тягнеться разом зі статтею */
    align-self: start;
}

.toc-sidebar::-webkit-scrollbar {
    width: 4px;
}
.toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 4px;
}


/* ── Список пунктів ── */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc-list li a {
    display: block;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.toc-list li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(0, 255, 136, 0.5);
}


/* H3 — вкладений пункт */
.toc-list li.toc-h3 a {
    padding-left: 1.2rem;
    font-size: 0.8rem;
}


/* ── Адаптив ── */
@media (max-width: 1100px) {
    .post-layout {
        grid-template-columns: 1fr 220px;
        padding: 0 2rem;
    }
}

@media (max-width: 900px) {
    .post-layout {
        display: block;  /* скидаємо grid повністю */
        padding: 0 1rem;
    }

    .toc-sidebar {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: static !important;
    }
}

@media (max-width: 768px) {
    .toc-sidebar {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .toc-sidebar {
        display: none !important;
    }
}