:root {
    --fg: #1a1a1a;
    --bg: #fafaf7;
    --muted: #6a6a6a;
    --rule: #d0d0d0;
    --accent: #404040;
    --code-bg: #f0eee8;
    --serif: "Iowan Old Style", "Source Serif 4", "Charter", Cambria, Georgia, serif;
    --sans:  "IBM Plex Sans", Inter, -apple-system, "Segoe UI", sans-serif;
    --mono:  "IBM Plex Mono", "JetBrains Mono", "DejaVu Sans Mono", monospace;
    --measure: 48rem;
    --gutter: 1.5rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg: #ffffff;
        --bg: #000000;
        --muted: #999999;
        --rule: #2a2a2a;
        --accent: #d0d0d0;
        --code-bg: #1a1a1a;
    }
}

* { box-sizing: border-box; }

html {
    font-size: 18px;
    line-height: 1.55;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--serif);
    color: var(--fg);
    background: var(--bg);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body > header,
body > main,
body > footer {
    max-width: var(--measure);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

body > header {
    margin-top: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule);
}

.title {
    display: block;
    font-family: var(--sans);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.02em;
    color: var(--fg);
    text-decoration: none;
    margin-bottom: 0.4rem;
}

.nav {
    font-family: var(--sans);
    font-size: 0.9rem;
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--accent); }

main { margin-top: 2rem; margin-bottom: 4rem; }

h1, h2, h3 {
    font-family: var(--sans);
    font-weight: 600;
    line-height: 1.2;
    margin: 2rem 0 0.6rem;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; margin-top: 2.5rem; }
h3 { font-size: 1.0rem; }

p { margin: 0.8rem 0; }

a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

ul, ol { padding-left: 1.4rem; }
li { margin: 0.25rem 0; }

code, pre, kbd, samp { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--code-bg); padding: 0.05em 0.3em; border-radius: 2px; }
pre  {
    background: var(--code-bg);
    padding: 0.9rem 1rem;
    border-radius: 3px;
    overflow-x: auto;
    line-height: 1.45;
}
pre code { background: none; padding: 0; }

blockquote {
    margin: 1rem 0;
    padding: 0.2rem 0 0.2rem 1rem;
    border-left: 2px solid var(--rule);
    color: var(--muted);
}

article > header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--rule);
}
.meta {
    font-family: var(--sans);
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
}

.tags a { color: var(--muted); }

.feed-link {
    font-family: var(--sans);
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 2rem;
}
.feed-link a { color: var(--muted); }

.footnotes {
    font-size: 0.9rem;
    color: var(--muted);
}
.footnotes li { margin: 0.4rem 0; }

.post-list { list-style: none; padding: 0; }
.post-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--rule);
}
.post-list time {
    font-family: var(--sans);
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

@font-face {
    font-family: "Latin Modern Math";
    src: local("Latin Modern Math"),
         url("/fonts/latinmodern-math.woff2") format("woff2");
    font-display: swap;
}

math {
    font-family: "Latin Modern Math", math;
    font-size: 1.05em;
    max-width: 100%;
}
math[display="block"] {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 1.2rem auto;
    overflow-x: auto;
    overflow-y: hidden;
}

body > footer {
    margin-top: 3rem;
    margin-bottom: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}
body > footer a { color: var(--muted); }
body > footer p { margin: 0.4rem 0; }
