html {
/* These background attributes will change depending on the page */
    /* background-image: url("../600pixel_square.png"); */
    /* To stretch an image to always fit. 
     Remove to make the background image repeat. */
    --bg-color: #491d25;
    --ui-prime-color: #ffffff;
    --hilite-color: #000000;
    --link-color: #ffffff;
    --deemphasize-color: #aaaaaa;
    --bg-gradient: conic-gradient(from 304deg at 12% -10% in hsl shorter hue, rgb(48, 21, 27) 50%, #491d25ff 55%, #230b0dff 73%);

    font-family: "Briel Nib Bold", Courier, monospace;
    font-size: x-large;

    --comic-page-width: 800px;
    /* height: 100%; */
    /* width: 100vw; */
}

body {
    margin: 0;

    background-color: var(--bg-color); 
    background-image: var(--bg-gradient);
    background-size: cover; 

    /* background-repeat: no-repeat; */
    /* background-attachment: fixed; */

    display: flex;
    justify-content: space-between;
    /* --shrink-factor: 0.95; */

    /* height: 100%; */
    width: 100%;
}

/* These don't affect image sizes, 
    but they do affect the text section sizes*/
@media screen and (min-width: 1921px) {
    html {
        --comic-page-width: 1400px;
        font-size: calc(0.025 * var(--comic-page-width));
    }

}

@media screen and (min-width: 3001px) {
    /* html {
        font-size: calc(xx-large) * 2;
    } */

    html {
        --comic-page-width: 2100px;
    }
}

body, 
footer {
    /* Can change color depending on page */
    color: var(--ui-prime-color);
    text-align: center;
}

footer {
    font-size: smaller;
    font-family: "Briel Fixed Width", Courier, monospace;
}

/* Selects the big navigation buttons to the side of the page */
body > a.nav-button, 
body > div.separator {
    width: max(0px, 0.25 * (100vw - var(--comic-page-width)));
    max-height: 100%;
}

@media screen and (max-width: 800px) {
    /* body {
        --shrink-factor: 1;
    } */

    body > a.nav-button {
        display: none;
    }
}

@media screen and (max-width: 600px) {
    html {
        font-size: large;
    }
}

@media screen and (max-width: 400px) {
    html {
        font-size: medium;
    }
}

main {
    text-align: center;
    max-width: var(--comic-page-width);
}

h1 {
    font-family: "Briel Nib", Courier, monospace;
    margin: calc(clamp(0.3em, 0.2*(100vw - var(--comic-page-width)), 1.1em)) 0.2em 0.2em;
    text-align: left;
    font-size: 0.7em;
    /* color: var(--deemphasize-color); */
    /* font-display: initial; */
}

h1 a {
    color: var(--ui-prime-color);
}

h1 a:visited {
    /* color: var(--ui-prime-color); */
}

h2 {
    /* margin-top: 0.5em; */
    margin-top: 0;
    margin-bottom: 0;
    font-weight: inherit;
    /* font-family: "Briel Fixed Width Bold"; */
}

#tag_section, 
#tag-cw-section {
    border-image-slice: 350 550 480 550;
    border-image-width: 1em 2.2em 2em;
    border-image-outset: 1.2em 2.2vw 1.8em;
    margin-top: 1.2em;
    margin-bottom: 2.3em;
    /* max-width: var(--comic-page-width); */
}

#cw_section {
    border-image-slice: 450 550 750 500;
    border-image-width: 1.8em 2em 2.8em 1.8em;
    border-image-outset: 2.2em calc(1em - 0.5vw) 2.6em calc(0.8em - 0.5vw);
    margin: 2.2em calc(0.9em - 1vw) 3em; 
    padding-left: 1.5em;
    padding-right: 1.5em;
    /* max-width: calc(var(--comic-page-width) - 2 * 1.5em - 2 * (0.9em - 1vw)); */
}

#note-section {
    border-image-slice: 450 550 750 500;
    border-image-width: 1.8em 2em 2em 1.8em;
    border-image-outset: 2em 1.2vw 2em 0.8vw;
    margin: 1.2em 0 3em; 
    padding-left: 1.5em;
    padding-right: 1.5em;
    /* max-width: calc(var(--comic-page-width) - 2 * 1.5em); */
}

#note-section p {
    font-family: "Briel Fixed Width", Courier, monospace;
    font-size: 90%;
}

#tag-cw-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 1.5em;
}

#tag-div, 
#cw-div {
    flex: 6;
}

#tag-cw-section svg.separator {
    flex: 1;
    min-height: 2.8em;
    max-height: max(2.8em, calc(10.2em - 24vw));
    height: 100%;
    
}

#desc-section {
    border-image-slice: 650 1100 700 1200;
    --desc-side-padding: calc(2.5em + 1.5vw);
    padding-left: var(--desc-side-padding);
    padding-right: var(--desc-side-padding);
}

#note-section + #desc-section {
    border-image-width: 2.5em 4em 4.8em;
    border-image-outset: 2em calc(1.2em - 1vw) 4.7em calc(1.4em - 1vw);
    --desc-side-padding: calc(2em + 1.5vw);
    margin: 2.5em 1.5em 3.5em;
    /* max-width: calc(var(--comic-page-width) - 2 * 1.5em - 2 * var(--desc-side-padding)); */
}

#tag-cw-section + #desc-section {
    border-image-width: 2em 4em 4em;
    border-image-outset: 2em calc(0.5em + 2vw) 4em;
    margin: 2.5em 1.2em 3.5em;
    /* max-width: calc(var(--comic-page-width) - 2 * 1.2em - 2 * var(--desc-side-padding)); */
}

/* selects paragraph elements directly preceded by header 2 elements */
h2 + p {
    margin-top: 0;
    margin-bottom: 0;
}

h2 + p.text-desc {
    font-family: "Courier New", Courier, monospace;
    font-size: smaller;
}

nav {
    /* Make font size of text in the nav pane (previous, next, etc.) 4 
    points bigger than the inherited size */
    font-size: larger;
}

a:link {
    color: var(--link-color);
    padding: 0.1em;
    border-radius: 0.1em;
}

a:visited {
    color: var(--deemphasize-color)
}

a:hover {
    color: var(--link-color);
    background: var(--hilite-color);
}

a.text-desc-heading {
    /* Keeps # links from looking like links */
    color: inherit;
    text-decoration: inherit;
    /* background: inherit; */
}

svg.ui {
    fill: var(--ui-prime-color);
}

a:link svg.ui {
    fill: var(--link-color);
}

a:visited svg.ui {
    fill: var(--deemphasize-color);
}

a:hover svg.ui {
    fill: var(--ui-prime-color);
}

.page-display {
    --frame-top-width: 1.8em;
    --frame-side-width: 1.3em;
    --frame-bottom-width: 1.2em;
}

.page-display img.comic-page {
    max-width: 100%;
    margin-bottom: var(--frame-bottom-width);
    /* margin-top: calc(clamp(0px, 0.5*(100vw - var(--comic-page-width)), 2em)); */
    margin-top: 0.4em;
    border-image-slice: 330 210 270 250;
    border-image-width: var(--frame-top-width) var(--frame-side-width) var(--frame-bottom-width);
    border-image-outset: var(--frame-top-width) var(--frame-side-width) var(--frame-bottom-width);
}

.page-display img.fit-page {
    margin-top: 0;
    max-width: 100%;
    max-height: 100vh;
}
