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

:root {
  color-scheme: light;
  --bg: #e8e4d8;
  --paper: #fbf7ec;
  --ink: #1d1a14;
  --muted: #6b655a;
  --faint: #d8d2c2;
  --rule: #c8c2b1;
  --accent: #1f5f2a;
  --accent-deep: #143d1b;
  --accent-soft: #e6efde;
  --serif: Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Courier New", monospace;
  --sans: system-ui, -apple-system, sans-serif;
  --measure: 62ch;
  --radius: 2px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #14110d;
    --paper: #1d1914;
    --ink: #e8e2d9;
    --muted: #b6ab97;
    --faint: #2c261f;
    --rule: #3e352b;
    --accent: #90cf98;
    --accent-deep: #b9e7bf;
    --accent-soft: #223326;
  }
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection { background: color-mix(in oklab, var(--accent) 25%, transparent); }

/* ----------------------------------------------------------
   Shell
   ---------------------------------------------------------- */
.shell {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 28px 64px;
  display: flex;
  flex-direction: column;
}

/* ----------------------------------------------------------
   Title bar (quiet rule chrome)
   ---------------------------------------------------------- */
.titlebar {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--muted);
  padding: 14px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  margin: 0 -28px 28px;
  padding-left: 28px;
  padding-right: 28px;
}
.titlebar .brand { color: var(--ink); }
.titlebar .brand b { color: var(--accent); font-weight: 500; }
.titlebar .brand a { color: inherit; text-decoration: none; }
.titlebar .meta { color: var(--muted); }
.titlebar nav {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}
.titlebar nav a { color: var(--muted); text-decoration: none; }
.titlebar nav a:hover { color: var(--accent); }

/* ----------------------------------------------------------
   Masthead (index only)
   ---------------------------------------------------------- */
.masthead {
  padding: 20px 0 36px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 40px;
}
.masthead .masthead-intro {
  display: flex;
  align-items: center;
  gap: 18px;
}
.masthead .profile-photo {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent);
  background: color-mix(in oklab, var(--paper) 92%, var(--accent));
  flex-shrink: 0;
}
.masthead .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.masthead .eyebrow::before,
.masthead .eyebrow::after {
  content: "";
  flex: 0 0 14px;
  height: 1px;
  background: var(--rule);
}
.masthead .eyebrow::after { flex: 1; }
.masthead h1 {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: normal;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 10px;
}
.masthead h1 em {
  color: var(--accent);
  font-style: italic;
}
.masthead .tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--muted);
  max-width: 52ch;
}

/* ----------------------------------------------------------
   Section label
   ---------------------------------------------------------- */
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

/* ----------------------------------------------------------
   Post list (excerpts layout)
   ---------------------------------------------------------- */
