/* Text-first theme using Theme UI-inspired tokens */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --theme-ui-colors-background: #fdfbf7;
    --theme-ui-colors-surface: #f7f4ef;
    --theme-ui-colors-text: #14110f;
    --theme-ui-colors-muted: #54504a;
    --theme-ui-colors-border: #e6e0d6;
    --theme-ui-colors-accent: #0f0d0b;

    --theme-ui-fonts-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --theme-ui-fonts-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

    --theme-ui-fontWeights-body: 400;
    --theme-ui-fontWeights-medium: 500;
    --theme-ui-fontWeights-strong: 600;
    --theme-ui-fontWeights-heading: 700;

    --theme-ui-lineHeights-body: 1.7;
    --theme-ui-letterSpacings-tight: -0.01em;

    --theme-ui-space-0: 0;
    --theme-ui-space-1: 0.4rem;
    --theme-ui-space-2: 0.8rem;
    --theme-ui-space-3: 1.2rem;
    --theme-ui-space-4: 1.6rem;
    --theme-ui-space-5: 2.4rem;

    --theme-ui-radii-soft: 10px;
}

body {
    font-family: var(--theme-ui-fonts-body);
    color: var(--theme-ui-colors-text);
    background: var(--theme-ui-colors-background);
    line-height: var(--theme-ui-lineHeights-body);
    font-size: 16px;
}

a {
    color: var(--theme-ui-colors-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--theme-ui-colors-accent);
    text-decoration: none;
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 var(--theme-ui-space-2);
}

.page {
    padding: var(--theme-ui-space-5) 0 var(--theme-ui-space-4);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--theme-ui-space-2);
}

p, time, li, h1, h2, h3, h4 {
    font-size: 1rem;
}

h1, h2, h3, h4 {
    font-weight: var(--theme-ui-fontWeights-heading);
    letter-spacing: var(--theme-ui-letterSpacings-tight);
}

.muted {
    color: var(--theme-ui-colors-muted);
    font-weight: var(--theme-ui-fontWeights-medium);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: var(--theme-ui-fontWeights-strong);
    color: var(--theme-ui-colors-muted);
}

.lede {
    font-weight: var(--theme-ui-fontWeights-heading);
}

.inline-link {
    display: inline-flex;
    align-items: center;
    gap: var(--theme-ui-space-1);
    font-weight: var(--theme-ui-fontWeights-strong);
}

.inline-links {
    display: inline-flex;
    gap: var(--theme-ui-space-2);
    flex-wrap: wrap;
}

.section-label {
    font-weight: var(--theme-ui-fontWeights-strong);
    color: var(--theme-ui-colors-muted);
    letter-spacing: 0.06em;
}

.card {
    background: var(--theme-ui-colors-surface);
    border: 1px solid var(--theme-ui-colors-border);
    border-radius: var(--theme-ui-radii-soft);
    padding: var(--theme-ui-space-3);
}

.site-header {
    border-bottom: 1px solid var(--theme-ui-colors-border);
    padding: var(--theme-ui-space-3) 0;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--theme-ui-space-2);
    /* Keep the header flush with the viewport edges; other sections keep their own padding */
    padding: 0;
}

.site-identity {
    display: flex;
    flex-direction: column;
    gap: var(--theme-ui-space-1);
}

.site-title {
    font-weight: var(--theme-ui-fontWeights-heading);
    text-decoration: none;
}

.site-tagline {
    color: var(--theme-ui-colors-muted);
    font-weight: var(--theme-ui-fontWeights-medium);
}

.site-nav {
    display: flex;
    gap: var(--theme-ui-space-2);
}

.site-nav a {
    text-decoration: none;
    font-weight: var(--theme-ui-fontWeights-strong);
}

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

.page-header {
    margin-bottom: var(--theme-ui-space-4);
}

.posts-list,
.notes-list {
    gap: var(--theme-ui-space-3);
}

.post-row,
.note-row {
    display: flex;
    gap: var(--theme-ui-space-2);
    border-bottom: 1px solid var(--theme-ui-colors-border);
    padding-bottom: var(--theme-ui-space-3);
}

.post-row:last-child,
.note-row:last-child {
    border-bottom: none;
}

.post-row-body,
.note-body {
    display: flex;
    flex-direction: column;
    gap: var(--theme-ui-space-1);
}

.post-link,
.note-link {
    text-decoration: none;
    font-weight: var(--theme-ui-fontWeights-heading);
}

.post-title {
    font-size: 1rem;
}

.note-link {
    display: block;
    color: inherit;
}

.post-link:hover,
.note-link:hover {
    text-decoration: underline;
}

.hero-copy {
    margin-bottom: var(--theme-ui-space-5);
}

.prose {
    display: grid;
    gap: var(--theme-ui-space-2);
}

.prose h2,
.prose h3 {
    margin-top: var(--theme-ui-space-3);
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre {
    margin: 0;
}

.prose ul,
.prose ol {
    padding-left: 1.25rem;
    display: grid;
    gap: var(--theme-ui-space-1);
}

.prose li {
    line-height: var(--theme-ui-lineHeights-body);
}

.prose blockquote {
    border-left: 2px solid var(--theme-ui-colors-border);
    padding-left: var(--theme-ui-space-2);
    color: var(--theme-ui-colors-muted);
}

.prose code {
    font-family: var(--theme-ui-fonts-mono);
    background: var(--theme-ui-colors-surface);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.prose pre {
    background: var(--theme-ui-colors-surface);
    border: 1px solid var(--theme-ui-colors-border);
    border-radius: var(--theme-ui-radii-soft);
    padding: var(--theme-ui-space-3);
    overflow-x: auto;
}

.prose pre code {
    background: transparent;
    padding: 0;
    line-height: 1.4;
    display: block;
}

.page-nav {
    margin-top: var(--theme-ui-space-4);
    padding-top: var(--theme-ui-space-3);
    border-top: 1px solid var(--theme-ui-colors-border);
}

.site-footer {
    border-top: 1px solid var(--theme-ui-colors-border);
    padding: var(--theme-ui-space-3) 0 var(--theme-ui-space-4);
    margin-top: var(--theme-ui-space-4);
}

.site-footer .container {
    padding: 0;
}

.site-footer p {
    color: var(--theme-ui-colors-muted);
    font-weight: var(--theme-ui-fontWeights-medium);
}

@media (max-width: 640px) {
    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
    }

    .post-row,
    .note-row {
        flex-direction: column;
    }
}
