:root {
  --fg: #1a1a1a;
  --muted: #6a6a6a;
  --faint: #999;
  --bg: #fafaf7;
  --rule: #d8d4cc;
  --link-underline: rgba(26, 26, 26, 0.35);
  --code-bg: #ede9e0;
  --accent: #9a1f2e;
  --accent-soft: rgba(154, 31, 46, 0.55);
  --max: 40rem;
  --max-wide: 48rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e6e1;
    --muted: #9a958b;
    --faint: #6a655c;
    --bg: #14130f;
    --rule: #2c2a25;
    --link-underline: rgba(232, 230, 225, 0.35);
    --code-bg: #1f1d18;
    --accent: #d97681;
    --accent-soft: rgba(217, 118, 129, 0.5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Charter, "Iowan Old Style", "Palatino Linotype", Palatino,
               "Book Antiqua", Georgia, serif;
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.12s ease;
}
a:hover {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

/* ---------- masthead ---------- */

.site-header {
  padding: 3.25rem 0 1.75rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.75rem;
}

.site-title {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}
.site-title a {
  color: var(--fg);
  text-decoration: none;
}
.site-title a:hover { text-decoration: none; }
.site-title::after {
  content: '';
  display: block;
  width: 3.25rem;
  height: 4px;
  background: var(--accent);
  margin-top: 0.7rem;
}

/* ---------- post list (headlines-only) ---------- */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-summary {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 1.25rem;
}
.post-summary:last-child { border-bottom: none; }

.post-summary .post-title {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.35;
}
.post-summary .post-title a {
  color: var(--fg);
  text-decoration: none;
}
.post-summary .post-title a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-summary .post-meta {
  color: var(--faint);
  font-size: 0.85rem;
  font-style: italic;
  margin: 0;
  white-space: nowrap;
  font-feature-settings: "tnum";
}

/* ---------- pagination ---------- */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0;
  margin-top: 1.5rem;
  font-size: 0.95rem;
}
.pagination a {
  text-decoration: none;
  color: var(--fg);
}
.pagination a:hover { text-decoration: underline; }
.pagination .older { margin-right: auto; }
.pagination .newer { margin-left: auto; }

/* ---------- single post ---------- */

article.post .post-header {
  margin: 0 0 2.25rem;
}
article.post .post-title {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
}
article.post .post-meta {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  margin: 0;
}
article.post .post-body {
  font-size: 1.075rem;
  line-height: 1.7;
}
article.post .post-body p { margin: 0 0 1.3rem; }
article.post .post-body > p:first-child::first-letter {
  float: left;
  font-size: 3.6em;
  line-height: 0.88;
  font-weight: 800;
  padding: 0.05em 0.08em 0 0;
  color: var(--accent);
  font-feature-settings: "ss01";
}
article.post .post-body h2 {
  margin: 2.25rem 0 0.6rem;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
article.post .post-body h3 {
  margin: 1.75rem 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
}
article.post .post-body img,
article.post .post-body figure,
article.post .post-body iframe {
  max-width: 100%;
  height: auto;
}
article.post .post-body .video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 2rem 0;
}
article.post .post-body .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
article.post .post-body .tweet-link {
  margin: 1.5rem 0;
  padding: 0.85rem 1rem;
  border-left: 2px solid var(--rule);
  font-size: 0.95rem;
}
article.post .post-body .tweet-link a {
  text-decoration: none;
  color: var(--fg);
}
article.post .post-body .tweet-link a:hover { text-decoration: underline; }
article.post .post-body figure {
  margin: 1.75rem 0;
  text-align: center;
}
article.post .post-body figcaption {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.5rem;
  font-style: italic;
}
article.post .post-body blockquote {
  margin: 1.5rem 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}
article.post .post-body pre,
article.post .post-body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  border-radius: 3px;
}
article.post .post-body code { padding: 0.1em 0.32em; }
article.post .post-body pre {
  padding: 0.85rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
}
article.post .post-body ul,
article.post .post-body ol {
  padding-left: 1.4rem;
  margin: 0 0 1.3rem;
}
article.post .post-body li { margin-bottom: 0.35rem; }
article.post .post-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

.back {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}
.back a { text-decoration: none; color: var(--fg); }
.back a:hover { text-decoration: underline; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer a {
  text-decoration: none;
  color: var(--muted);
}
.site-footer a:hover { text-decoration: underline; }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  html, body { font-size: 17px; }
  .site-header { padding: 1.75rem 0 1.25rem; margin-bottom: 1.75rem; }
  .site-title { font-size: 2rem; }
  article.post .post-title { font-size: 1.7rem; }
  .post-summary {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    padding: 1rem 0;
  }
  .post-summary .post-meta { font-size: 0.82rem; }
}
