/* ===================================================
   Sassly Blog Section Scroller v2 — Full Layout Build
   =================================================== */

/* ── Reset & layout wrapper ── */
.liblogs-layout {
    display: flex;
    align-items: flex-start;
    gap: 48px;
    position: relative;
    width: 100%;
}

/* ── Sidebar ──
   Base position is "sticky" as a no-JS fallback. On load, liblogs-script.js
   measures this element and switches it to true position:fixed (inline
   style, which wins over this rule) so it stays locked to the viewport
   while the content column scrolls. */
.liblogs-sidebar {
    width: 270px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
    z-index: 999;
}

/* Placeholder inserted by JS to hold the sidebar's flex column open
   once the real sidebar is pulled out of flow via position:fixed.
   Width is hardcoded to match .liblogs-sidebar's width below —
   if you change one, change the other. */
.liblogs-sidebar-spacer {
    width: 270px;
    flex-shrink: 0;
}

.liblogs-sidebar::-webkit-scrollbar { width: 4px; }
.liblogs-sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* ── TOC card ── */
.liblogs-toc {
    background: #fff;
    border: 1.5px solid #e4e1f5;
    border-radius: 14px;
    padding: 22px 18px 18px;
}

.liblogs-toc__label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #1a1730;
    margin: 0 0 14px;
}

.liblogs-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.liblogs-toc__item a {
    display: block;
    font-size: 13.5px;
    line-height: 1.45;
    color: #5a5870;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}

.liblogs-toc__item a:hover {
    background: #f3f1ff;
    color: #5643d6;
}

.liblogs-toc__item.is-active a {
    background: #eeebff;
    color: #5643d6;
    font-weight: 600;
}

.liblogs-toc__item--sub a {
    padding-left: 26px;
    font-size: 13px;
    color: #8886a0;
}

.liblogs-toc__item--sub.is-active a {
    background: #eeebff;
    color: #5643d6;
    font-weight: 600;
}

/* ── Main content ── */
.liblogs-content {
    flex: 1;
    min-width: 0;
}

/* ── Sections: each H2 block becomes a scroll section ── */
.liblogs-section {
    scroll-margin-top: 100px;
    padding-bottom: 8px;
}

/* ── Next section button ── */
.liblogs-next-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 36px 0 8px;
    padding: 11px 22px;
    background: transparent;
    border: 1.5px solid #5643d6;
    border-radius: 8px;
    color: #5643d6;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
    user-select: none;
}

.liblogs-next-btn:hover {
    background: #5643d6;
    color: #fff;
}

.liblogs-next-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.18s;
}

.liblogs-next-btn:hover svg {
    transform: translateY(2px);
}

/* ── Reading progress bar ── */
.liblogs-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #5643d6 0%, #9c8ff5 100%);
    z-index: 99999;
    pointer-events: none;
    transition: width 0.08s linear;
}

/* ── Flash highlight when landing on a section ── */
@keyframes liblogs-land {
    0%   { background-color: #eeebff; }
    100% { background-color: transparent; }
}

.liblogs-landing {
    animation: liblogs-land 0.7s ease forwards;
    border-radius: 6px;
}

/* ── Responsive ── */
@media (max-width: 860px) {
    .liblogs-layout      { flex-direction: column; gap: 24px; }
    .liblogs-sidebar     { width: 100%; position: static; max-height: none; }
}