body
{
    font-family: system, -apple-system, "BlinkMacSystemFont",
        ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI",
        "Helvetica Neue", "Lucida Grande", "Ubuntu", "arial", sans-serif;

    margin: 0.2em;

    --focus: #3056d5;

    --pf-input-height: 3.13em;
    --pf-border: lightgray;
    --pf-border-focus: var(--focus);
    --pf-font: system, -apple-system, "BlinkMacSystemFont",
        ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI",
        "Helvetica Neue", "Lucida Grande", "Ubuntu", "arial", sans-serif;
    --pf-image-width: 64px;
    --pf-image-height: 64px;
}

/* Temporary fix for https://github.com/Pagefind/pagefind/issues/1099 */
pagefind-modal-trigger span.pf-trigger-shortcut
{
    display: none !important;
}

/* PageFind trigger font size can't be modified through CSS variable */
pagefind-modal-trigger span.pf-trigger-text
{
    font-size: 1.1em !important;
}

pagefind-results ul.pf-results li.pf-result div.pf-result-card
{
    align-items: center !important;
}

a
{
    color: black;
}

a:hover
{
    text-decoration: none;
}

li a
{
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6, h7, h8, h9
{
    font-weight: normal;
}

h1
{
    font-size: 1.3em;
    margin: 0.4em 0;
}

h2
{
    font-size: 1.1em;
}

footer
{
    padding-top: 1em;
}

footer p
{
    text-align: center;
    font-size: 0.7em;
    margin: 0;
    padding-bottom: 0.5em;
}

#back
{
    font-size: 2.5em;
    text-decoration: none;
}

#opc-count
{
    font-weight: bold;
}

nav ul
{
    list-style-type: none;
    margin: 0;
    padding: 0;
}

nav ul li a
{
    display: block;
    border: solid;
    padding: 0.7em;
    border-color: lightgray;
    border-width: 1px;
    border-radius: 0.4em;
    transition: 0.30s ease-in-out;
}

nav ul li a:hover
{
    text-decoration: none;
    border-color: var(--focus);
    transition: 0.20s ease-in-out;
}

/* Main menu changes background instead of border */
#menu ul li a:hover
{
    color: white;
    border-color: lightgray;
    background-color: var(--focus);
    transition: 0.20s ease-in-out;
}

#menu ul,
#opc-transpose
{
    display: flex;
    flex-wrap: wrap;
    gap: 0.2em 0.4em;
}

#menu ul li:first-child
{
    font-size: 2.4em;
}

#menu ul li:first-child a
{
    padding: 0;
    border: none;
    background-color: white;
}

#menu ul li:last-child
{
    margin-left: auto;
}

#opc-menu
{
    margin-bottom: 0.6em;
}

#opc-menu ul:first-child
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 0.4em;
    margin-bottom: 0.4em;
}

#opc-menu ul li
{
    font-size: 0.9em;
}

#opc-menu ul li a
{
    padding: 0.8em;
}

#opc-transpose
{
    align-items: center;
}

#opc-transpose li span
{
    display: block;
}

#opc-transpose li span
{
    padding: 0 0.2em;
}

#transpose-level
{
    width: 1em;
    text-align: center;
}

#opc-index header
{
    display: flex;
    margin: 1.5em 0 0.6em 0.8em;
}

#opc-index ul
{
    display: grid;
    grid-gap: 0.4em;
}

#opc-index ul li
{
    font-size: 0.9em;
    margin: 0;
}

#opc-index ul li a
{
    display: flex;
}

#opc-index ul li a img
{
    height: 40px;
    margin-right: 0.8em;
    box-shadow: 0 0 0.1em 0 grey;
}

#opc-index ul li a span
{
    margin: auto 0;
}

#opc-index header img
{
    width: 100px;
    margin-right: 0.8em;
    box-shadow: 0 0 0.2em 0 grey;
}

#opc-index header div
{
    align-self: flex-end;
}

#opc-index header h2
{
    margin: 0;
}

#opc-index header h3
{
    font-size: 0.9em;
    margin: 0.3em 0 0 0;
}

#opc-header
{
    display: flex;
    gap: 0.8em;
    margin: 0.4em 0 0.6em 0;
}

#opc-header img
{
    height: 10em;
    width: auto;
    box-shadow: 0 0 0.4em -0.05em grey;
}

