.mod-toc {
    /*
     * The module brings no box of its own: no background, no border, no
     * padding, no rounding, and text, links and font size are inherited.
     * Whatever the template puts around a module — a Cassiopeia card, a
     * YOOtheme panel — is what the reader sees, on a light and on a dark
     * design alike.
     *
     * These are the hooks the Custom CSS field is meant for. Setting
     * --toc-bg, --toc-border, --toc-text, --toc-link, --toc-font-size,
     * --toc-padding or --toc-radius there restyles this module instance
     * only; --toc-border takes a full border shorthand, for example
     * `--toc-border: 1px solid #dee2e6;`.
     */
    --toc-bg: transparent;
    --toc-border: 0;
    --toc-text: inherit;
    --toc-link: inherit;
    --toc-font-size: inherit;
    --toc-padding: 0;
    --toc-radius: 0;

    background: var(--toc-bg);
    border: var(--toc-border);
    border-radius: var(--toc-radius);
    color: var(--toc-text);
    font-size: var(--toc-font-size);
    padding: var(--toc-padding);
    box-sizing: border-box;

    /*
     * The module fills whatever the template position gives it and never
     * fixes its own width: placement and sizing belong to the position, not
     * to the module. `flex: 1 1 auto` and `min-width: 0` keep it sane when
     * the position is a flex or grid container (YOOtheme Pro panels, a
     * Cassiopeia card grid), where a block with an intrinsic width would
     * either overflow the track or refuse to shrink.
     */
    display: block;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

/*
 * The collapse toggle. The module title is Joomla's business — it is
 * rendered by the template chrome when Show Title is on and by nobody when
 * it is off — so the toggle carries only the marker and an accessible name
 * for screen readers.
 */
.mod-toc__toggle {
    cursor: pointer;
    list-style: none;
    display: block;
}

.mod-toc__toggle::-webkit-details-marker {
    display: none;
}

.mod-toc__toggle::before {
    content: '\25B8';
    display: inline-block;
    transition: transform 0.15s ease;
}

.mod-toc__details[open] > .mod-toc__toggle::before {
    transform: rotate(90deg);
}

.mod-toc__details > .mod-toc__nav {
    margin-top: 0.5em;
}

.mod-toc__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mod-toc__list {
    margin: 0;
    padding-left: 1.1em;
    list-style: none;
}

ol.mod-toc__list {
    list-style: decimal;
}

.mod-toc__item {
    margin: 0.25em 0;
}

.mod-toc__link {
    color: var(--toc-link);
    text-decoration: none;
}

.mod-toc__link:hover,
.mod-toc__link:focus {
    text-decoration: underline;
}
