.toc {
    position: sticky;
    top: 56px;
    padding: 16px;
    border: 1px solid var(--brand-primary);
    border-radius: 16px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-bottom: 60px;
}

.toc ul {
    margin-top: 16px;
    padding-left: 0;
    list-style: none;
}

.toc ul li {
    margin-bottom: 12px;
}

.toc ul li.active {
    font-weight: bold;
}

.toc ul li ul {
    margin-top: 0;
    margin-left: 16px;
}

.toc ul li ul li:before {
    content: "- ";
}

.toc {
    top: 90px;
    max-height: calc(100vh - 200px);
}

.toc-wrapper {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 99999;
    padding: 0;
    background-color: rgba(0,0,0, 0.4);
    height: 100%;
}
.toc-wrapper .toc {
    position: absolute;
    bottom: 0;
    top: unset;
    width: 100%;
    background-color: white;
    max-height: calc(100dvh - 300px);
    border-radius: 0;
    box-shadow: 1px 1px 15px rgba(0,0,0,.4);
}
.comment-wrapper, .most-recent-wrapper {
    margin-top: 32px;
}
.open-toc {
    display: flex;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--brand-primary);
    z-index: 999;
}
.open-toc img {
    max-width: 16px;
}

.the-post-content {
    padding-top: 30px;
}

.the-post-author-info {
    padding-bottom: 5px;
}

.the-post-author-info:last-of-type {
    padding-bottom: 0;
}

@media(min-width: 768px) {
    .open-toc {
        display: none;
    }
   .the-post-approved-info  {
    padding-top: 5px;
   }
}

/* Desktop Table of contents — slide-in-from-left drawer */
.toc-desktop-trigger,
.toc-desktop-overlay {
    display: none;
}

@media (min-width: 768px) {
    .toc-desktop-trigger {
        display: none;
        align-items: center;
        gap: 8px;
        position: absolute;
        left: 10px;
        top: 115px;
        z-index: 1000;
        padding: 10px 16px;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        background-color: var(--white);
        color: var(--full-black);
        font-weight: bold;
        cursor: pointer;
        box-shadow: 1px 1px 15px rgba(0, 0, 0, .15);
    }

    .toc-desktop-trigger.is-ready {
        display: flex;
    }

    /* pinned once the page scrolls down to it (toggled in single-post.js) */
    .toc-desktop-trigger.is-fixed {
        position: fixed;
        top: 65px;
    }

    .toc-desktop-trigger img {
        max-width: 16px;
        filter: brightness(0);
    }

    .toc-desktop-overlay {
        /* stays display:none until single-post.js marks it ready — see .is-ready below */
        position: fixed;
        inset: 0;
        z-index: 100000;
        background-color: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
    }

    /* Rendered — and transition-enabled — only after the drawer has been wired up,
       so it can never paint, animate or take up layout while the page is loading. */
    .toc-desktop-overlay.is-ready {
        display: block;
        transition: opacity .3s ease, visibility .3s ease;
    }

    .toc-desktop-panel {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 30%;
        max-width: 420px;
        min-width: 280px;
        padding: 24px;
        box-sizing: border-box;
        background-color: var(--white);
        box-shadow: 1px 0 15px rgba(0, 0, 0, .4);
        overflow-y: auto;
        transform: translateX(-100%);
    }

    .toc-desktop-overlay.is-ready .toc-desktop-panel {
        transition: transform .3s ease;
    }

    .toc-desktop-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .toc-desktop-overlay.open .toc-desktop-panel {
        transform: translateX(0);
    }

    .toc-desktop-panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .toc-desktop-close {
        padding: 0;
        border: none;
        background: none;
        font-size: 28px;
        line-height: 1;
        color: inherit;
        cursor: pointer;
    }

    .toc-desktop-panel ul {
        margin-top: 16px;
        padding-left: 0;
        list-style: none;
    }

    .toc-desktop-panel ul li {
        margin-bottom: 12px;
    }

    .toc-desktop-panel ul li ul {
        margin-top: 0;
        margin-left: 16px;
    }

    .toc-desktop-panel ul li ul li:before {
        content: "- ";
    }
}

@media(max-width: 991px) {
    .toc-desktop-trigger {
        position: fixed;
        top: 75px;
    }
    .toc-desktop-trigger.is-fixed {
        top: 75px;
    }
}

/* On narrower desktops the horizontal pill overlaps the article — show only the
   icon and slide the label in from the left on hover (overlapping the content). */
@media (min-width: 768px) and (max-width: 1520px) {
    .toc-desktop-trigger {
        gap: 0;
        overflow: hidden;
    }

    .toc-desktop-trigger-label {
        max-width: 0;
        margin-left: 0;
        opacity: 0;
        white-space: nowrap;
        transform: translateX(-8px);
        transition: max-width .3s ease, margin-left .3s ease, opacity .3s ease, transform .3s ease;
    }

    .toc-desktop-trigger:hover .toc-desktop-trigger-label,
    .toc-desktop-trigger:focus-visible .toc-desktop-trigger-label {
        max-width: 220px;
        margin-left: 8px;
        opacity: 1;
        transform: translateX(0);
    }
}
