:root {
    --frame-bg: black;
    --content-bg: url("tiles.png");
    --article-bg: white;
    --footer-fg: white;
    --footer-bg: teal;
    --menu-bg: black;
    --item-bg: black;
    --highlight: white;
    --link: blue;
    --link: rgb(238, 153, 0);
    --code: rgb(208, 208, 208);
    --code-link: rgb(0, 68, 221);
    --sep: black;
    --header-bg: black;
    --header-fg: white;
    --button-bg: rgb(238, 153, 0);
    --button-bg2: rgb(256, 181, 38);
    --button-fg: black;

    --article-width: 80ex;
    --button-size: 48px;
    --menu-width: 180pt;
}

@font-face {
    font-family: "Iosevka";
    src: url("iosevka-fixed-ss04-regular.ttf") format("truetype"),
        url("iosevka-fixed-ss04-regular.woff2") format("woff2");
    font-display: swap;
    font-weight: 400;
    font-stretch: normal;
    font-style: normal;
}

@font-face {
    font-family: "Roboto";
    src: url(Roboto-Regular.ttf);
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "Roboto";
    src: url(Roboto-Bold.ttf);
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: "Roboto";
    src: url(Roboto-Italic.ttf);
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: "Roboto";
    src: url(Roboto-BoldItalic.ttf);
    font-weight: bold;
    font-style: italic;
}

#opn, #cls {
    display: none;
}

div.menu input {
    display: none;
}

html, body {
    width: 100%;
    background: var(--frame-bg);
    font-family: "Roboto", sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
}

header {
    box-sizing: border-box;
    height: var(--button-size);
    background: var(--header-bg);
    color: var(--header-fg);
    margin: 0 auto 0 calc(var(--menu-width) + 4pt);
    text-align: right;
    width: calc(100% - calc(var(--menu-width) + 4pt));
}

header h1 {
    margin: 0;
}

code, tt, pre {
    font-family: Iosevka, monospace;
}

main:before {
    content: "";
    display: box;
    width: 100%;
    height: 100%;
    position: absolute;
    background-attachment: fixed;
    background-image:
        linear-gradient(45deg, var(--footer-bg), lightgray),
        var(--content-bg),
        linear-gradient(0, var(--footer-bg), darkgray);
    background-blend-mode: overlay, normal;
    z-index: -1;
}

main {
    box-sizing: content-box;
    margin: 0 0 0 calc(var(--menu-width) + 4pt);
    position: relative;
    width: calc(100% - calc(var(--menu-width) + 4pt));
    z-index: 1;
}

article {
    box-sizing: border-box;
    background: var(--article-bg);
    width: calc(var(--article-width) + 2em);
    padding: 1em;
    border: solid var(--sep);
    border-width: 0 4pt 0 0;
    hyphens: auto;
    line-height: 1.3;
}

hr {
    display: none;
}

code {
    display: inline-block;
    background: var(--code);
    font-size: 0.9em;
}

pre {
    display: block;
    max-width: 100%;
    overflow-y: auto;
}

a {
    color: var(--link);
}

a code {
    color: var(--code-link);
}

footer {
    background: var(--footer-bg);
    color: var(--footer-fg);
    border: solid var(--sep);
    border-width: 2pt 0 0 0;
    margin: 0 0 0 calc(var(--menu-width) + 4pt);
    padding: 4pt;
    flex-grow: 1;
}

article h1 {
    font-size: 180%;
    text-align: center;
}

nav {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    width: var(--menu-width);
    vertical-align: top;
    background: var(--menu-bg);
    z-index: 2000;
    margin: 0;
    padding: 0 0 0 0;
    scrollbar-width: thin;
    border: solid var(--sep);
    border-width: 0 4pt 0 0;
}

nav::before {
    display: block;
    content: linear-gradient(0.75turn, var(--header-bg), var(--menu-bg));
    width: 100%;
    height: calc(var(--button-size) - 2pt);
    background: var(--sep);
    border: solid var(--sep);
    border-width: 0 0 2pt 0;
}

nav::-webkit-scrollbar {
    width: 0;
}

nav dt {
    background: var(--highlight);
    text-transform: uppercase;
    font-size: 16pt;
    font-weight: bold;
    text-align: center;
    border: solid var(--sep);
    border-width: 2pt 0;
}

nav dd {
    margin-left: 0;
}

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

nav li {
    color: white;
    border: solid var(--sep);
    border-width: 0;
    padding: 0;
    margin: 0;
}

nav li:hover {
    color: white;
    text-shadow: 0 0 2px var(--highlight), 0 0 4px var(--highlight);
}

nav li a {
    display: inline-block;
    box-sizing: border-box;
    text-decoration: none;
    width: 100%;
    height: 100%;
    padding: 4pt 2pt;
    color: var(--navlink);
}

@media screen and (orientation: portrait) and (max-width: 730px) {
    div.menu input {
        opacity: 0;
        display: block;
        position: fixed;
        z-index: 2001;
        top: 0;
        padding: 0;
        margin: 0;
        width: var(--button-size);
        height: var(--button-size);
    }
    div.menu input:hover {
        cursor: pointer;
    }

    input#_o {
        left: 0;
    }

    input#_c {
        z-index: 2003;
        left: calc(var(--menu-width) - var(--button-size));
    }

    #opn, #cls {
        display: block;
        position: fixed;
        top: 0;
        text-decoration: none;
        text-align: center;
        width: calc(var(--button-size) - 2pt);
        height: calc(var(--button-size) - 2pt);
        background: linear-gradient(var(--button-bg), var(--button-bg2));
        color: var(--button-fg);
        border: solid var(--sep);
        font-weight: bold;
        font-size: calc(var(--button-size) * 0.8);
        z-index: 2000;
    }

    #opn {
        left: 0;
        border-width: 0 2pt 2pt 0;
    }

    #cls {
        left: calc(var(--menu-width) - var(--button-size));
        border-width: 0 2pt 2pt 2pt;
    }

    #opn::before {
        content: ">";
    }

    #cls::before {
        content: "<";
    }

    #_o:checked ~ nav {
        transform: unset;
    }
    
    main, header, footer {
        margin: 0;
        box-sizing: border-box;
        width: 100%;
    }

    article {
        font-size: 4.1vw;
        width: 100%;
        border: 0;
    }

    nav {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
}

