/* === Outliyr Sticky TOC === */

/* Desktop: Sticky sidebar TOC */
.outliyr-sticky-toc {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 16px 0;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    background: #fff;
    z-index: 1;
}

.outliyr-sticky-toc__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 12px;
    padding-left: 12px;
}

.outliyr-sticky-toc__list,
.outliyr-sticky-toc__sublist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.outliyr-sticky-toc__item a {
    display: block;
    padding: 6px 12px;
    color: #4b5563;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.outliyr-sticky-toc__item a:hover {
    color: #111827;
}

/* Active state: gold left border */
.outliyr-sticky-toc__item.active > a {
    border-left-color: #f2d046;
    color: #111827;
    font-weight: 600;
}

/* H3 indent */
.outliyr-sticky-toc__sublist {
    padding-left: 12px;
}

.outliyr-sticky-toc__item--h3 a {
    font-size: 12px;
    padding: 4px 12px;
}

/* Fixed mode: when sidebar container ends, TOC switches to fixed positioning */
.outliyr-sticky-toc--fixed {
    position: fixed !important;
    top: 80px;
}

/* Hide LuckyWP TOC on desktop */
@media (min-width: 1000px) {
    .lwptoc {
        display: none !important;
    }
}

/* Hide sticky TOC on mobile (mobile pill handles it) */
@media (max-width: 999px) {
    .outliyr-sticky-toc {
        display: none;
    }
}

/* Smooth scrollbar for long TOCs */
.outliyr-sticky-toc::-webkit-scrollbar {
    width: 4px;
}

.outliyr-sticky-toc::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .outliyr-sticky-toc__item a {
        transition: none;
    }
}

/* === Mobile: Floating pill + drawer === */

.outliyr-toc-pill {
    display: none; /* Hidden on desktop */
}

.outliyr-toc-drawer-overlay {
    display: none; /* Hidden by default; mobile media query enables */
}

.outliyr-toc-drawer {
    display: none; /* Hidden by default; mobile media query enables */
}

@media (max-width: 999px) {
    .outliyr-toc-pill {
        display: flex;
        align-items: center;
        gap: 5px;
        position: fixed;
        bottom: 24px;
        left: 12px;
        z-index: 100;
        background: #1f2937;
        color: #fff;
        border: none;
        border-radius: 4px;
        padding: 6px 10px;
        font-size: 11px;
        font-family: system-ui, -apple-system, sans-serif;
        cursor: pointer;
        box-shadow: 0 1px 4px rgba(0,0,0,0.15);
        max-width: 140px;
    }

    .outliyr-toc-pill__icon {
        line-height: 1;
        flex-shrink: 0;
        font-size: 12px;
    }

    .outliyr-toc-pill__label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
        opacity: 0.85;
    }

    /* Hide GeneratePress back-to-top — TOC replaces it */
    .generate-back-to-top {
        display: none !important;
    }

    .outliyr-toc-drawer-overlay {
        display: none; /* Shown via .open class */
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 101;
    }

    .outliyr-toc-drawer-overlay.open {
        display: block;
    }

    .outliyr-toc-drawer {
        display: block; /* Override base display:none */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-radius: 16px 16px 0 0;
        max-height: 60vh;
        overflow-y: auto;
        z-index: 102;
        padding: 20px 16px;
        transform: translateY(100%);
        transition: transform 0.25s ease-out;
    }

    .outliyr-toc-drawer.open {
        transform: translateY(0);
    }

    .outliyr-toc-drawer__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
    }

    .outliyr-toc-drawer__title {
        font-size: 14px;
        font-weight: 700;
        color: #111827;
        margin: 0;
    }

    .outliyr-toc-drawer__close {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #6b7280;
        cursor: pointer;
        padding: 4px;
        font-size: 18px;
        line-height: 1;
        border-radius: 4px;
    }

    .outliyr-toc-drawer__close:hover {
        color: #111827;
        background: #f3f4f6;
    }

    .outliyr-toc-drawer .outliyr-sticky-toc {
        display: block;
        position: static;
        max-height: none;
        overflow: visible;
        padding: 0;
    }

    .outliyr-toc-drawer .outliyr-sticky-toc__item a {
        max-width: none;
        padding: 10px 12px;
        font-size: 15px;
    }

    .outliyr-toc-drawer .outliyr-sticky-toc__item--h3 a {
        font-size: 14px;
        padding: 8px 12px;
    }

    @media (prefers-reduced-motion: reduce) {
        .outliyr-toc-drawer {
            transition: none;
        }
    }
}
