:root {
  --bg: #fbf8f4;
  --surface: #ffffff;
  --text: #2a2420;
  --muted: #6f655d;
  --border: #e6ded5;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1714; --surface: #252019; --text: #efe8e0; --muted: #b0a498; --border: #3a322a;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1714; --surface: #252019; --text: #efe8e0; --muted: #b0a498; --border: #3a322a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1.0625rem/1.7 var(--sans);
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, iframe { max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; top: 8px; }

/* header */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { font: 700 1.35rem var(--serif); color: var(--text); text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: 0.95rem; }
.site-header nav a { color: var(--text); text-decoration: none; }
.site-header nav a:hover { color: var(--accent); }
.icon-btn, .link-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.icon-btn { font-size: 1.2rem; padding: 2px 6px; }
.link-btn { color: var(--accent); text-decoration: underline; padding: 0; }

main { padding-top: 32px; padding-bottom: 48px; min-height: 60vh; }
.hero { padding: 28px 0 16px; max-width: 720px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 8px; }
.lede { font-size: 1.2rem; color: var(--muted); margin: 0 0 12px; font-family: var(--serif); }
.section-title { margin-top: 32px; }
.meta { color: var(--muted); font-size: 0.875rem; margin: 0 0 6px; }

/* cards */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card-img img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card-body { padding: 16px 18px 18px; }
.card h2 { font-size: 1.25rem; margin: 0 0 8px; }
.card h2 a { color: var(--text); text-decoration: none; }
.card h2 a:hover { color: var(--accent); }
.card p { margin: 0 0 10px; }
.more { margin-top: 24px; }

/* tags */
.tags, .tag-cloud { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags a, .tag-cloud a { display: inline-block; font-size: 0.8rem; padding: 2px 10px; border: 1px solid var(--border); border-radius: 99px; text-decoration: none; color: var(--muted); }
.tags a:hover, .tag-cloud a:hover { color: var(--accent); border-color: var(--accent); }
.tag-cloud a { font-size: 1rem; padding: 4px 14px; }
.tag-cloud span { opacity: 0.6; }

/* posts */
.post { max-width: 720px; margin: 0 auto; }
.post-header h1 { font-size: clamp(1.9rem, 5vw, 2.7rem); margin: 0 0 10px; }
.post-img { width: 100%; border-radius: var(--radius); margin: 8px 0 8px; }
.prose { font-family: var(--serif); font-size: 1.15rem; line-height: 1.8; }
.prose h2 { margin-top: 2em; }
.prose blockquote { margin: 1.5em 0; padding: 0 0 0 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose pre { background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; overflow-x: auto; border-radius: 8px; font-size: 0.9rem; }
.prose code { font-size: 0.9em; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 0.95rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.embed { position: relative; aspect-ratio: 16 / 9; margin: 1.6em 0; }
.embed-map { aspect-ratio: 4 / 3; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }
.post-nav { display: flex; justify-content: space-between; gap: 16px; max-width: 720px; margin: 40px auto 0; font-family: var(--serif); }
.post-nav a { text-decoration: none; max-width: 48%; }
.post-nav span { display: block; font: 0.8rem var(--sans); color: var(--muted); }
.post-nav .next { text-align: right; margin-left: auto; }
.archive { list-style: none; padding: 0; }
.archive li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.archive time { color: var(--muted); font-size: 0.9rem; display: inline-block; min-width: 150px; }

/* newsletter, comments, ads, forms */
.newsletter, .comments { max-width: 720px; margin: 40px auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.newsletter h2, .comments h2 { margin-top: 0; font-size: 1.3rem; }
.newsletter form { display: flex; flex-wrap: wrap; gap: 8px; }
.newsletter input[type="email"] { flex: 1 1 220px; }
.fine { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }
.hp { position: absolute; left: -5000px; }
input, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; }
.newsletter input[type="text"] { width: auto; }
.contact label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: 0.95rem; }
.contact .btn { margin-top: 16px; }
.form-status { margin-top: 12px; }
.notice { padding: 12px 16px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 8px; padding: 10px 18px; font: 600 0.95rem var(--sans); cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.ad { margin: 32px auto; max-width: 720px; text-align: center; min-height: 20px; }
.ad-label { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* footer & consent */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: 0.9rem; }
.site-footer p { margin: 4px 0; }
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; max-width: 640px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 50; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; font-size: 0.9rem; }
.consent p { margin: 0; flex: 1 1 260px; }

/* pagefind theming */
#search { --pagefind-ui-primary: var(--accent); --pagefind-ui-text: var(--text); --pagefind-ui-background: var(--surface); --pagefind-ui-border: var(--border); --pagefind-ui-font: var(--sans); }

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .prose { font-size: 1.08rem; }
  .archive time { display: block; }
}
