/* ─── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --bg:          #faf9f7;
  --bg-subtle:   #f2f0ec;
  --text:        #1c1917;
  --text-muted:  #78716c;
  --text-light:  #a8a29e;
  --accent:      #2d6a4f;       /* muted forest green — used sparingly */
  --accent-hover:#1b4332;
  --border:      #e7e5e1;
  --reading-width: 700px;
  --font-serif:  "Lora", Georgia, serif;
  --font-sans:   "Inter", system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg:          #17161a;
  --bg-subtle:   #1f1e23;
  --text:        #e8e6e1;
  --text-muted:  #9d9b94;
  --text-light:  #66645e;
  --accent:      #74c69d;
  --accent-hover:#95d5b2;
  --border:      #2c2a30;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Base ───────────────────────────────────────────────────────────────── */

html { font-size: 18px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.2s, color 0.2s;
}

main { flex: 1; }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/* ─── Header / Nav ───────────────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 1.5rem;
}

.nav-inner {
  max-width: var(--reading-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-name:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text); }

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}

.theme-toggle:hover { color: var(--text); }

/* ─── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: var(--reading-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover { color: var(--text); }

/* ─── Home ───────────────────────────────────────────────────────────────── */

.home {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}

.home-tagline {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
  font-style: italic;
  font-weight: 400;
}

.post-list {
  list-style: none;
}

.post-item {
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 0;
}

.post-item:first-child { border-top: 1px solid var(--border); }

.post-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.post-item-link:hover .post-item-title {
  color: var(--accent);
}

.post-item-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 0.4rem;
  transition: color 0.15s;
}

.post-item-excerpt {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.6rem;
}

.post-item-meta {
  font-size: 0.8125rem;
  color: var(--text-light);
  font-family: var(--font-sans);
}

/* ─── Individual Post ────────────────────────────────────────────────────── */

.post {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.post-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meta-sep { color: var(--text-light); }

/* Post body typography */

.post-body {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text);
}

.post-body p {
  margin-bottom: 1.5rem;
}

.post-body p:last-child { margin-bottom: 0; }

.post-body h2 {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text);
  margin: 2.5rem 0 0.875rem;
  letter-spacing: -0.01em;
}

.post-body h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin: 2rem 0 0.75rem;
}

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

.post-body a:hover {
  text-decoration-color: var(--accent);
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin: 2rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-body ul, .post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.post-body li { margin-bottom: 0.375rem; }

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.post-body code {
  font-family: monospace;
  font-size: 0.875em;
  background: var(--bg-subtle);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

/* ─── About / Static Pages ───────────────────────────────────────────────── */

.page {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-body {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text);
}

.page-body p { margin-bottom: 1.5rem; }
.page-body p:last-child { margin-bottom: 0; }

.page-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}

.page-body a:hover { text-decoration-color: var(--accent); }

/* ─── Archive ────────────────────────────────────────────────────────────── */

.archive {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.archive-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.archive-year {
  margin-bottom: 2rem;
}

.archive-year-heading {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.archive-list {
  list-style: none;
}

.archive-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.archive-item:first-child { border-top: 1px solid var(--border); }

.archive-item a {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-item a:hover { color: var(--accent); }

.archive-date {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  html { font-size: 17px; }

  .post-title { font-size: 1.625rem; }

  .post-item-title { font-size: 1.125rem; }

  .archive-item {
    flex-direction: column;
    gap: 0.2rem;
  }

  .archive-date { font-size: 0.75rem; }

  .nav-links { gap: 1rem; }
}

@media (max-width: 400px) {
  html { font-size: 16px; }
}
