/* Theme: follows the OS unless the toggle sets data-theme (kept in localStorage). */
:root {
  --bg: #fbfaf8;
  --fg: #2b2a27;
  --muted: #8a857c;
  --caption: #55514a;
  --accent: #4a6fa5;
  --rule: #e6e2da;
  --card: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191a1c;
    --fg: #e4e2dd;
    --muted: #8f8c85;
    --caption: #d2cfc7;
    --accent: #8fb0dd;
    --rule: #33343a;
    --card: #202226;
  }
}
:root[data-theme="dark"] {
  --bg: #191a1c;
  --fg: #e4e2dd;
  --muted: #8f8c85;
  --caption: #d2cfc7;
  --accent: #8fb0dd;
  --rule: #33343a;
  --card: #202226;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overflow-wrap: break-word;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-banner {
  display: block;
  max-width: 80rem;
  margin: 1.2rem auto 0;
  padding: 0 1rem;
}
.site-banner img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.site-header {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.site-header nav { display: flex; gap: 1.1rem; align-items: center; }
#theme-toggle {
  border: none; background: none; cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 0.1rem;
}

main { max-width: 80rem; margin: 0 auto; padding: 0 1rem 3rem; }

.post { padding: 2.2rem 0 1rem; border-bottom: 1px solid var(--rule); }
.post-title { font-size: 1.55rem; line-height: 1.25; margin: 0 0 0.2rem; letter-spacing: -0.01em; }
.post-title a { color: var(--fg); }
.post-date { color: var(--muted); font-size: 0.88rem; margin: 0 0 1.1rem; }
.comment-count { font-size: 0.88rem; }

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 0.4rem 0;
}
.post-body figure { margin: 1.2rem 0; }
.post-body figcaption { color: var(--caption); font-size: 0.88rem; margin-top: 0.35rem; }
.post-body iframe { max-width: 100%; }
.post-body blockquote {
  margin: 1rem 0; padding: 0.2rem 1rem;
  border-left: 3px solid var(--rule); color: var(--muted);
}

/* migrated WP galleries and new-post galleries */
.gallery,
.wp-block-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin: 1.2rem 0;
}
.wp-block-gallery.columns-3 { grid-template-columns: repeat(3, 1fr); }
.gallery figure, .wp-block-gallery figure { margin: 0; }
.gallery img, .wp-block-gallery img { width: 100%; object-fit: cover; margin: 0; }
@media (max-width: 540px) {
  .gallery, .wp-block-gallery, .wp-block-gallery.columns-3 { grid-template-columns: 1fr; }
}

.video-embed { aspect-ratio: 16 / 9; margin: 1.2rem 0; }
.video-embed iframe { width: 100%; height: 100%; border: 0; border-radius: 6px; }

.pagination, .post-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1.4rem 0; font-size: 0.95rem;
}
.page-num { color: var(--muted); }
.post-nav a { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.comments { margin-top: 2rem; }
.comments h2 { font-size: 1.1rem; }
.comment {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin: 0.7rem 0;
  font-size: 0.95rem;
}
.comment-meta { margin: 0 0 0.3rem; }
.comment-meta span { color: var(--muted); font-size: 0.82rem; margin-left: 0.5rem; }
.comment-body p { margin: 0.3rem 0; }

.archive-year h2 { margin: 1.6rem 0 0.4rem; font-size: 1.15rem; }
.archive-list { list-style: none; padding: 0; margin: 0; }
.archive-list li { padding: 0.15rem 0; }
.archive-list time { color: var(--muted); font-size: 0.85rem; margin-right: 0.6rem; font-variant-numeric: tabular-nums; }

.site-footer {
  max-width: 80rem; margin: 0 auto; padding: 1rem;
  color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--rule);
}
