/* ---------- page background ---------- */

html {
    margin: 0;
    min-height: 100%;
    background-image: url('images/hero.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #984416;
}

body {
    color: black;
    font-family: 'Courier New', monospace;
    max-width: 800px;
    margin: 50px auto;
    padding: 0 20px;
    min-height: 100vh;
    box-sizing: border-box;
}


/*
   Permanent painting layer.

   This sits behind the homepage and all painted pages
   and always fills the entire browser viewport.
*/
body.home::before,
body.painted::before {
    content: "";
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;

    background-image: url('images/hero.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #984416;

    z-index: -1;
    pointer-events: none;
}


/* ---------- homepage ---------- */

body.home {
    margin: 0;
    padding: 0;
    max-width: none;

    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;

    background: transparent;

    position: relative;
    isolation: isolate;

    overflow-x: hidden;
}


/* ---------- painted inner pages ---------- */

body.painted {
    margin: 0;
    padding: 60px 24px;

    max-width: none;
    width: 100%;

    min-height: 100vh;
    min-height: 100dvh;

    background: transparent;

    display: flex;
    justify-content: center;

    box-sizing: border-box;

    position: relative;
    isolation: isolate;
}


/* ---------- cards ---------- */

.card {
    background: rgba(20, 23, 27, 0.88);
    border: 1px solid rgba(201, 162, 75, 0.35);

    max-width: 640px;
    width: 100%;

    padding: 40px 44px;

    box-sizing: border-box;

    color: #e8e5da;

    height: fit-content;

    font-family: 'Courier New', monospace;
}

.card.card-wide {
    max-width: 760px;
}

.card h2 {
    color: #f2f0e8;
    margin: 24px 0 20px;
}

.card p {
    font-size: 16px;
    line-height: 1.7;
    color: #cfcabb;
}

.card a {
    color: #c9a24b;
}

.card a:visited {
    color: #c9a24b;
}

.card a:hover {
    color: #e2bb63;
    background: none;
}

.card pre {
    color: #7d7a6d;
    margin: 20px 0 4px;
}

.card .home-link {
    color: #c9a24b;
    text-decoration: none;
    font-size: 14px;
}

.card .post-date {
    font-size: 13px;
    color: #7d7a6d;
    margin-left: 8px;
}


/* ---------- homepage hero ---------- */

.hero {
    position: relative;

    width: 100%;

    height: 100vh;
    height: 100dvh;

    overflow: hidden;
}

.hero img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

.hero nav {
    position: absolute;

    top: 24px;
    right: 28px;

    display: flex;

    gap: 22px;
}

.hero nav a {
    font-family: 'Courier New', Courier, monospace;

    font-size: 14px;

    color: #f2f0e8;

    text-decoration: none;

    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.hero nav a:hover {
    text-decoration: underline;
    background: none;
    color: #c9a24b;
}

.hero .name {
    position: absolute;

    top: 24px;
    left: 28px;

    font-family: 'Courier New', Courier, monospace;

    font-size: 13px;

    color: #f2f0e8;

    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}


/* ---------- about ---------- */

.about-photo {
    float: left;

    width: 200px;

    margin: 0 20px 10px 0;

    border: 1px solid #444;
}


/* ---------- misc/blog images ---------- */

.blog-photo {
    width: 100%;
    height: auto;

    margin-bottom: 20px;

    display: block;
}


/* ---------- general ---------- */

p {
    font-size: 18px;
}

.home-link {
    display: inline-block;
    margin-bottom: 20px;
}

.top-links {
    display: flex;
    gap: 30px;
    margin-top: 10px;
}

a {
    color: #0000ee;
}

a:visited {
    color: #0000ee;
}

a:hover {
    background-color: #0000ee;
    color: white !important;
}


/* ---------- individual essays ---------- */

.post-content {
    max-width: 65ch;

    font-family: Georgia, 'Times New Roman', serif;
}

.post-content p {
    font-size: 17px;
    line-height: 1.75;

    color: #cfcabb;
}

.post-content hr {
    border: none;

    border-top: 1px solid rgba(201, 162, 75, 0.25);

    margin: 40px 0 20px;
}


/* ---------- footnote hover preview ---------- */

.footnote-tooltip {
    display: none;

    position: fixed;

    max-width: 320px;

    background: rgba(20, 23, 27, 0.92);
    border: 1px solid rgba(201, 162, 75, 0.35);
    border-radius: 4px;

    padding: 12px 16px;

    font-family: Georgia, 'Times New Roman', serif;
    font-size: 14px;
    line-height: 1.6;
    color: #cfcabb;

    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);

    z-index: 50;
}

.footnote-tooltip.is-visible {
    display: block;
}

.footnote-tooltip a {
    color: #c9a24b;
}

.footnote-tooltip a:hover {
    color: #e2bb63;
    background: none;
}

@media (max-width: 600px) {
    .footnote-tooltip {
        max-width: calc(100vw - 32px);
    }
}


/* ---------- mobile ---------- */

@media (max-width: 600px) {

    html {
        margin: 0;

        width: 100%;
        min-height: 100%;

        background-image: url('images/hero.jpg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;

        background-color: #984416;
    }


    /* homepage */

    body.home {
        margin: 0;
        padding: 0;

        width: 100%;
        max-width: none;

        min-height: 100vh;
        min-height: 100dvh;

        background: transparent;

        overflow-x: hidden;
    }

    .hero {
        width: 100%;

        height: 100vh;
        height: 100dvh;

        min-height: 100dvh;

        overflow: hidden;
    }

    .hero img {
        width: 100%;
        height: 100%;

        object-fit: cover;

        display: block;
    }

    .hero nav {
        top: 18px;
        right: 16px;

        gap: 16px;
    }

    .hero nav a {
        font-size: 15px;

        padding: 6px 2px;
    }

    .hero .name {
        top: 20px;
        left: 16px;

        font-size: 14px;
    }


    /* painted pages */

    body.painted {
        margin: 0;

        width: 100%;
        max-width: none;

        min-height: 100vh;
        min-height: 100dvh;

        padding: 24px 12px 40px;

        background: transparent;

        box-sizing: border-box;
    }


    /* cards */

    .card {
        width: 100%;

        padding: 26px 20px;
    }

    .card h2 {
        margin-top: 18px;
    }

    .card p {
        font-size: 15px;
        line-height: 1.65;
    }

    .home-link {
        font-size: 13px;

        margin-bottom: 16px;
    }


    /* blog posts */

    .post-content {
        max-width: 100%;
    }

    .post-content p {
        font-size: 16px;
        line-height: 1.7;
    }

    .post-content h1,
    .post-content h2,
    .post-content h3 {
        overflow-wrap: break-word;
    }


    /* about */

    .about-photo {
        float: none;

        width: 100%;
        height: auto;

        margin: 0 0 20px;
    }


    /* images */

    .blog-photo {
        width: 100%;
        height: auto;
    }

    .top-links {
        gap: 20px;

        flex-wrap: wrap;
    }
}

/* Mobile painting belongs to the scrolling document, not a fixed layer. */
@media (max-width: 600px), (hover: none) and (pointer: coarse) {
    html {
        /* Let the body's background paint the document canvas. */
        background: none;
    }

    body.home,
    body.painted {
        min-height: 100vh;
        min-height: 100lvh;
        background: url('images/hero.jpg') center / cover no-repeat scroll;
    }

    body.home::before,
    body.painted::before {
        content: none;
    }

    .hero {
        height: 100vh;
        height: 100lvh;
    }

    .hero img {
        /* Keep one painting and retain the existing hero geometry. */
        visibility: hidden;
    }
}
