:root {
  --bg: #fff;
  --text: #242424;
  --text-soft: #444;
  --text-mute: #707070;
  --line: #e8e8e8;
  --accent: #167347;
  --code-bg: #f6f6f6;
  --code-border: #e8e8e8;
  --link-underline: #a6c7b4;
  --selection: #d9eddf;
  --badge-bg: #eef5f0;
  --sidebar: 140px; /* left nav column */
  --gutter: 56px;   /* space between nav and content */
  --content: 680px; /* content column, the same on every page (~72 characters per line) */
  --frame: calc(var(--sidebar) + var(--gutter) + var(--content));
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --text: #e8e8e8;
    --text-soft: #c4c4c4;
    --text-mute: #8f8f8f;
    --line: #2c2c2c;
    --accent: #6cc597;
    --code-bg: #1e1e1e;
    --code-border: #2c2c2c;
    --link-underline: #3f6b53;
    --selection: #2b4a39;
    --badge-bg: #1f2d25;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100vh; font-family: var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 2px; }
::selection { background: var(--selection); color: var(--text); }
.skip-link { position: absolute; top: -80px; left: 20px; padding: 12px 18px; background: var(--bg); color: var(--accent); border: 1px solid var(--accent); z-index: 10; }
.skip-link:focus { top: 12px; }
.shell { width: min(var(--frame), calc(100% - 48px)); margin: 0 auto; padding: 56px 0 32px; }
.site-header { width: 100%; margin-bottom: 48px; }
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: var(--gutter); align-items: start; }
.sidebar { position: sticky; top: 32px; }
.profile { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.profile-name { font-size: 1.75rem; font-weight: 500; letter-spacing: -.025em; transition: color .15s ease; }
.profile-name:hover { color: var(--accent); }
.profile-role { margin-top: 6px; font-size: .875rem; color: var(--text-mute); }
.profile-social { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 12px; list-style: none; }
.profile-social-link { font-size: .8125rem; color: var(--text-mute); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .25em; transition: color .15s ease, text-decoration-color .15s ease; }
.profile-social-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.main-column, .content { min-width: 0; }
.site-nav { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.nav-link { display: inline-flex; padding: 6px 0; font-size: .9375rem; line-height: 1.4; color: var(--text-mute); }
.nav-link:hover, .footer-link:hover { color: var(--accent); }
.nav-link.active { color: var(--text); text-decoration: underline; text-underline-offset: .3em; text-decoration-thickness: 1px; }
.feed-header { margin-bottom: 8px; }
.feed-header .section-heading { margin-bottom: 0; font-size: .875rem; font-weight: 400; letter-spacing: 0; color: var(--text-mute); }
.eyebrow { margin-bottom: 12px; font-size: .875rem; line-height: 1.5; font-weight: 400; color: var(--text-mute); }
.title, .post-title, .about-title, .section-heading { font-family: var(--sans); font-weight: 500; font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.25; letter-spacing: -.025em; text-wrap: balance; overflow-wrap: break-word; }
.subtitle { max-width: 36rem; margin: 16px 0 0; font-size: 1.0625rem; line-height: 1.75; color: var(--text-soft); }
.inline-link, .prose a, .post-content a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--link-underline); text-underline-offset: .22em; text-decoration-thickness: 1px; transition: text-decoration-color .15s ease; }
.inline-link:hover, .prose a:hover, .post-content a:hover { text-decoration-color: currentColor; }
.row-list { list-style: none; }
.row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: baseline; padding: 10px 0; }
.row-title { font-family: var(--sans); font-size: 1.0625rem; line-height: 1.5; font-weight: 400; transition: color .15s ease; }
.row-link:hover .row-title { color: var(--accent); }
.row-meta { display: inline-flex; gap: 14px; font-size: .8125rem; line-height: 1.5; color: var(--text-mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.masthead, .post-header { margin-bottom: 32px; }
.section-heading { margin-bottom: 32px; }
.title { max-width: 22ch; }
.home-header { container-type: inline-size; }
.home-title { max-width: none; font-size: min(2.25rem, 5.4cqi); white-space: nowrap; text-wrap: nowrap; }
.prose, .post-content { font-family: var(--sans); font-size: 1.125rem; line-height: 1.8; color: var(--text-soft); overflow-wrap: break-word; }
.prose p + p { margin-top: 1.2em; }
/* Justified body text; hyphenation keeps word spacing even, especially on narrow screens. */
.prose p, .prose li, .post-content p, .post-content li, .about-intro { text-align: justify; hyphens: auto; -webkit-hyphens: auto; text-wrap: pretty; }
.prose strong, .post-content strong { color: var(--text); font-weight: 600; }
.prose h2, .post-content h2, .post-content h3 { margin: 1.9em 0 .6em; font-family: var(--sans); font-size: 1.3rem; font-weight: 600; line-height: 1.4; letter-spacing: -.025em; color: var(--text); text-wrap: balance; overflow-wrap: break-word; }
.post-content h3 { font-size: 1.1rem; }
.prose blockquote, .post-content blockquote { margin: 1.5em 0; padding: 4px 0 4px 24px; border-left: 2px solid var(--line); color: var(--text); }
.post-title { max-width: 32ch; }
.post-meta, .meta-strip { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 16px; font-family: var(--sans); font-size: .8125rem; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.post-article { min-width: 0; }
.post-content > :first-child { margin-top: 0; }
.post-content p, .post-content ul, .post-content ol, .post-content pre, .post-content table, .post-content hr { margin-bottom: 1.3em; }
.post-content ul, .post-content ol { padding-left: 1.3em; }
.post-content li + li { margin-top: .4em; }
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content a { overflow-wrap: anywhere; }
.post-content code { font-family: "JetBrains Mono", monospace; font-size: .8em; background: var(--code-bg); border: 1px solid var(--code-border); padding: .12em .3em; border-radius: 3px; color: var(--text); }
.post-content pre { max-width: 100%; overflow-x: auto; padding: 22px; background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 5px; font-size: .95rem; line-height: 1.65; }
.post-content pre code { background: transparent; border: 0; padding: 0; border-radius: 0; white-space: pre; font-size: inherit; }
.post-content img { max-width: 100%; height: auto; margin: 1.5em 0; }
.post-content hr { border: 0; border-top: 1px solid var(--line); }
.post-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; white-space: nowrap; }
.post-content th, .post-content td { padding: 12px 16px; border: 1px solid var(--line); text-align: left; font-family: var(--sans); font-size: .875rem; }
.post-content th { background: var(--code-bg); color: var(--text); }
.about-header { margin-bottom: 36px; }
.about-title { max-width: 28ch; }
.about-intro { margin-top: 20px; font-size: 1.125rem; line-height: 1.8; color: var(--text-soft); }
.about-section { padding: 24px 0; }
.prose ul { padding-left: 1.2em; margin: 1.2em 0; }
.prose li + li { margin-top: .6em; }
.prose ul:first-child { margin-top: 0; }
.about-section > h2 { margin-bottom: 16px; font-size: 1rem; line-height: 1.6; font-weight: 500; color: var(--text); }
.about-section .prose h3 { margin: 2em 0 .6em; font-size: 1.125rem; font-weight: 500; line-height: 1.5; color: var(--text); }
.about-principles { color: var(--text); font-size: 1.125rem; line-height: 1.8; }
.content-footer, .post-footer { margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 24px; align-items: center; font-size: .8125rem; line-height: 1.6; color: var(--text-mute); }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-link { padding: 5px 0; transition: color .15s ease; }
.empty { padding: 24px 0; color: var(--text-soft); font-size: 1rem; }

/* Listing: filters, year groups, featured */
.label-heading { margin-bottom: 0; font-size: .875rem; font-weight: 400; letter-spacing: 0; color: var(--text-mute); }
.listing-header { margin-bottom: 28px; }
.listing-header .section-heading { margin-bottom: 0; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 8px; }
.topic { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .8125rem; line-height: 1.5; color: var(--text-mute); transition: color .15s ease, border-color .15s ease; }
.topic:hover { color: var(--accent); border-color: var(--accent); }
.topic.active { color: var(--text); border-color: var(--text); }
.year-group { margin-top: 28px; }
.year-heading { padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: .8125rem; font-weight: 500; letter-spacing: .02em; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.row-topic { color: var(--text-mute); }
.badge { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 4px; background: var(--badge-bg); color: var(--accent); font-size: .6875rem; font-weight: 500; line-height: 1.6; letter-spacing: .03em; text-transform: uppercase; vertical-align: .15em; }

/* Post */
.post-kicker { min-height: 1.5em; margin-bottom: 12px; font-size: .875rem; line-height: 1.5; color: var(--text-mute); }
.post-kicker a:hover { color: var(--accent); }
.post-series { margin-top: 12px; font-size: .875rem; color: var(--text-mute); }
.post-series a { color: var(--accent); }
.post-content :is(h2, h3, h4) { position: relative; scroll-margin-top: 24px; }
.heading-anchor { position: absolute; left: -1.1em; width: 1.1em; color: var(--text-mute); font-weight: 400; text-decoration: none !important; opacity: 0; transition: opacity .15s ease; }
.post-content :is(h2, h3, h4):hover .heading-anchor, .heading-anchor:focus { opacity: 1; }
.toc { margin: 0 0 36px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 6px; font-size: .9375rem; line-height: 1.6; }
.toc-title { margin-bottom: 8px; font-size: .8125rem; color: var(--text-mute); }
.toc ol { padding-left: 1.2em; color: var(--text-mute); }
.toc li + li { margin-top: 4px; }
.toc a { color: var(--text-soft); }
.toc a:hover { color: var(--accent); }
.post-content mark { background: var(--selection); color: var(--text); padding: 0 .15em; }
.post-content figure { margin: 1.5em 0; }
.post-content figcaption { margin-top: -.8em; font-size: .875rem; color: var(--text-mute); text-align: center; }
.post-content .footnotes { margin-top: 3em; padding-top: 1em; border-top: 1px solid var(--line); font-size: .9375rem; }
.post-end { margin-top: 56px; display: grid; gap: 36px; }
.end-heading { margin-bottom: 10px; font-size: .875rem; font-weight: 500; color: var(--text); }
.series-box { padding: 18px 20px; border: 1px solid var(--line); border-radius: 6px; }
.series-list { padding-left: 1.3em; font-size: .9375rem; line-height: 1.6; color: var(--text-mute); }
.series-list li + li { margin-top: 4px; }
.series-list a { color: var(--text-soft); }
.series-list a:hover { color: var(--accent); }
.series-list [aria-current] { color: var(--text); font-weight: 500; }
.related-list { list-style: none; }
.related-list li { display: flex; justify-content: space-between; gap: 24px; padding: 6px 0; font-size: .9375rem; line-height: 1.5; }
.related-list a:hover { color: var(--accent); }
.related-list time { flex: none; font-size: .8125rem; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager-link { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; transition: border-color .15s ease; }
.pager-link:hover { border-color: var(--accent); }
.pager-next { text-align: right; }
.pager-label { display: block; font-size: .75rem; color: var(--text-mute); }
.pager-title { display: block; margin-top: 2px; font-size: .9375rem; line-height: 1.45; }
.subscribe { font-size: .875rem; color: var(--text-mute); }
.subscribe a { color: var(--accent); }

/* Projects & about */
/* Home: featured projects */
.home-projects { margin-bottom: 20px; }
.featured-projects { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.featured-project-link { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; transition: border-color .15s ease; }
.featured-project-link:hover { border-color: var(--accent); }
.featured-project-name { display: flex; align-items: center; font-size: 1.0625rem; font-weight: 500; transition: color .15s ease; }
.featured-project-link:hover .featured-project-name { color: var(--accent); }
.featured-project-tagline { font-size: .875rem; line-height: 1.5; color: var(--text-soft); }

@media (max-width: 600px) {
  .shell { width: calc(100% - 40px); padding-top: 28px; }
  .site-header { margin-bottom: 24px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .sidebar { position: static; }
  .site-nav { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 24px; }
  .row-link { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 10px 0; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
  .heading-anchor { display: none; }
  .content-footer { margin-top: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* Home: writing list */
.home-writing { margin-top: 36px; }
.writing-list .row-item { border-bottom: 1px solid var(--line); }
