#toc {
    padding: 0 20px;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50px;
    background-color: var(--color-bg);
    box-shadow: 0 1px 2px 2px rgba(150, 150, 150, 0.05);
    z-index: 2;
    transform: translateY(0);
    transition: transform 0.7s ease-out, opacity 0.5s ease-out, visibility 0s 0.7s;

}

#toc--content {
    opacity: 1;
    visibility: visible;
    transition: max-height 0.8s ease, opacity 0.6s ease-in-out, padding 0.6s ease-in-out, margin 0.6s ease-in-out;
    max-height: 20vh;
    word-break: break-word;
    overflow-x: auto;
    width: 100vw;
    display: flex;
    justify-content: flex-start;
    scrollbar-width: none; /* Firefox */
    margin-bottom: 3px;
    padding: 0.5rem 1rem;
    color: #0f0f0f;
}
#toc--content::-webkit-scrollbar {
    display: none; /* Chromium, Safari */
}
#toc.toc--hidden {
    transform: translateY(-110%);
}

#toc--content > ul {
    list-style-type: none;
    padding: 0;
    display: flex;
    justify-content: flex-start;
    margin: 0;
    gap: 1.5rem;
    align-items: center;
}
#toc--content > ul > li {
    display: inline;
    white-space: nowrap;
}
#toc--content > ul > li > a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.25rem 0;
    transition: color 0.3s ease;
    border-bottom: none;
    white-space: nowrap;
    text-transform: Capitalize;
}

#toc--content > ul > li > a.current,
#toc--content > ul > li > a:hover {
    color: var(--color-accent-hover);
}
@media screen and (max-width: 900px) {
    #toc {
        display: none;
    }
}
@media screen and (min-width: 900px) {
    #toc--button {
        display: none;
    }
}

@media screen and (max-width: 900px) {
    .sticky {
        position: initial;
        top: auto;
    }
    #toc.toc--hidden {
        transform: translate(100%, 0);
    }
    #toc {
        border: var(--color-border) 1px solid;
        padding: 1vh 1vw;
        z-index: 50;
        position: fixed;
        top: 20vh;
        right: 0;
        background-color: var(--color-bg);
        display: block;
        opacity: 0.9;
        overflow: scroll;
        max-height: 70vh;
        width: 40% !important;
        transform: translate(100%, 0);
        transition: translate 0s;
    }
    #toc.open {
        display: block;
        transform: translate(0, 0) !important;
    }
    #toc h1 {
        font-size: 1.2em;
        margin: 1vh 0;
    }
    #toc--content {
        word-break: break-word;
        max-height: 50vh;
        width: auto;
        overflow-x: clip;
    }
    #toc--content > ul {
        display: block;
        margin: 0;
        gap: 1.5rem;
        list-style-type: square;
        list-style-position: inside;

    }
    #toc--content > ul > li {
        display: list-item;
        white-space: collapse;
        
    }
    #toc--content > ul > li > a {
        white-space: wrap;
        font-size: 0.9rem;
    }
    #toc--button {
        opacity: 0.9;
        display: block;
        position: fixed;
        top: 20vh;
        right: 0;
        z-index: 1000;
        width: 40px;
        height: 80px;
        background-color: var(--color-bg);
        padding: 10px 7px;
        border: var(--color-border) 1px;
        border-top-style: solid;
        border-left-style: solid;
        border-bottom-style: solid;
    }
    #toc--button:hover {
        cursor: pointer;
    }
    #toc--button>h1 {
        text-orientation: sideways;
        writing-mode: vertical-lr;
        color: #333;
    }
    #toc--button>svg.flipped {
        display: inline-block;
        -moz-transform: scale(-1, 1);
        -webkit-transform: scale(-1, 1);
        -o-transform: scale(-1, 1);
        -ms-transform: scale(-1, 1);
        transform: scale(-1, 1);
    }
    #toc--button>svg {
        width: 100%;
        height: 100%;
        opacity: 0.9;
    }
    #toc--button.open {
        right: 40%;
    }
    #toc--wrapper {
        display: none;
    }
    #toc--content {
        font-size: 0.9rem;
    }
}
