:root {
    color-scheme: light dark;
    --bg: #fefefa;
    --surface: #fff8ec;
    --text: #34251a;
    --muted: #836f5b;
    --line: #eadfcc;
    --heading: #cb5c0d;
    --accent: #008081;
    --accent-strong: #006a6b;
    --tag-bg: #fff3dd;
    --code-bg: #f4ead8;
    --selection: #ffd49d;
    --measure: 760px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #15110d;
        --surface: #201812;
        --text: #eadfce;
        --muted: #b59f88;
        --line: #3a2b20;
        --heading: #ff9a45;
        --accent: #64d4cc;
        --accent-strong: #8ce7df;
        --tag-bg: #2a2118;
        --code-bg: #241b14;
        --selection: #6b3f19;
    }
}

* {
    box-sizing: border-box;
}

html {
    background-color: var(--bg);
    background-image: none;
}

body {
    margin: 0;
    color: var(--text);
    background-color: var(--bg);
    background-image: none;
    font-family: Avenir, "Segoe UI", Ubuntu, system-ui, sans-serif;
    font-size: clamp(16px, 1.7vw, 18px);
    line-height: 1.65;
}

.container,
.wrapper,
main,
.post,
.page,
.list,
.markdown,
.recent-posts {
    background-color: var(--bg);
    background-image: none;
}

::selection {
    background: var(--selection);
    text-shadow: none;
}

a {
    color: var(--accent);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
    overflow-wrap: break-word;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--heading);
    font-family: "Avenir Next", Avenir, "Segoe UI", Ubuntu, system-ui, sans-serif;
    font-weight: 650;
    line-height: 1.18;
    letter-spacing: -0.025em;
}

h1 {
    font-size: clamp(2rem, 8vw, 3.15rem);
}

h2 {
    font-size: clamp(1.45rem, 4vw, 2rem);
}

h3 {
    font-size: 1.35rem;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.2rem auto;
}

hr {
    height: 1px;
    margin: 1.5rem 0;
    border: 0;
    border-top: 1px solid var(--line);
}

blockquote {
    margin: 1.6rem 0;
    padding: 0.1rem 0 0.1rem 1.2rem;
    color: color-mix(in oklch, var(--text) 88%, var(--heading));
    border-left: 3px solid var(--heading);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
    font-style: italic;
}

pre,
code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

code {
    padding: 0.1rem 0.28rem;
    border-radius: 0.25rem;
    background: var(--code-bg);
    font-size: 0.92em;
}

pre {
    overflow-x: auto;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    background: var(--code-bg);
}

pre code {
    display: inline-block;
    padding: 0;
    background: transparent;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--line);
}

th {
    background: var(--surface);
}

ul {
    padding-left: 1.1rem;
}

ul.flat {
    margin: 0;
    padding: 0;
}

ul.flat li {
    display: inline-block;
    list-style: none;
}

.wrapper {
    max-width: var(--measure);
    margin-inline: auto;
}

.container {
    margin-top: clamp(2rem, 8vw, 4rem);
    padding-inline: clamp(1.1rem, 5vw, 2rem);
}

.header {
    margin-bottom: clamp(1.7rem, 5vw, 2.8rem);
    padding-bottom: 1.1rem;
}

.masthead {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.site-title {
    margin: 0;
    font-size: clamp(2.2rem, 11vw, 4.5rem);
    line-height: 0.95;
    letter-spacing: -0.07em;
}

.site-title a {
    color: var(--heading);
    text-decoration: none;
}

.site-description {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-top: 0.45rem;
    color: var(--heading);
    font-weight: 600;
}

.site-description h2 {
    max-width: 31rem;
    margin: 0;
    font-size: clamp(1rem, 2.7vw, 1.2rem);
    letter-spacing: 0;
}

.nav.primary {
    margin-top: 1.35rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
}

.nav li {
    margin-right: 0.72rem;
}

.nav a {
    font-size: 0.88rem;
    font-weight: 650;
    text-decoration: none;
}

.nav a:hover {
    text-decoration: underline;
}

.social {
    min-width: 10rem;
    text-align: right;
}

.social li {
    margin-right: 0;
    margin-left: 0.58rem;
}

.section-header {
    margin-bottom: 1.25rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.post-summary {
    margin-bottom: 1.55rem;
}

.post-summary .title {
    font-weight: 750;
}

.post-summary .separator,
.post-summary .description {
    color: var(--muted);
}

.meta {
    margin-bottom: 0.2rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.post-header {
    margin-bottom: 1.8rem;
}

.post-header .title {
    margin: 0;
}

.markdown > :first-child {
    margin-top: 0;
}

.markdown li {
    margin-bottom: 0.55rem;
}

.post-tags {
    margin-top: 2rem;
}

.post-tags a {
    display: inline-block;
    margin: 0.25rem 0.35rem 0.25rem 0;
    padding: 0.12rem 0.5rem;
    border: 1px solid color-mix(in oklch, var(--accent) 70%, var(--line));
    border-radius: 999px;
    background: var(--tag-bg);
    color: var(--accent-strong);
    font-size: 0.74rem;
    text-decoration: none;
}

.prev-next {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
}

.prev-next > div:last-child {
    margin-left: auto;
    text-align: right;
}

.footer {
    margin-top: clamp(2.5rem, 7vw, 4rem);
    padding: 1.2rem clamp(1.1rem, 5vw, 2rem) 2rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.76rem;
    text-align: right;
}

@media (max-width: 680px) {
    body {
        line-height: 1.58;
    }

    .masthead {
        align-items: baseline;
    }

    .social {
        min-width: 0;
        margin-top: 0;
        text-align: right;
    }

    .social li {
        margin-left: 0;
        margin-right: 0.6rem;
    }

    .post-summary .separator {
        display: none;
    }

    .post-summary .description {
        display: block;
        margin-top: 0.2rem;
    }

    .prev-next {
        display: block;
    }

    .prev-next > div + div {
        margin-top: 0.75rem;
    }

    .footer {
        text-align: left;
    }
}
