/* todo: 
- active states for
    - email button
    - nav name
    - nav section
- smooth font sizing for <width down to minimum
- two-column with 1000px container & 240 / 650 columns
  a la butterick:
  https://practicaltypography.com/web-and-email-addresses.html
- style ::selection
    ::selection {
        background-color: #9DB5FFaa;
        color: #fff;
        text-shadow: 1px 1px #0008;
    }

 */
:root {
    --width: min(650px, calc(100% - 20px));
    --body-weight: 350;
    --body-size: 19px;
}
* {
    margin: 0;
    padding: 0;
}

/* Default antialiasing */
.no-aa {
    -webkit-font-smoothing: auto;
    -moz-osx-font-smoothing: auto;
}
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #FFFEF0;
    color: #333;
    font: var(--body-weight) var(--body-size)/1.6 AbitareSans;
}
header {
    background: #FFFEF0;
    border-bottom: 2px solid #EDE4C4;
    display: flow-root;

    & > div {
        width: var(--width);
        margin: 18px auto;
        display: flex;
        align-items: center;
        text-box-trim: trim-both;

        nav {
            margin-right: auto;
            font: var(--body-weight) 16px AbitareSans, sans-serif;
            color: #B7AD8C;

            a {
                text-decoration: none;
                text-underline-offset: 2px;

                &:hover {
                    text-decoration: underline
                }
                &.name {
                    font-weight: 700;
                    color: #E65100;
                }
                &.section {
                    color: #D88805;
                }
            }
        }
        .email {
            margin-left: auto;
            height: 37px;
            width: 125px;
            background: #FFFCEE;
            border: 1px solid #ECEBE5;
            border-radius: 3px;
            color: #ADA27F;
            text-decoration: none;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 11px;
            font: var(--body-weight) 14px AbitareSans, sans-serif;

            &:hover {
                background: #fff;
            }
        }
    }
}
.premain {
    width: var(--width);
    margin: 0 auto;
    padding-top: 30px;

    .callout {

        /* For proper rounded corners on the left stripe */
        &::before {
            content: '';
            position: absolute;
            left: 0;
            top: -1px;
            bottom: -1px;
            width: 5px;
            background-color: #78B159;
            border-radius: 3px 0 0 3px;
        }
        position: relative;
        border: 1px solid #E5F2DC;
        border-left: none;
        border-radius: 3px;
        background: #F8FDF6;
        color: #182C0B;
        font: var(--body-weight) 14px AbitareSans;
        display: flex;
        width: fit-content;
        align-items: center;
        justify-content: center;
        padding-right: 15px;

        svg {
            color: #579F32;
            margin: 5px 10px 5px 15px;
        }
    }
}
.everything-but-header {
    background: #fff;
    border-bottom: 2px solid #EDE4C4;
    padding-bottom: 30px;
    margin-bottom: 20px;
}
main {
    .post {
        width: var(--width);
        margin: 0 auto;

        h1, h2, h3, h4, h5, h6 {
            font-family: Scorekard;
            font-weight: bold;
            text-box-trim: trim-both;

            &:not(.title) {
                margin-top: 0.35em;
            }
        }
        h1 {
            font-size: 42px;
        }
        h2 {
            font-size: 28px;
        }
        h3 {
            font-size: 24px;
        }
        img {
            max-width: 100%
        }
        pre.z-code {
            font-size: 16px;
            overflow: auto;
            scrollbar-width: thin;
            scrollbar-color: #74798E99 transparent;
            font-feature-settings: 'frac' 0;
            background: #f7f7f7;
            padding: 0.5em;
            margin: -0.5em;
        }
        code {
            word-wrap: break-word;
            -webkit-font-smoothing: auto;
            -moz-osx-font-smoothing: auto;
        }
        pre, code {
            font-family: PragmataPro
        }
        blockquote {
            font-style: italic;
            font-size: 18px;
            padding: 0.25em 1em;
            display: flex;
            flex-direction: column;
            gap: 0.5em;
            line-height: 1.3;

            /* attempt to detect attribution lines like 
               — [Yuri Vishnevsky](https://yuri.is) */
            p:last-child:has(a) {
                text-align: right;
            }
        }
        ul, ol {
            padding-inline-start: 40px;

            li {
                margin-bottom: 0.5em;
            }
            li > ul {

                /* nested list */
                margin-top: 0.5em;
            }
        }
        & > .topline {
            color: #959595;
            font: normal 16px Cartridge;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            margin-top: 25px;
            text-box-trim: trim-both;
        }
        & > .title {
            margin-bottom: 25px;
        }
        & > .content {
            color: #333;
            display: flex;
            flex-direction: column;
            gap: 1em;

            a {
                color: inherit;
                text-underline-offset: 2px;
            }
        }
    }
}
.postmain {
    & > div {
        margin: 0 auto;
        margin-top: 30px;
        max-width: var(--width);

        a.back-to-top {
            text-decoration: none;
            text-underline-offset: 2px;

            &:hover {
                text-decoration: underline
            }
            color:#ADA27F;
            font: var(--body-weight) var(--body-size)/1.6 AbitareSans;
        }
    }
}
