/* --- Reset & base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --color-bg: #fafaf9;
    --color-surface: #ffffff;
    --color-text: #1c1917;
    --color-text-muted: #57534e;
    --color-border: #e7e5e4;
    --color-accent: #b5a8c8;
    --color-accent-hover: #9d8fb3;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --max-width: 42rem;
    --max-width-wide: 64rem;
    --spacing: 1.5rem;
}

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

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
}

/* --- Typography --- */
h1, h2, h3, h4 {
    line-height: 1.25;
    font-weight: 600;
    margin-top: 0;
}

h1 {
    font-size: 1.75rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.375rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* --- Layout --- */
header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing) 1.25rem;
    text-align: center;
}

header h1 {
    margin: 0 0 1rem;
    font-size: 1.5rem;
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

header h1 a:hover {
    color: var(--color-accent);
    text-decoration: none;
}

header:has(nav) h1 {
    margin-bottom: 1rem;
}

header:not(:has(nav)) h1 {
    margin-bottom: 0;
}

main {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

main:has(> article:only-child) {
    max-width: var(--max-width-wide);
}

section {
    margin-bottom: 3rem;
}

section:last-child {
    margin-bottom: 0;
}

section > p:last-child,
article > p:last-child {
    margin-bottom: 0;
}

/* --- Navigation --- */
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.25rem;
}

nav a {
    font-size: 0.9375rem;
    font-weight: 500;
}

/* --- Blog post cards (index) & full posts --- */
article {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
}

main > article:only-child {
    margin-top: 0;
    padding: 2rem 1.75rem;
}

main > article:only-child h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    border-bottom: none;
    padding-bottom: 0;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

main > article:only-child .subtitle {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.date {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem !important;
}

.post-list article:first-child {
    margin-top: 1rem;
}

article h3 {
    margin-bottom: 0.5rem;
}

.post-list .subtitle {
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
}

article a {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

article figure {
    margin: 1.5rem 0 2rem;
}

article img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

article figcaption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* --- Footer --- */
footer {
    border-top: 1px solid var(--color-border);
    background-color: var(--color-surface);
    padding: 1.5rem 1.25rem;
    text-align: center;
}

footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}
