:root {
  --bg: #faf9f6;
  --fg: #1c1c1c;
  --muted: #6b6b6b;
  --soft: #efece6;
  --border: #e5e1d8;
  --card-bg: #ffffff;
  --accent: #b14315;
  --accent-soft: #fbeee5;
  --link: #b14315;
  --link-hover: #7c2f0e;
  --quote-bar: #d8581c;
  --code-bg: #f3efe8;
  --max-text: 1020px;
  --max-wide: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110f;
    --fg: #e8e5e0;
    --muted: #9c9994;
    --soft: #1b1815;
    --border: #2c2723;
    --card-bg: #1a1714;
    --accent: #ff7a3c;
    --accent-soft: #2a1a10;
    --link: #ff9966;
    --link-hover: #ffbb95;
    --quote-bar: #ff7a3c;
    --code-bg: #221d18;
  }
}
* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto,
               Helvetica, Arial, sans-serif;
  line-height: 1.65;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
}
.site-header .inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.95rem;
}
.site-header a.brand {
  font-weight: 700;
  color: var(--fg);
  font-size: 1.0rem;
  letter-spacing: 0.01em;
}
.site-header a.brand:hover { color: var(--accent); text-decoration: none; }
.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 18px;
}
.site-header nav a {
  color: var(--muted);
  font-size: 0.93rem;
}
.site-header nav a:hover { color: var(--accent); text-decoration: none; }

main { display: block; }
.container { max-width: var(--max-text); margin: 0 auto; padding: 40px 22px 80px; }
.container.wide { max-width: var(--max-wide); }

