:root {
    --bg: #fbfaf7;
    --fg: #1d1d1b;
    --muted: #6b6a66;
    --rule: #e4e1da;
    --accent: #b4532b;
    --code-bg: #f1efe9;
    --measure: 42rem;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #161614;
        --fg: #e8e6e0;
        --muted: #9a988f;
        --rule: #2c2b27;
        --accent: #e58a5c;
        --code-bg: #1f1e1b;
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

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

.site-header, main, .site-footer {
    width: min(100% - 2rem, var(--measure));
    margin-inline: auto;
}

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1.5rem;
    padding: 1.5rem 0 1rem;
    border-bottom: 1px solid var(--rule);
}
.site-title { font-weight: 700; font-size: 1.25rem; color: var(--fg); text-decoration: none; margin-right: auto; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--fg); }

main { padding: 2rem 0 3rem; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; margin: 0 0 0.25rem; }
.post h2, .page h2 { font-size: 1.4rem; margin-top: 2rem; }
.post h3, .page h3 { font-size: 1.15rem; margin-top: 1.75rem; }

time { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.list .card { padding: 1.25rem 0; border-bottom: 1px solid var(--rule); }
.list .card:last-child { border-bottom: none; }
.card h2 { font-size: 1.3rem; margin: 0 0 0.15rem; }
.card h2 a { color: var(--fg); text-decoration: none; }
.card h2 a:hover { color: var(--accent); }
.card p { margin: 0.5rem 0 0; color: var(--muted); }

.post header { margin-bottom: 1.5rem; }
.post img { max-width: 100%; height: auto; border-radius: 4px; display: block; margin: 1.5rem auto 0.25rem; }
.post img + em, .post p > em:only-child { display: block; text-align: center; color: var(--muted); font-size: 0.9rem; font-style: normal; }
.post pre {
    background: var(--code-bg);
    padding: 0.9rem 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}
.post code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
.post :not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
.post blockquote { margin: 1.25rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
.post ul, .post ol { padding-left: 1.5rem; }
.post li { margin: 0.25rem 0; }

.video { position: relative; aspect-ratio: 16 / 9; margin: 1.5rem 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 6px; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 2rem 0 0; }
.tags a { font-size: 0.8rem; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 0.1rem 0.6rem; text-decoration: none; }
.tags a:hover { color: var(--fg); border-color: var(--muted); }

.site-footer { padding: 1.5rem 0 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--fg); }
.site-footer p { margin: 0.75rem 0 0; }

@media (prefers-reduced-motion: no-preference) {
    a { transition: color 120ms ease, text-decoration-thickness 120ms ease; }
}
