:root {
    --bg: #fdfdfb;
    --fg: #1c1c1c;
    --muted: #64748b;
    --link: #1d4ed8;
    --link-visited: #6d28d9;
    --border: #e8e8e2;
    --code-bg: #f5f5f0;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #161616;
        --fg: #e8e6e0;
        --muted: #94a3b8;
        --link: #60a5fa;
        --link-visited: #a78bfa;
        --border: #2e2e2e;
        --code-bg: #1e1e1e;
    }
}

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

body {
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.7;
    color: var(--fg);
    background: var(--bg);
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: none; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.site-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--fg);
    text-decoration: none;
}
.site-name:visited { color: var(--fg); }

nav a {
    font-size: 0.875rem;
    color: var(--muted);
    text-decoration: none;
    margin-left: 1.25rem;
}
nav a:hover { color: var(--fg); }
nav a:visited { color: var(--muted); }

/* Post list (index page) */
.post-list { list-style: none; }

.post-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}
.post-item:last-child { border-bottom: none; }

.post-date {
    color: var(--muted);
    font-size: 0.8125rem;
    margin-bottom: 0.2rem;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.4rem;
}
.post-title a { color: var(--fg); text-decoration: none; }
.post-title a:visited { color: var(--fg); }
.post-title a:hover { text-decoration: underline; text-underline-offset: 3px; }

.post-summary { color: var(--muted); font-size: 0.9375rem; }

/* Single post */
.article-header { margin-bottom: 2rem; }

.article-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}

.article-date { color: var(--muted); font-size: 0.8125rem; }

.article-body { line-height: 1.8; }

.article-body h2,
.article-body h3,
.article-body h4 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
}
.article-body h2 { font-size: 1.35rem; }
.article-body h3 { font-size: 1.15rem; }

.article-body p { margin-bottom: 1.25rem; }

.article-body ul,
.article-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}
.article-body li { margin-bottom: 0.3rem; }

.article-body code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.35em;
    border-radius: 3px;
}

.article-body pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}
.article-body pre code { background: none; padding: 0; font-size: 0.875rem; }

.article-body blockquote {
    border-left: 3px solid var(--border);
    margin: 1.5rem 0;
    padding: 0.25rem 1.25rem;
    color: var(--muted);
}

.article-body img {
    max-width: 100%;
    border-radius: 6px;
    margin: 1rem 0;
    display: block;
}

.back-link {
    display: inline-block;
    margin-top: 2.5rem;
    color: var(--muted);
    font-size: 0.875rem;
    text-decoration: none;
}
.back-link:hover { color: var(--fg); }
.back-link:visited { color: var(--muted); }

footer {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8125rem;
}

@media (max-width: 600px) {
    body { font-size: 16px; padding: 1.25rem 1rem; }
    .article-header h1 { font-size: 1.5rem; }
    header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    nav a:first-child { margin-left: 0; }
}
