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

/* ─── Base ──────────────────────────────────────────── */
:root {
  --bg:      #ffffff;
  --text:    #111111;
  --muted:   #666666;
  --border:  #e0e0e0;
  --max-w:   680px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: "Inter", "SF Pro Display", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  padding: 0 1.5rem;
}

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

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

/* ─── Header / Nav ──────────────────────────────────── */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

nav a {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 1.5rem;
  transition: color 0.2s;
}

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

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

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

.post-list li:first-child {
  padding-top: 0;
}

.post-meta {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.post-list h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  transition: opacity 0.2s;
}

.post-list a:hover h2 {
  opacity: 0.6;
}

.post-excerpt {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
  /* two-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Loading / Empty States ────────────────────────── */
.state-msg {
  padding: 4rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

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

.post-header .post-meta {
  margin-bottom: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 2rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--text);
}

/* ─── Rendered Markdown (post body) ─────────────────── */
.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.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-bottom: 1rem;
}

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

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

.post-body a {
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s;
}

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

.post-body code {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.82rem;
  background: #f4f4f4;
  padding: 0.15em 0.45em;
  border-radius: 3px;
}

.post-body pre {
  background: #111111;
  color: #e8e8e8;
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  margin-bottom: 1.2rem;
}

.post-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.82rem;
}

.post-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1.2rem;
  margin-left: 0;
  margin-bottom: 1rem;
  color: var(--muted);
}

.post-body img {
  max-width: 100%;
  border-radius: 4px;
  margin-bottom: 1rem;
}

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

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
}

.post-body th,
.post-body td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.post-body th {
  font-weight: 600;
  border-bottom-color: var(--text);
}

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

/* ─── Responsive ────────────────────────────────────── */
@media (max-width: 480px) {
  header {
    padding-top: 1.5rem;
  }

  .post-list h2 {
    font-size: 1.15rem;
  }

  .post-header h1 {
    font-size: 1.5rem;
  }
}
