:root {
  --bg: #faf7f1;
  --surface: #ffffff;
  --ink: #1e1b17;
  --muted: #6d665c;
  --line: #e6dfd3;
  --accent: #8c2f1f;
  --accent-soft: #f4e6e0;
  --shadow: 0 1px 2px rgba(30, 27, 23, .05), 0 6px 20px rgba(30, 27, 23, .06);
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  --wrap: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151311; --surface: #1d1a17; --ink: #ece6dc; --muted: #a39b8f;
    --line: #2f2a25; --accent: #e3907a; --accent-soft: #2f201b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151311; --surface: #1d1a17; --ink: #ece6dc; --muted: #a39b8f;
  --line: #2f2a25; --accent: #e3907a; --accent-soft: #2f201b;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
.masthead { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.masthead__top { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--bg); font-family: var(--serif); font-weight: 700; font-size: 19px;
}
.brand__name { font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: -.01em; }
.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--muted); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.nav { border-top: 1px solid var(--line); }
.nav__inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav__inner::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; padding: 11px 12px; font-size: 14px; font-weight: 500; color: var(--muted);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Shared */
.eyebrow { margin: 0 0 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.meta { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.tag {
  display: inline-block; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--accent);
  background: var(--accent-soft); padding: 2px 9px; border-radius: 999px;
}
.section { padding: 40px 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.section__title { font-family: var(--serif); font-size: 24px; margin: 0; }
.link-more { font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none; white-space: nowrap; }
.link-more:hover { text-decoration: underline; }

/* Hero */
.intro { padding: 44px 0 8px; }
.intro h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 46px); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.015em; }
.intro p { margin: 0; max-width: 60ch; font-size: 17px; color: var(--muted); }

.feature { display: grid; gap: 20px; padding: 28px 0 8px; text-decoration: none; }
@media (min-width: 820px) { .feature { grid-template-columns: 1.25fr 1fr; gap: 36px; align-items: center; } }
.feature .thumb { aspect-ratio: 16 / 10; }
.feature__title { font-family: var(--serif); font-size: clamp(24px, 3.4vw, 34px); line-height: 1.22; margin: 10px 0 12px; }
.feature:hover .feature__title { color: var(--accent); }
.feature__excerpt { color: var(--muted); font-size: 16.5px; margin: 0 0 14px; }

/* Cards */
.grid { display: grid; gap: 28px 24px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { display: flex; flex-direction: column; text-decoration: none; }
.card .thumb { aspect-ratio: 16 / 10; margin-bottom: 14px; }
.card__title { font-family: var(--serif); font-size: 19px; line-height: 1.3; margin: 8px 0 8px; }
.card:hover .card__title { color: var(--accent); }
.card__excerpt { margin: 0 0 10px; color: var(--muted); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.thumb { border-radius: var(--radius); overflow: hidden; background: var(--accent-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .thumb img, .feature:hover .thumb img { transform: scale(1.03); }
.thumb--empty { display: grid; place-items: center; padding: 16px; text-align: center; }
.thumb--empty span { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--accent); opacity: .85; }

/* Topics */
.topics { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .topics { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .topics { grid-template-columns: repeat(3, 1fr); } }
.topic {
  display: block; padding: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; transition: border-color .2s, box-shadow .2s;
}
.topic:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.topic h3 { font-family: var(--serif); font-size: 20px; margin: 0 0 4px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.topic h3 small { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--muted); }
.topic p { margin: 0; font-size: 14.5px; color: var(--muted); }

/* Page header */
.page { padding: 40px 16px 56px; }
.page__head { max-width: 760px; margin: 0 auto 28px; }
.page__title { font-family: var(--serif); font-size: clamp(28px, 4.4vw, 42px); line-height: 1.18; margin: 0 0 14px; letter-spacing: -.01em; }
.page__lead { color: var(--muted); font-size: 17px; margin: 0; }
.listing { padding: 40px 16px 56px; }
@media (min-width: 720px) { .page, .listing { padding-left: 28px; padding-right: 28px; } }
.listing .page__head { max-width: none; margin: 0 0 28px; }

/* Article */
.post__cover { max-width: 900px; margin: 0 auto 32px; }
.prose { max-width: 720px; margin: 0 auto; font-family: var(--serif); font-size: 18.5px; line-height: 1.78; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose dl { margin: 0 0 1.05em; }
.prose div:not(:has(div, p, ul, ol, table, h1, h2, h3, h4, blockquote)) { margin: 0 0 1.05em; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); line-height: 1.3; margin: 1.6em 0 .6em; }
.prose h1, .prose h2 { font-size: 1.45em; }
.prose h3 { font-size: 1.22em; }
.prose h4 { font-size: 1.08em; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose img { display: block; margin: 1.4em auto; border-radius: 8px; }
.prose a:has(img) { display: block; }
.prose blockquote { border-left: 3px solid var(--accent); padding: .2em 0 .2em 1.1em; color: var(--muted); font-style: italic; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .3em 0; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 15px; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.prose iframe { max-width: 100%; border: 0; border-radius: 8px; display: block; margin: 1.4em auto; }
.prose iframe.yt { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose svg { max-width: 100%; height: auto; }

.post__foot { max-width: 720px; margin: 40px auto 0; padding-top: 22px; border-top: 1px solid var(--line); }
.pager { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 24px; }
@media (min-width: 620px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.pager span { font-family: var(--serif); font-weight: 600; line-height: 1.35; }
.pager .next { text-align: right; }
.related { background: var(--surface); border-top: 1px solid var(--line); margin-top: 56px; }

/* Archive */
.tools { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }
.search {
  width: 100%; max-width: 480px; font: inherit; font-size: 16px; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.year { margin: 0 0 32px; }
.year h2 { font-family: var(--serif); font-size: 22px; margin: 0 0 6px; color: var(--accent); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { border-bottom: 1px solid var(--line); }
.row a { display: flex; gap: 16px; align-items: baseline; padding: 12px 0; text-decoration: none; }
.row time { flex: none; width: 92px; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row b { font-family: var(--serif); font-weight: 500; font-size: 17px; flex: 1; }
.row a:hover b { color: var(--accent); }
.row .tag { flex: none; }
@media (max-width: 560px) {
  .row a { flex-wrap: wrap; gap: 4px 10px; }
  .row time { width: auto; }
  .row b { flex-basis: 100%; order: 3; }
}
.empty { color: var(--muted); padding: 20px 0; }
[hidden] { display: none !important; }

/* Footer */
.footer { border-top: 1px solid var(--line); margin-top: 24px; padding: 32px 0 24px; font-size: 14px; color: var(--muted); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; }
.footer__brand { font-family: var(--serif); font-weight: 700; font-size: 18px; color: var(--ink); margin: 0 0 4px; }
.footer__tagline { margin: 0; max-width: 42ch; }
.footer__links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-content: flex-start; }
.footer__links a { text-decoration: none; }
.footer__links a:hover { color: var(--ink); }
.footer__copy { margin-top: 22px; font-size: 13px; }
