:root {
  --bg: #fbfaf7;
  --text: #1f1f1d;
  --soft: #4d4c49;
  --muted: #6b6a66;
  --faint: #e6e3dc;
  --accent: #8a4b2a;
  --card: #ffffff;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --text: #e8e6e1;
    --soft: #bdbab3;
    --muted: #9a978f;
    --faint: #2c2b29;
    --accent: #d9956b;
    --card: #1d1d1b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
}

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 20px; }

section { padding: 40px 0; border-top: 1px solid var(--faint); }
section:first-of-type { border-top: 0; }
h2 {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin: 0 0 20px;
}

h1 { font-size: 30px; line-height: 1.2; margin: 4px 0 12px; font-weight: 500; }
.intro { padding-top: 24px; }
.intro p { margin: 0 0 12px; }

/* Bio: portrait above the text, shrinking to fit narrow screens */
.bio { display: flex; flex-direction: column; align-items: flex-start; gap: 28px; }
.bio p:first-child { margin-top: 0; }
.avatar {
  flex: none; width: min(288px, 100%); height: auto; aspect-ratio: 1;
  border-radius: 50%; object-fit: cover;
  background: var(--faint);
}

/* Home: filter badges */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 40px 0 24px;
}
.badge {
  padding: 5px 14px; border: 1px solid var(--faint); border-radius: 999px;
  background: none; color: var(--muted); cursor: pointer;
  font-family: var(--sans); font-size: 14px; line-height: 1.4; text-decoration: none;
}
.badge:hover { color: var(--text); border-color: var(--muted); }
.badge[aria-pressed="true"], .badge[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.badge.about { margin-left: auto; }

/* Home: entries */
#entries { padding-top: 0; }
.entry + .entry { border-top: 2px solid var(--faint); }
.entry > a, .entry > .row {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 24px 0; text-decoration: none;
}
.entry h2 {
  font-family: var(--sans); font-size: 22px; font-weight: 500; line-height: 1.3;
  text-transform: none; letter-spacing: 0; color: inherit;
  margin: 0 0 6px;
}
.entry p { margin: 0 0 10px; color: var(--muted); font-size: 17px; line-height: 1.45; }
.entry .meta { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.entry .thumb {
  flex: none; width: 140px; height: 140px; object-fit: cover;
  border-radius: 8px; background: var(--faint);
}
/* Links carry their text in the entry itself, set small and tight like a tweet */
.entry[data-kind="link"] p { color: var(--soft); font-size: 16px; line-height: 1.45; margin: 0 0 6px; }
/* Links sit in a rounded card, like a post embedded from X, to set them apart from the blog's own posts */
.entry[data-kind="link"] { padding: 24px 0; }
.entry[data-kind="link"] > a, .entry[data-kind="link"] > .row {
  padding: 14px 16px; background: var(--card);
  border: 1px solid var(--faint); border-radius: 14px;
}
.entry[data-kind="link"] > a:hover { border-color: var(--muted); }
.entry[data-kind="link"] .thumb { width: 112px; height: 112px; }
@media (max-width: 480px) {
  .badge { padding: 5px 11px; }
  .entry > a, .entry > .row { gap: 16px; }
  .entry .thumb { width: 100px; height: 100px; }
  .entry[data-kind="link"] > a, .entry[data-kind="link"] > .row { padding: 12px; gap: 12px; }
  .entry[data-kind="link"] .thumb { width: 80px; height: 80px; }
}
.empty { margin: 24px 0 0; color: var(--muted); }

/* Post page */
.post { padding: 0 0 40px; }
.post .thumb {
  display: block; width: 100%; height: auto; margin-bottom: 24px;
  border-radius: 8px; background: var(--faint);
}
.post .meta {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  margin-bottom: 20px;
}
.post h1 { font-weight: 400; }
.post p { margin: 0 0 16px; font-weight: 300; }
.post p:last-child { margin-bottom: 0; }

/* Contact */
.elsewhere { display: flex; gap: 20px; flex-wrap: wrap; font-family: var(--sans); font-size: 15px; }

/* Post: lists, references and notes */
.post ul { margin: 0 0 16px; padding-left: 22px; font-weight: 300; }
.post li { margin-bottom: 8px; }
.post strong { font-weight: 600; }
.post .label { font-weight: 600; margin-bottom: 8px; }
.post h2 {
  font-size: 20px; font-weight: 600; line-height: 1.3;
  text-transform: none; letter-spacing: 0; color: var(--text);
  margin: 32px 0 12px;
}
.ref { color: var(--accent); text-decoration: none; white-space: nowrap; }
.ref:hover { text-decoration: underline; }

.notes { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--faint); }
.notes h2 {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0 0 20px;
}
.post .note {
  display: grid; grid-template-columns: 2.8em 1fr; gap: 0 4px;
  margin: 0 -8px 4px; padding: 4px 8px; border-radius: 6px;
  font-size: 14px; line-height: 1.5; color: var(--soft); font-weight: 400;
  overflow-wrap: anywhere; scroll-margin-top: 24px;
}
.note .num { color: var(--muted); }
.note:target { background: var(--faint); }
.note:target .num { color: var(--accent); font-weight: 600; }

.pop {
  position: absolute; z-index: 10; width: max-content; max-width: min(420px, calc(100vw - 16px));
  padding: 10px 14px; background: var(--card); color: var(--soft);
  border: 1px solid var(--faint); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .14);
  font-size: 14px; line-height: 1.5; font-weight: 400; overflow-wrap: anywhere;
}
.pop .num { color: var(--accent); font-weight: 600; }