#opc-header > div
{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#opc-header h1
{
    margin: 0;
}

#opc-header h1 span
{
    display: none;
}

#opc-header h2
{
    margin: 0.1em 0 0 0;
}

#opc-header dl
{
    margin: 0;
}

#opc-header dd
{
    font-size: 0.6em;
    margin: 0.2em 0 0 0;
}

#opc-header dt
{
    font-size: 1em;
}

#content
{
    margin: 0 auto;
    padding: 5vw;
    box-shadow: 0 0 0.15em 0.05em gray;

    --opc-font-ratio: 0.165vw;

    --opc-base-font: calc(
        var(--opc-font-ratio) * var(--opc-page-ratio) / var(--opc-ratio));

    /* Default values overwritten by the one-pager */
    --opc-font-size: 20;
    --opc-title-size: 25;
    --opc-title-margin-bottom: 0;
    --opc-ratio: 1;
}

#content.portrait
{
    --opc-page-ratio: 1;
}

#content.landscape
{
    /* US letter (8.5" x 11") minus 0.5" margin on all sides */
    --opc-page-ratio: 0.75;
}

@font-face
{
    font-family: 'Liberation Mono';
    src:
        local('Liberation Mono'),
        url('fonts/LiberationMono-Regular.woff');
}

#content p
{
    font-size: calc(var(--opc-base-font) * var(--opc-font-size));
    font-family: 'Liberation Mono', monospace;
    white-space: pre;
    padding: 0;
    margin: 0;
}

#content p.title
{
    font-size: calc(var(--opc-base-font) * var(--opc-title-size));
    margin-bottom: calc(1in * var(--opc-title-margin-bottom));
    text-align: center;
}

#content span.m1,
#content span.m1h,
#content span.m2,
#content span.m2h,
#content span.mq
{
    text-decoration-line: underline;
}

#content span.m1h
{
    text-decoration-thickness: 0.12em;
}

#content span.m2
{
    text-decoration-style: dotted;
}

#content span.m2h
{
    text-decoration-style: dotted;
    text-decoration-thickness: 0.12em;
}

#content span.mq
{
    text-decoration-style: double;
}

@media screen and (width >= 1080px)
{
    body
    {
        margin-top: 0.6em;

        --pf-input-height: 3.85em;
    }

    /* Restore shortcut */
    pagefind-modal-trigger span.pf-trigger-shortcut
    {
        display: inline-flex !important;
    }

    /* PageFind trigger font size can't be modified through CSS variable */
    pagefind-modal-trigger span.pf-trigger-text
    {
        font-size: 1.3em !important;
    }

    header,
    nav,
    main,
    footer
    {
        max-width: 1060px;
        margin-left: auto;
        margin-right: auto;
    }

    h1
    {
        font-size: 2em;
    }

    h2
    {
        font-size: 1.3em;
    }

    footer p
    {
        font-size: 0.9em;
    }

    nav ul li a
    {
        border-width: 0.05em;
    }

    #menu ul,
    #opc-transpose
    {
        gap: 0.3em 0.6em;
    }

    #menu ul li
    {
        font-size: 1.25em;
    }

    #menu ul li:first-child
    {
        font-size: 3em;
    }

    #opc-index ul
    {
        grid-template-columns: 1fr 1fr;
        grid-gap: 0.6em;
    }

    #opc-index ul li
    {
        font-size: 1em;
    }

    #opc-index header h3
    {
        font-size: 1em;
        margin-top: 0.5em;
    }

    #opc-menu
    {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0.8em;
    }

    #opc-menu ul:first-child
    {
        display: flex;
        gap: 0.6em;
        margin-bottom: 0;
    }

    #opc-menu ul li
    {
        font-size: 1em;
    }

    #opc-menu ul li a
    {
        padding: 1em;
    }

    #opc-header
    {
        gap: 1em;
        margin: 0.6em 0 0.8em 0;
    }

    #opc-header img
    {
        height: 250px;
    }

    #opc-header h2
    {
        font-size: 1.5em;
        margin-top: 0.2em;
    }

    #opc-header dd
    {
        font-size: 0.9em;
        margin-top: 0.6em;
    }

    #opc-header dt
    {
        font-size: 1.4em;
    }

    #content
    {
        padding: 50px;

        --opc-font-ratio: 0.0845em;
    }

    #content.portrait
    {
        width: 720px;
    }

    #content.landscape
    {
        width: 960px;

        /* No need to reduce the font size since the width is proportionally
           bigger than in portrait mode */
        --opc-page-ratio: 1;
    }
}

@media (prefers-color-scheme: dark)
{
    body
    {
        background-color: var(--dark-mode-background);

        --dark-mode-background: #212426;
        --dark-mode-text: #e5e3e1;
        --dark-mode-border: #343a40;
        --dark-mode-border-focus: #94c6ff;

        /* Pagefind darkmode style, see:
           https://pagefind.app/docs/css-variables/#dark-mode
        */
        --pf-text: #e5e5e5;
        --pf-text-secondary: #a0a0a0;
        --pf-text-muted: var(--dark-mode-text);
        --pf-background: var(--dark-mode-background);
        --pf-border: var(--dark-mode-border);
        --pf-border-focus: var(--dark-mode-border-focus);
        --pf-skeleton: #2a2a2a;
        --pf-skeleton-shine: #333;
        --pf-hover: #353535;
        --pf-mark: #e5e5e5;
        --pf-scroll-shadow: rgba(255, 255, 255, 0.1);
        --pf-outline-focus: #58a6ff;

        --pf-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
        --pf-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
        --pf-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);

        --pf-error-bg: #2a1a1a;
        --pf-error-border: #5c2828;
        --pf-error-text: #f87171;
        --pf-error-text-secondary: #ef4444;
    }

    body, p, a
    {
        color: var(--dark-mode-text);
    }

    #menu ul li a,
    nav ul li a
    {
        border-color: var(--dark-mode-border);
        background-color: var(--dark-mode-background);
        transition: 0.30s ease-in-out;
    }

    #menu ul li a:hover,
    nav ul li a:hover
    {
        background-color: #212529;
        border-color: var(--dark-mode-border-focus);
        transition: 0.20s ease-in-out;
    }

    /* Don't change background for the logo */
    #menu ul li:first-child a
    {
        background-color: var(--dark-mode-background);
    }
}

@media print
{
    body
    {
        padding: 0;
        margin: 0;
    }

    header,
    footer,
    #opc-header,
    #opc-menu,
    #opc-transpose
    {
        display: none;
    }

    #content
    {
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    #content p
    {
        font-size: calc(1pt * var(--opc-font-size));
    }

    #content p.title
    {
        font-size: calc(1pt * var(--opc-title-size));
    }
}
