/* Writing / Blog — editorial newsletter aesthetic
   Replaces the prior card-grid styling. */

:root {
    --bg: #000000;
    --bg-elev: #0a0a0a;
    --text: #ededee;
    --text-soft: #b9b9bd;
    --text-muted: #6e6e74;
    --rule: #1f1f23;
    --rule-strong: #2a2a2f;
    --accent: #ffffff;

    --serif: "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, ui-serif, serif;
    --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;

    --maxw: 680px;
    --gutter: 24px;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body.writing-page {
    min-height: 100vh;
    padding-bottom: 96px;
}

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

/* Top nav — minimal, persistent */
.writing-topnav {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 28px var(--gutter) 0;
}
.back-link {
    display: inline-block;
    font-size: 13px;
    letter-spacing: 0.01em;
    color: var(--text-muted);
    transition: color 0.15s ease;
}
.back-link:hover { color: var(--text); }

/* Wrap */
.writing-wrap, .post-wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 48px var(--gutter) 0;
}

/* Index header */
.writing-header {
    margin-bottom: 56px;
}
.eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.lede {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.45;
    color: var(--text);
    margin: 0;
    font-weight: 400;
    letter-spacing: -0.005em;
}

/* Index list */
.writing-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.entry {
    border-top: 1px solid var(--rule);
}
.entry:last-child {
    border-bottom: 1px solid var(--rule);
}
.entry-link {
    display: block;
    padding: 28px 0 32px;
    transition: opacity 0.15s ease;
}
.entry-link:hover { opacity: 0.78; }
.entry-link:hover .entry-title { color: var(--accent); }

.entry-meta {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.entry-meta .dot { opacity: 0.5; }
.entry-meta .cat {
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.08em;
    font-size: 11px;
}
.entry-meta time { font-variant-numeric: tabular-nums; }

.entry-title {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.22;
    color: var(--text);
    margin: 0 0 10px;
    transition: color 0.15s ease;
}
.entry-excerpt {
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text-soft);
    margin: 0;
    font-weight: 400;
}

.empty {
    color: var(--text-muted);
    font-size: 15px;
    padding: 40px 0;
    text-align: center;
}

/* Post detail */
.post-header {
    margin-bottom: 36px;
}
.post-meta {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.post-meta .dot { opacity: 0.5; }
.post-meta .cat { text-transform: uppercase; font-weight: 500; letter-spacing: 0.08em; font-size: 11px; }
.post-meta time { font-variant-numeric: tabular-nums; }

.post-title {
    font-family: var(--serif);
    font-size: 40px;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text);
    margin: 0 0 18px;
}
.post-lede {
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.5;
    color: var(--text-soft);
    margin: 0;
    font-weight: 400;
    font-style: italic;
}

.post-body {
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.7;
    color: var(--text);
    padding-top: 8px;
    border-top: 1px solid var(--rule);
    margin-top: 36px;
    padding-top: 36px;
}
.post-body > *:first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.2em; }
.post-body h2 {
    font-family: var(--serif);
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.25;
    margin: 2em 0 0.6em;
    color: var(--text);
}
.post-body h3 {
    font-family: var(--serif);
    font-size: 21px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin: 1.8em 0 0.5em;
    color: var(--text);
}
.post-body h4 {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.8em 0 0.4em;
    color: var(--text-muted);
}
.post-body a {
    color: var(--text);
    border-bottom: 1px solid var(--rule-strong);
    transition: border-color 0.15s ease;
}
.post-body a:hover { border-bottom-color: var(--text); }
.post-body strong { color: var(--text); font-weight: 600; }
.post-body em { font-style: italic; }
.post-body ul, .post-body ol {
    padding-left: 1.4em;
    margin: 0 0 1.2em;
}
.post-body li { margin-bottom: 0.4em; }
.post-body blockquote {
    border-left: 2px solid var(--rule-strong);
    margin: 1.6em 0;
    padding: 4px 18px;
    color: var(--text-soft);
    font-style: italic;
}
.post-body code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    background: var(--bg-elev);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--rule);
}
.post-body pre {
    background: var(--bg-elev);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 16px 18px;
    overflow-x: auto;
    margin: 1.4em 0;
    font-size: 14px;
    line-height: 1.55;
}
.post-body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}
.post-body hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 2.4em 0;
}
.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.2em 0;
}
.post-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.4em 0;
    font-size: 14px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.post-body th, .post-body td {
    border-bottom: 1px solid var(--rule);
    padding: 8px 12px;
    text-align: left;
}
.post-body th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.post-footer {
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--rule);
}

.muted { color: var(--text-muted); font-style: italic; }

/* Mobile: tighten heading sizes */
@media (max-width: 520px) {
    :root { --gutter: 20px; }
    .lede { font-size: 19px; }
    .entry-link { padding: 22px 0 26px; }
    .entry-title { font-size: 24px; }
    .entry-excerpt { font-size: 15px; }
    .post-title { font-size: 32px; line-height: 1.18; }
    .post-lede { font-size: 17px; }
    .post-body { font-size: 16px; line-height: 1.68; }
    .post-body h2 { font-size: 22px; }
    .post-body h3 { font-size: 19px; }
    .writing-wrap, .post-wrap { padding-top: 36px; }
    .writing-header { margin-bottom: 40px; }
}


/* ====== Image size + alignment classes (public rendering) ====== */
.post-body img.img-small  { max-width: 35%; }
.post-body img.img-medium { max-width: 55%; }
.post-body img.img-large  { max-width: 80%; }
.post-body img.img-full   { max-width: 100%; }

.post-body img.img-center { display: block; margin: 1.6em auto; clear: both; float: none; }
.post-body img.img-left   { float: left;  margin: 0.3em 1.6em 1em 0; clear: left; max-width: 50%; }
.post-body img.img-right  { float: right; margin: 0.3em 0 1em 1.6em; clear: right; max-width: 50%; }

/* Mobile: floats become full-width block (text wrap doesn't make sense on narrow screens) */
@media (max-width: 600px) {
    .post-body img.img-left,
    .post-body img.img-right {
        float: none;
        display: block;
        margin: 1.2em auto;
        max-width: 100%;
    }
    .post-body img.img-small,
    .post-body img.img-medium { max-width: 100%; }
}

/* Clear floats before headings and at the end of the article */
.post-body h2, .post-body h3, .post-body h4 { clear: both; }
.post-body::after { content: ""; display: table; clear: both; }
