@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ───────────────────────────────────────────── */
:root {
  --bg:      #f5f0e8;
  --text:    #1c1b18;
  --muted:   #8a8070;
  --accent:  #2d6a4f;
  --border:  #e0d8cc;
  --code-bg: #ede8df;
  --max-w:    640px;
  --serif:    'Lora', Georgia, serif;
  --mono:     'JetBrains Mono', 'Courier New', monospace;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.78;
  padding: 0 1.25rem;
  min-height: 100vh
}

/* ── Layout ──────────────────────────────────────────────── */
.site-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────────── */
.site-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-title:hover { color: var(--accent); }

.site-nav {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  padding: 0 0.5rem;
}
.site-nav a:first-child { padding-left: 0; }
.site-nav a:hover { color: var(--accent); }

.site-nav .sep {
  color: var(--border);
  font-size: 0.8rem;
  user-select: none;
}

/* ── Post list ───────────────────────────────────────────── */
.post-list {
  list-style: none;
}

.post-item {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child { border-top: 1px solid var(--border); }

.post-item time {
  font-family: var(--mono);
  font-size: 0.71rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.post-item a {
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.45;
}
.post-item a:hover { color: var(--accent); }

/* ── Single post ─────────────────────────────────────────── */
.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.post-meta {
  font-family: var(--mono);
  font-size: 0.71rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ── Prose ───────────────────────────────────────────────── */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 2rem 0 0.7rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.post-content h1 { font-size: 1.35rem; }
.post-content h2 { font-size: 1.15rem; }
.post-content h3 { font-size: 1rem; }

.post-content p { margin-bottom: 1.3rem; }

.post-content a {
  color: var(--accent);
  text-underline-offset: 3px;
}
.post-content a:hover { color: #1b4332; }

.post-content ul,
.post-content ol {
  padding-left: 1.4rem;
  margin-bottom: 1.3rem;
}
.post-content li { margin-bottom: 0.3rem; }

.post-content blockquote {
  border-left: 3px solid var(--border);
  padding: 0.1rem 0 0.1rem 1.2rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
}

.post-content code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  margin-bottom: 1.3rem;
  line-height: 1.6;
}
.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.8rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto;
  border-radius: 2px;
}

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

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  text-align: left;
}
.post-content th { background: var(--code-bg); font-weight: 500; }

/* ── Page ────────────────────────────────────────────────── */
.page-title {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

/* ── Back link ───────────────────────────────────────────── */
.back-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.71rem;
  color: var(--muted);
  text-decoration: none;
  margin-top: 3rem;
  letter-spacing: 0.03em;
}
.back-link:hover { color: var(--accent); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  margin-top: 2.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
}
.pagination a { color: var(--muted); text-decoration: none; }
.pagination a:hover { color: var(--accent); }
.pagination .current { color: var(--text); }

/* ── Feed hint ───────────────────────────────────────────── */
.feed-hint {
  font-family: var(--mono);
  font-size: 0.71rem;
  color: var(--muted);
  margin-top: 2rem;
}
.feed-hint a { color: var(--muted); }
.feed-hint a:hover { color: var(--accent); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 5rem;
  padding: 2rem 0 3rem;
  font-family: var(--mono);
  font-size: 0.71rem;
  color: var(--muted);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  html { font-size: 17px; }
  .post-item { flex-direction: column; gap: 0.1rem; }
}

/* ── Dark mode ───────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:      #1e1c18;
  --text:    #e8e0d0;
  --muted:   #7a7060;
  --border:  #2e2a24;
  --code-bg: #252220;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  padding: 0;
  margin-left: auto;
}
.theme-toggle:hover { color: var(--accent); }