.toc {
    background-color: #eeeeee;

    position: sticky;
    top: 50px;
    width: 22em;

    border: 1px solid var(--primary-color);
    border-top: 6px solid var(--primary-color);
    border-radius: 0 0 4px 4px;

    margin-right: 4em;
    padding: 0 15px;
    padding-bottom: -1em;
}

.toc-title {
    color: var(--primary-color);
    font-size: 1.4em;
    font-weight: bold;
    font-variant: small-caps;

    width: fit-content;
    border-bottom: 2px solid var(--secondary-color);

    margin-top: 1em;
    margin-bottom: 10px;
    padding-bottom: 5px;

    counter-reset: toc-sections;
}

.toc ul {
    list-style: none;

    max-height: 75vh;
    overflow-y: auto;

    padding-bottom: 0.2em;
    margin: 0;
    padding: 0.8em;
}

.toc ul ul {
    padding: 0.5em;
    padding-left: 1.5em;
}

.toc li, .toc summary {
    margin-bottom: 0.5em;
    margin-left: 0;
    counter-increment: toc-sections;
}

.toc li li, .toc details li {
    counter-increment: none;
}

.toc ul li::before, .toc summary::before {
    content: "Partie " counter(toc-sections, upper-roman) ".\A";
    color: var(--secondary-color);
    cursor: pointer;
    font-variant: small-caps;
    white-space: pre-line;
}

.toc li li::before, .toc details li::before {
    content: "";
}

.toc a:any-link {
    color: var(--text-color);
    font-weight: bold;
    text-decoration: none;
}

.toc summary a:any-link {
    color: var(--text-color);
    font-weight: bold;
    text-decoration: none;
    margin-left: 1em;
}

.toc a:hover {
    color: grey;
}

.toc a.section-link:hover {
    color:gray
}

.toc ul ul a:any-link, .toc details ul a:any-link {
    font-weight: normal;
    text-decoration: none;
}

.toc .section-link ul {
    padding: 0.5em;
}

.toc ul.section-link {
    padding-left: 1.5em;
}

.toc details, .toc summary {
    border: none;
    background-color: inherit;
}

/**** responsive ****/

@media screen and (max-width: 1500px) {
    .toc {
        margin: 10% auto;
        position: relative;
        width: 800px;
    }
}

@media screen and (max-width: 900px) {
    .toc {
        width: 90%;
    }
}
