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

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:       #ffffff;
  --surface:  #f7f7f7;
  --text:     #111111;
  --muted:    #777777;
  --border:   #e8e8e8;
  --code-bg:  #f5f5f5;
}

[data-theme="dark"] {
  --bg:       #0f0f0f;
  --surface:  #181818;
  --text:     #e8e8e8;
  --muted:    #888888;
  --border:   #2a2a2a;
  --code-bg:  #1e1e1e;
}

/* ─── Base ───────────────────────────────────────────────────────────────── */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  transition: background 0.15s, color 0.15s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
}
a:hover { text-decoration-color: var(--text); opacity: 0.75; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

main {
  flex: 1;
  padding: 5rem 0 5rem;
}

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

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav-links a {
  text-decoration: none;
  font-size: 0.875rem;
  color: var(--muted);
}
.nav-links a:hover { color: var(--text); opacity: 1; }

#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}
#theme-toggle:hover { color: var(--text); }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ─── Tags ───────────────────────────────────────────────────────────────── */
.tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* ─── Post List ──────────────────────────────────────────────────────────── */
.post-item {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child { padding-top: 0; }

.post-date {
  font-size: 0.8rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.post-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.post-title a {
  text-decoration: none;
}
.post-title a:hover { opacity: 0.7; }

.post-excerpt {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Reading time */
.reading-time {
  font-size: 0.78rem;
  color: var(--muted);
}

/* Empty state */
.empty-state {
  color: var(--muted);
  padding: 3rem 0;
  font-size: 0.95rem;
}

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

.post-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.9rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ─── Post Body Typography ───────────────────────────────────────────────── */
.post-body {
  line-height: 1.8;
  font-size: 1.025rem;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 2.25rem 0 0.6rem;
}
.post-body h1 { font-size: 1.7rem; }
.post-body h2 { font-size: 1.35rem; }
.post-body h3 { font-size: 1.1rem; }
.post-body h4 { font-size: 1rem; }

.post-body p { margin: 1.1rem 0; }

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

.post-body ul,
.post-body ol {
  padding-left: 1.6rem;
  margin: 1rem 0;
}
.post-body li { margin: 0.35rem 0; }

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

/* Inline code */
.post-body :not(pre) > code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Code blocks */
.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.75rem 0;
  line-height: 1.6;
}

.post-body pre code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 0.875rem;
  background: none;
  border: none;
  padding: 0;
}

/* highlight.js overrides — respect our code-bg */
.hljs { background: var(--code-bg) !important; }

.post-body img {
  max-width: 100%;
  border-radius: 6px;
  margin: 1.5rem 0;
  display: block;
}

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

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
.post-body th,
.post-body td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.9rem;
  text-align: left;
}
.post-body th {
  background: var(--surface);
  font-weight: 600;
}

/* ─── Post Footer ────────────────────────────────────────────────────────── */
.post-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-footer a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.875rem;
}
.post-footer a:hover { color: var(--text); opacity: 1; }

/* ─── About ──────────────────────────────────────────────────────────────── */
.about-content h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.about-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  letter-spacing: -0.01em;
}

.about-content p,
.about-content ul {
  color: var(--muted);
  line-height: 1.75;
}

.about-content ul {
  padding-left: 1.4rem;
}

.about-content li { margin: 0.4rem 0; }

.about-content a { color: var(--text); }

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .post-header h1 { font-size: 1.6rem; }
  .post-title     { font-size: 1.1rem; }
  .post-body      { font-size: 1rem; }
}
