/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Design tokens ── */
:root {
  --bg:           #faf9f7;
  --sidebar-bg:   #f2f0ec;
  --text:         #1c1c1c;
  --text-muted:   #6b6b6b;
  --accent:       #2c5282;
  --border:       #ddd9d3;
  --code-bg:      #f5f4f0;
  --font-serif:   'Lora', Georgia, 'Times New Roman', serif;
  --font-mono:    'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --max-width:    70rem;
  --sidebar-w:    16rem;
}

/* ── Base ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.75;
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
}

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

.site-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── Page body ── */
.site-body {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  padding: 2.5rem 2rem;
  gap: 0;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding-left: 2.5rem;
  border-left: 1px solid var(--border);
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-family: var(--font-serif);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.sidebar-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-section li {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.sidebar-section li a {
  color: var(--text);
}

.sidebar-section li a:hover {
  color: var(--accent);
  text-decoration: none;
}

.sidebar-section > a {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── Main content ── */
.main-content {
  flex: 1;
  min-width: 0;
}

/* ── Post index (list and homepage) ── */
.list-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.post-index {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-index-item {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

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

.post-index-item time {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
  font-style: normal;
  min-width: 7rem;
}

.post-index-item a {
  color: var(--text);
  font-size: 1rem;
}

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

/* ── Homepage post summaries ── */
.post-summary {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.post-summary-title {
  font-size: 1.3rem;
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.post-summary-title a {
  color: var(--text);
}

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

.post-summary-content {
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.read-more {
  font-size: 0.875rem;
  font-weight: 600;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  font-size: 0.875rem;
}

/* ── Single post ── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.4rem;
  color: var(--text);
}

.post-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: block;
  font-style: normal;
}

/* ── Post body typography ── */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.post-content h1 { font-size: 1.5rem; }
.post-content h2 { font-size: 1.3rem; }
.post-content h3 { font-size: 1.1rem; }
.post-content h4 { font-size: 1rem; }

.post-content p { margin: 0 0 1rem; }

.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}

.post-content li { margin-bottom: 0.3rem; }

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

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 1rem 0 1.25rem;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: #444;
}

.post-content pre code {
  font-size: inherit;
  color: inherit;
}

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

.post-content img.center,
.post-content embed.center {
  display: block;
  margin: 1.5rem auto;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.5rem;
}

.post-content table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  text-align: left;
}

.post-content th {
  background: var(--sidebar-bg);
  font-weight: 600;
}

.post-content tr:nth-child(even) td {
  background: var(--code-bg);
}

/* ── Post footer ── */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.post-meta {
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.post-meta a {
  color: var(--text-muted);
}

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

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  gap: 1rem;
}

.post-nav-link {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.post-nav-link:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── Disqus ── */
#disqus_thread {
  margin-top: 3rem;
}

#disqus_comments {
  margin-top: 2rem;
}

#disqus_comments button {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}

#disqus_comments button:hover {
  background: var(--sidebar-bg);
}

/* ── Site footer ── */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto 2rem;
  padding: 1.25rem 2rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

/* ── Responsive ── */
@media (max-width: 720px) {
  .site-body {
    flex-direction: column;
    padding: 1.5rem 1rem;
  }

  .sidebar {
    width: 100%;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
  }

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