/* Intro / hero */
.intro h1 {
  font-family: "Iowan Old Style", "Apple Garamond", Georgia, "Cambria", serif;
  font-size: 2.5rem;
  line-height: 1.12;
  margin: 8px 0 28px;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.intro p {
  font-size: 1.12rem;
  margin: 0 0 18px;
  color: var(--fg);
}
.intro em { font-style: italic; color: var(--accent); }
.intro .byline {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

/* Browse callouts */
.browse {
  margin: 56px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.browse a.card {
  display: block;
  padding: 18px 18px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  transition: border-color .15s, transform .15s;
}
.browse a.card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.browse a.card .h {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.browse a.card .t {
  margin-top: 6px;
  font-size: 1.05rem;
}
.browse a.card .d {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* Section heading */
.section-title {
  margin: 64px 0 18px;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* Listing of recent posts */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.post-list li:last-child { border-bottom: none; }
.post-list h3 {
  margin: 0 0 4px;
  font-family: "Iowan Old Style", "Apple Garamond", Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 700;
}
.post-list h3 a { color: var(--fg); }
.post-list h3 a:hover { color: var(--accent); text-decoration: none; }
.post-list .meta {
  color: var(--muted);
  font-size: 0.88rem;
}
.post-list .excerpt {
  color: var(--fg);
  margin-top: 8px;
  font-size: 0.98rem;
  opacity: 0.85;
}

/* Single article */
article.post header.post-header { margin-bottom: 28px; }
article.post .post-cat {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
article.post .post-cat a { color: var(--accent); }
article.post h1 {
  font-family: "Iowan Old Style", "Apple Garamond", Georgia, serif;
  font-size: 2.15rem;
  line-height: 1.18;
  margin: 0 0 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
}
article.post .byline {
  color: var(--muted);
  font-size: 0.92rem;
}
article.post .byline .author { font-weight: 600; color: var(--fg); }

.post-content {
  font-family: "Iowan Old Style", "Apple Garamond", Georgia, "Cambria", serif;
  font-size: 1.13rem;
  line-height: 1.7;
}
.post-content p { margin: 0 0 1.15em; }
.post-content a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.post-content h2, .post-content h3, .post-content h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 2em 0 0.6em;
  line-height: 1.25;
}
.post-content h2 { font-size: 1.55rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content blockquote {
  margin: 22px 0;
  padding: 6px 18px;
  border-left: 3px solid var(--quote-bar);
  color: var(--muted);
  background: var(--soft);
  border-radius: 0 4px 4px 0;
}
.post-content blockquote p { margin: 0.5em 0; }
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 12px 0;
}
.post-content img.alignleft  { float: left;  margin: 6px 18px 12px 0; max-width: 50%; }
.post-content img.alignright { float: right; margin: 6px 0 12px 18px; max-width: 50%; }
.post-content img.aligncenter { display: block; margin-left: auto; margin-right: auto; float: none; }
.post-content .wp-caption {
  background: var(--soft);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 4px;
  max-width: 100% !important;
}
.post-content .wp-caption img { margin: 0; }
.post-content .wp-caption p.wp-caption-text {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  margin: 6px 0 2px;
}
.post-content .wp-caption.alignleft { float: left; margin: 6px 18px 12px 0; }
.post-content .wp-caption.alignright { float: right; margin: 6px 0 12px 18px; }
.post-content code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.92em;
}
.post-content pre {
  background: var(--code-bg);
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.5;
}
.post-content pre code { background: transparent; padding: 0; }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content li { margin-bottom: 0.35em; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 32px auto; width: 60%; }
.post-content::after { content: ""; display: block; clear: both; }

/* Video embed (responsive 16:9) */
.video-embed {
  position: relative; padding-bottom: 56.25%;
  height: 0; overflow: hidden;
  margin: 18px 0;
  background: #000;
  border-radius: 6px;
}
.video-embed iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: 0;
}

/* Post tags */
.post-categories {
  margin: 36px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}
.post-categories a {
  display: inline-block;
  margin-right: 6px;
  padding: 3px 10px;
  background: var(--soft);
  color: var(--fg);
  border-radius: 999px;
  font-size: 0.82rem;
}
.post-categories a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

/* Prev/next nav */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 40px 0 0;
  padding: 22px 0;
  border-top: 1px solid var(--border);
}
.post-nav a {
  flex: 1;
  display: block;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 0.95rem;
  line-height: 1.35;
}
.post-nav a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.post-nav a.next { text-align: right; }
.post-nav .label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

/* Comments */
.comments-section {
  margin: 60px 0 0;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}
.comments-section h2 {
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 20px;
}
.comment {
  list-style: none;
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.comment .cite {
  font-weight: 600;
  color: var(--fg);
}
.comment .cite a { color: var(--fg); }
.comment .when { color: var(--muted); font-size: 0.85rem; margin-left: 8px; }
.comment .body { margin-top: 6px; }
.comment .body p:last-child { margin-bottom: 0; }
.comment .body img { max-width: 100%; height: auto; border-radius: 4px; }
.comment .children { list-style: none; padding-left: 22px; margin-top: 14px; border-left: 2px solid var(--border); }
.comments-section .nothing { color: var(--muted); font-style: italic; }

/* Archive page */
.archive-year { margin: 36px 0 14px; }
.archive-year h2 {
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: 1.8rem;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.archive-month {
  margin: 18px 0;
}
.archive-month h3 {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 14px 0 8px;
}
.archive-list { list-style: none; padding: 0; margin: 0; }
.archive-list li {
  display: flex;
  gap: 14px;
  padding: 5px 0;
  border-bottom: 1px dotted var(--border);
}
.archive-list li:last-child { border-bottom: none; }
.archive-list .d {
  flex: 0 0 78px;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.archive-list a { color: var(--fg); }
.archive-list a:hover { color: var(--accent); text-decoration: none; }

/* Category index */
.cat-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.cat-list a {
  display: block;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
}
.cat-list a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.cat-list .count { color: var(--muted); font-size: 0.85rem; margin-left: 6px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 32px 22px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* View toggle in classic */
.view-toggle {
  background: #111;
  color: #B0B0B0;
  padding: 6px 16px;
  font-family: Verdana, Arial, sans-serif;
  font-size: 11px;
  border-bottom: 1px solid #555;
}
.view-toggle a { color: #FD5A1E; text-decoration: none; }
.view-toggle a:hover { text-decoration: underline; color: #fff; }

/* Small-screen tweaks */
@media (max-width: 540px) {
  html { font-size: 16px; }
  .container { padding: 28px 16px 60px; }
  .intro h1 { font-size: 2rem; }
  article.post h1 { font-size: 1.7rem; }
  .post-content { font-size: 1.05rem; }
  .post-nav { flex-direction: column; }
  .site-header .inner { padding: 10px 14px; gap: 10px; }
  .site-header nav { gap: 10px; }
  .site-header a.brand { font-size: 0.95rem; }
}
