:root {
    --ink: #22282B;
    --stone: #6B7075;
    --hair: #D8D4CC;
    --paper: #FDFCFA;
    --accent: #97592F;
    --quote: #3A4145;
    --measure: 41rem;
}

@media screen and (prefers-color-scheme: dark) {
    :root {
        --ink: #E4E0D8;
        --stone: #9BA0A4;
        --hair: #32383C;
        --paper: #16191B;
        --accent: #CB8B5C;
        --quote: #C2C0BA;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    font-optical-sizing: auto;
    font-weight: 400;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    padding: 0 1.5rem;
    overflow-wrap: break-word;
}

a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

a:hover {
    border-bottom-color: var(--accent);
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

header.site,
main {
    max-width: var(--measure);
    margin: 0 auto;
}

/* Masthead */

header.site {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 2rem 0 1.1rem;
    border-bottom: 1px solid var(--hair);
    letter-spacing: 0.04em;
}

header.site .home {
    color: var(--ink);
    font-weight: 600;
    letter-spacing: 0.004em;
    font-size: 1.1rem;
}

header.site .home:hover {
    border-bottom-color: var(--ink);
}

/* Piece */

header.post {
    padding: 3.5rem 0 2.2rem;
}

header.post .meta {
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 1rem;
}

header.post h1 {
    font-size: clamp(2rem, 5.5vw, 2.7rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: 0.002em;
    text-wrap: balance;
}

header.post .subtitle {
    margin-top: 1rem;
    font-size: 1.25rem;
    font-style: italic;
    line-height: 1.45;
    color: var(--stone);
    text-wrap: pretty;
}

figure.feature {
    margin-bottom: 2.6rem;
}

figure img,
.body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border: 1px solid var(--hair);
}

figure.feature img {
    width: 100%;
}

figcaption {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--stone);
    text-align: center;
}

.body {
    font-size: 1.16rem;
}

.body > * + * {
    margin-top: 1.35em;
}

.body h2,
.body h3,
.body h4 {
    font-weight: 600;
    line-height: 1.25;
    margin-top: 2.2em;
    text-wrap: balance;
}

.body h2 { font-size: 1.55rem; }
.body h3 { font-size: 1.32rem; }
.body h4 { font-size: 1.16rem; }

.body a {
    border-bottom-color: var(--hair);
}

.body a:hover {
    border-bottom-color: var(--accent);
}

.body strong a,
.body a strong {
    font-weight: 600;
}

.body ul,
.body ol {
    padding-left: 1.4em;
}

.body li + li,
.body li > ul,
.body li > ol {
    margin-top: 0.5em;
}

.body li > p + p {
    margin-top: 0.8em;
}

.body blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 1.3em;
    font-style: italic;
    color: var(--quote);
}

.body blockquote > * + * {
    margin-top: 1em;
}

.body hr {
    border: 0;
    border-top: 1px solid var(--hair);
    width: 5rem;
    margin: 2.6em auto;
}

.body figure {
    margin-top: 2.2em;
    margin-bottom: 2.2em;
}

.body iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    border: 0;
}

.body sup {
    line-height: 0;
    font-size: 0.72em;
}

.body .footnote-anchor {
    padding: 0 0.15em;
    border-bottom: 0;
}

.body .footnotes,
.body .footnote {
    font-size: 0.95rem;
    line-height: 1.55;
}

.body .formula {
    overflow-x: auto;
    padding: 0.4em 0;
    font-size: 1.05em;
}

.body math {
    font-family: 'Source Serif 4', Georgia, serif;
}

/* Attached files */

.kg-file-card-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--hair);
    color: var(--ink);
    line-height: 1.4;
}

.kg-file-card-container:hover {
    border-color: var(--accent);
}

.kg-file-card-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.kg-file-card-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.9rem;
    margin-top: 0.2rem;
    font-size: 0.88rem;
    color: var(--stone);
}

.kg-file-card-caption:empty {
    display: none;
}

.kg-file-card-icon {
    flex: none;
    width: 1.6rem;
    height: 1.6rem;
    color: var(--accent);
}

.kg-file-card-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

footer.post {
    margin-top: 4rem;
    padding: 1.4rem 0 4rem;
    border-top: 1px solid var(--hair);
    letter-spacing: 0.04em;
}

@media (max-width: 560px) {
    body {
        padding: 0 1.15rem;
    }

    header.site {
        padding-top: 1.4rem;
    }

    header.post {
        padding: 2.4rem 0 1.8rem;
    }

    .body {
        font-size: 1.08rem;
    }

}

@media print {
    header.site,
    footer.post,
    .body iframe {
        display: none;
    }

    body {
        background: #fff;
        padding: 0;
    }

    .body {
        font-size: 11pt;
    }

    a {
        color: inherit;
    }
}
