/* Loaded last: these rules override the component stylesheets. */

/* No room for the TOC beside the text: show it inline above the content. */
@media (max-width: 1200px) {
    :root {
        /* center text column + sidenote margin */
        --content-left: max(8%, calc(50vw - 425px));
    }

    #TOC {
        position: static;
        width: 100%;
        max-width: var(--content-width);
        margin: 1rem 0;
        padding: 0.3rem 0;
    }
}

/* No room for the sidenote margin: notes are toggled inline. */
@media (max-width: 1000px) {
    :root {
        /* center the text column */
        --content-left: max(8%, calc(50vw - 300px));
    }

    body {
        padding-right: var(--content-left);
    }

    label.margin-toggle {
        cursor: pointer;
    }

    label.margin-toggle:not(.sidenote-number) {
        display: inline;
    }

    .sidenote,
    .marginnote {
        display: none;
    }

    .margin-toggle:checked+.sidenote,
    .margin-toggle:checked+.marginnote {
        display: block;
        float: left;
        left: 1rem;
        clear: both;
        width: 95%;
        margin: 1rem 2.5%;
        position: relative;
        max-width: none;
    }

    figure:has(img.wide) {
        width: auto;
    }

    /* the year labels of the blog listing move from the margin into the column */
    .blogsection-year {
        margin-left: 0;
    }
}

@media (max-width: 760px) {
    .navbar {
        position: absolute;
        left: var(--content-left);
        right: var(--content-left);
        width: auto;
    }

    .navbar .right {
        float: left;
    }

    .navbar a {
        padding: 15px 9px;
        font-size: 18px;
    }
}

/* the navbar wraps onto a second line */
@media (max-width: 340px) {
    article {
        padding-top: 11rem;
    }
}
