:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1d2a2a;
  --muted: #5d6b6a;
  --line: #e6e2da;
  --accent: #0f766e;
  --accent-ink: #0b5a54;
  --accent-soft: #e3f2ef;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121817;
    --surface: #182120;
    --ink: #e8eeec;
    --muted: #9db0ad;
    --line: #293533;
    --accent: #4fd1c0;
    --accent-ink: #7fe0d3;
    --accent-soft: #1d3330;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--font);
}
a { color: var(--accent-ink); }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand-sub { font-weight: 500; color: var(--muted); }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #34d399); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }

/* hero */
.hero { padding: 64px 0 40px; }
.hero h1 { font-family: var(--serif); font-size: clamp(34px, 5vw, 52px); line-height: 1.1; margin: 0 0 16px; letter-spacing: -0.02em; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; font-weight: 600; color: var(--accent-ink); margin: 0 0 12px; }
.lede { font-size: 20px; color: var(--muted); max-width: 640px; margin: 0; }

/* featured + cards */
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; margin-bottom: 48px; border-top: 4px solid var(--accent); }
.feature h2 { font-family: var(--serif); font-size: clamp(26px, 3.5vw, 36px); line-height: 1.2; margin: 0 0 14px; }
.feature h2 a, .card h2 a { color: var(--ink); text-decoration: none; }
.feature h2 a:hover, .card h2 a:hover { color: var(--accent-ink); }
.feature p { color: var(--muted); max-width: 720px; }
.button { display: inline-block; background: var(--accent); color: #fff; padding: 10px 20px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; }
.button:hover { background: var(--accent-ink); color: #fff; }
@media (prefers-color-scheme: dark) { .button, .button:hover { color: #0b1514; } }

.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 72px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h2 { font-size: 20px; line-height: 1.3; margin: 12px 0 10px; }
.card p { color: var(--muted); font-size: 15px; margin: 0 0 16px; flex: 1; }
.more { font-size: 14px; font-weight: 600; text-decoration: none; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.chip { background: var(--accent-soft); color: var(--accent-ink); padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; text-decoration: none; }

/* post */
.post-header { padding-top: 56px; padding-bottom: 28px; }
.post-header h1 { font-family: var(--serif); font-size: clamp(32px, 4.6vw, 46px); line-height: 1.15; margin: 16px 0; letter-spacing: -0.015em; }
.hero-img { margin: 0 0 40px; }
.hero-img img { border-radius: var(--radius); width: 100%; max-height: 520px; object-fit: cover; }
.prose { font-size: 18px; padding-bottom: 24px; }
.prose h2 { font-family: var(--serif); font-size: 30px; line-height: 1.25; margin: 2.2em 0 0.6em; letter-spacing: -0.01em; }
.prose h3 { font-size: 21px; margin: 1.8em 0 0.5em; }
.prose h4 { font-size: 18px; margin: 1.6em 0 0.4em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--accent); color: var(--muted); font-style: italic; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: 16px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--accent-soft); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose strong { color: var(--ink); }
.prose figure { margin: 1.6em 0; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1px solid var(--line); padding-top: 28px; margin-top: 16px; }
.post-nav a { text-decoration: none; color: var(--ink); font-weight: 600; line-height: 1.35; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.post-nav a:hover { border-color: var(--accent); }
.post-nav span { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.post-nav .next { text-align: right; }
.related { margin: 40px 0 80px; padding: 28px; background: var(--accent-soft); border-radius: var(--radius); }
.related h2 { margin: 0 0 12px; font-size: 18px; }
.related ul { list-style: none; margin: 0; padding: 0; }
.related li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; }
.related li:first-child { border-top: 0; }
.related a { font-weight: 600; text-decoration: none; }
.related time { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* homepage roll: full articles one after another */
.roll-entry { padding: 48px 0 24px; border-top: 1px solid var(--line); }
.hero + .roll .roll-entry:first-child { border-top: 0; padding-top: 8px; }
.roll-entry .prose h2 { font-size: 24px; margin-top: 1.8em; }
.roll-entry .prose h3 { font-size: 19px; }
.roll-entry header h2 { font-family: var(--serif); font-size: clamp(30px, 4.4vw, 42px); line-height: 1.2; margin: 14px 0 24px; letter-spacing: -0.015em; }
.roll-entry header h2 a { color: var(--ink); text-decoration: none; }
.roll-entry header h2 a:hover { color: var(--accent-ink); }
.roll-img img { border-radius: var(--radius); width: 100%; max-height: 420px; object-fit: cover; margin-bottom: 32px; }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 24px 20px 80px; border-top: 1px solid var(--line); }
.pagination a, .pagination span { min-width: 42px; padding: 8px 14px; border-radius: 999px; text-align: center; font-weight: 600; font-size: 15px; text-decoration: none; border: 1px solid var(--line); background: var(--surface); }
.pagination a:hover { border-color: var(--accent); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .pagination .current { color: #0b1514; } }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 40px 0 28px; font-size: 15px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-inner strong { color: var(--ink); }
.footer-inner p { margin: 6px 0 0; max-width: 460px; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--muted); }
.copyright { margin-top: 28px; font-size: 13px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand-sub { display: none; }
  .wrap { padding: 0 16px; }
  .hero { padding: 40px 0 28px; }
  .lede { font-size: 18px; }
  .feature { padding: 24px; }
  .grid { grid-template-columns: 1fr; }
  .prose { font-size: 17px; }
  .prose h2 { font-size: 25px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .related li { flex-direction: column; gap: 2px; }
}