.post-list { list-style: none; padding: 0; }
.post-list li {
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 28px;
}
.post-list li:last-child { border-bottom: 0; }
.post-list .date {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--muted);
  padding-top: 7px;
  white-space: nowrap;
}
.post-list .title-line {
  font-size: 22px;
  font-weight: normal;
  line-height: 1.25;
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.post-list .title-line a { color: var(--ink); text-decoration: none; }
.post-list .title-line a:hover { color: var(--accent); }
.post-list .excerpt {
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.55;
  max-width: 58ch;
}
.post-list .excerpt a { color: var(--muted); text-decoration: none; }
.post-list .excerpt a:hover { color: var(--accent); }

/* ----------------------------------------------------------
   Index footer
   ---------------------------------------------------------- */
.index-foot {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.index-foot a { color: var(--muted); text-decoration: none; }
.index-foot a:hover { color: var(--accent); }
.rss-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.rss-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   Post header
   ---------------------------------------------------------- */
.post-header {
  padding: 12px 0 28px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 36px;
}
.post-header .back,
.post-foot .return-index a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  display: inline-block;
  text-decoration: none;
}
.post-header .back { margin-bottom: 22px; }
.post-header .back:hover,
.post-foot .return-index a:hover { color: var(--accent); }
.post-header h1 {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: normal;
  line-height: 1.1;
  letter-spacing: -0.012em;
  margin-bottom: 14px;
  text-wrap: balance;
}
.post-meta {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.post-meta a { color: var(--muted); text-decoration: underline; text-underline-offset: .12em; }
.post-meta a:hover { color: var(--accent); }

/* ----------------------------------------------------------
   Post body
   ---------------------------------------------------------- */
.post-body { max-width: var(--measure); }
.post-body > * + * { margin-top: 1.1em; }
.post-body p { font-size: 19px; line-height: 1.7; color: var(--ink); }
.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .11em;
}
.post-body a:hover { color: var(--accent-deep); }
.post-body h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: normal;
  letter-spacing: -0.005em;
  margin-top: 2em;
  margin-bottom: .3em;
  color: var(--ink);
}
.post-body h2::before { content: "§ "; color: var(--accent); }
.post-body h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: normal;
  letter-spacing: -0.003em;
  margin-top: 1.6em;
  margin-bottom: .2em;
  color: var(--ink);
}
.post-body h4 {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1.8em;
  margin-bottom: .2em;
}
.post-body ul,
.post-body ol {
  margin-left: 1.2em;
  padding-left: .2em;
}
.post-body li + li { margin-top: .45em; }
.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 20px;
  font-style: italic;
  color: var(--muted);
  margin-left: 4px;
}
.post-body figure {
  margin: 1.8em 0;
  display: grid;
  gap: .6em;
}
.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  background: color-mix(in oklab, var(--paper) 90%, white);
}
.post-body figure img { margin: 0; }
.post-body figcaption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.post-body code {
  font-family: var(--mono);
  font-size: .88em;
  padding: 1px 6px;
  background: var(--faint);
  border-radius: var(--radius);
  color: var(--ink);
}
.post-body pre {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  padding: 18px 20px;
  background: color-mix(in oklab, var(--ink) 6%, var(--paper));
  border-left: 2px solid var(--accent);
  overflow-x: auto;
  color: var(--ink);
}
.post-body pre code { background: transparent; padding: 0; font-size: inherit; }
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.45;
  border: 1px solid var(--rule);
  background: color-mix(in oklab, var(--paper) 92%, white);
}
.post-body th,
.post-body td {
  border: 1px solid var(--rule);
  padding: 8px 10px;
  vertical-align: top;
}
.post-body th {
  background: var(--accent-soft);
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
.post-body td:first-child {
  background: var(--accent-soft);
}
.post-body hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 2.4em auto;
  width: 140px;
}

/* Drop cap on first paragraph */
.post-body > p:first-of-type::first-letter {
  font-family: var(--serif);
  font-size: 3.4em;
  line-height: 0.88;
  float: left;
  padding: .08em .08em 0 0;
  color: var(--accent);
}

/* ----------------------------------------------------------
   Post footer
   ---------------------------------------------------------- */
.post-foot {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 28px;
}
.post-foot .pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  font-family: var(--mono);
  font-size: 12px;
}
.post-foot .pager a {
  display: block;
  color: var(--muted);
  text-decoration: none;
}
.post-foot .pager .label {
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 10.5px;
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}
.post-foot .pager .title {
  color: var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
}
.post-foot .pager a:hover .title { color: var(--accent); }
.post-foot .pager .next { text-align: right; }
.post-foot .return-index {
  text-align: center;
}
.post-foot .colophon {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px dashed var(--rule);
}
.post-foot .colophon a { color: var(--muted); text-decoration: none; }
.post-foot .colophon a:hover { color: var(--accent); }

/* ----------------------------------------------------------
   Small screens
   ---------------------------------------------------------- */
@media (max-width: 640px) {
  .shell { padding: 0 20px 48px; }
  .titlebar { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }
  .masthead .masthead-intro { gap: 14px; }
  .masthead .profile-photo {
    width: 62px;
    height: 62px;
  }
  .masthead h1 { font-size: 30px; }
  .post-header h1 { font-size: 28px; }
  .post-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .post-list li { grid-template-columns: 1fr; gap: 4px; }
  .post-list .date { padding-top: 0; }
  .post-foot .pager { grid-template-columns: 1fr; }
  .post-foot .pager .next { text-align: left; }
}
