/* ------------------------------------------------------------------
   blog.css — styling for /blog and individual article pages.

   Deliberately self-contained: the homepage still carries its own
   <style> block, and this stylesheet mirrors the same design tokens
   so the two worlds stay visually consistent without coupling.
   ------------------------------------------------------------------ */

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

:root {
  --bg:            #fafaf7;
  --bg-soft:       #f3f1ea;
  --bg-card:       #ffffff;
  --ink:           #1f2937;
  --ink-soft:      #4b5563;
  --ink-faint:     #6b7280;
  --rule:          #e5e1d6;
  --brand:         #1e3a8a;
  --brand-soft:    #3b5bdb;
  --accent:        #d97706;
  --accent-soft:   #fef3c7;
  --ok:            #047857;
  --radius:        10px;
  --shadow:        0 1px 2px rgba(31, 41, 55, 0.04),
                   0 4px 12px rgba(31, 41, 55, 0.06);
  --max:           1140px;
  --max-read:      720px;
  --font:          -apple-system, BlinkMacSystemFont, "Segoe UI",
                   "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:     ui-monospace, "SF Mono", Menlo, Consolas,
                   "Liberation Mono", monospace;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header (shared shell with the homepage) -------------------- */
header.site {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(6px);
  background: rgba(250, 250, 247, 0.9);
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand a { color: inherit; }
.brand a:hover { text-decoration: none; }
.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  display: inline-block;
}
nav.primary {
  display: flex;
  gap: 28px;
  align-items: center;
}
nav.primary a {
  color: var(--ink-soft);
  font-size: 0.95rem;
}
nav.primary a:hover { color: var(--brand); text-decoration: none; }
nav.primary a.active { color: var(--brand); }

.gh-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--ink-soft) !important;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: border-color 120ms ease, color 120ms ease;
}
.gh-link:hover {
  border-color: var(--brand);
  color: var(--brand) !important;
  text-decoration: none !important;
}
.gh-link svg { width: 18px; height: 18px; display: block; }

/* --- Blog index ------------------------------------------------ */
.blog-hero {
  padding: 80px 0 30px 0;
}
.blog-hero h1 {
  font-size: clamp(2rem, 3vw + 1rem, 3rem);
  margin: 0 0 14px 0;
  letter-spacing: -0.01em;
}
.blog-hero p.lead {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 720px;
  margin: 0;
}

.post-list {
  padding: 20px 0 80px 0;
  list-style: none;
  margin: 0;
}
.post-list > li {
  border-top: 1px solid var(--rule);
  padding: 28px 0;
}
.post-list > li:last-child { border-bottom: 1px solid var(--rule); }
.post-list a.post-link {
  display: block;
  color: inherit;
}
.post-list a.post-link:hover { text-decoration: none; }
.post-list a.post-link:hover h2 { color: var(--brand); }

.post-meta {
  font-size: 0.82rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.post-list h2 {
  margin: 0 0 8px 0;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  transition: color 120ms ease;
}
.post-list p.teaser {
  margin: 0;
  color: var(--ink-soft);
  max-width: 720px;
}

.post-list-empty {
  padding: 40px 0 100px 0;
  color: var(--ink-faint);
  text-align: center;
}

/* --- Article page --------------------------------------------- */
article.post {
  padding: 60px 0 100px 0;
  max-width: var(--max-read);
  margin: 0 auto;
}
article.post header.post-head {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}
article.post header.post-head h1 {
  font-size: clamp(1.8rem, 2.2vw + 1rem, 2.6rem);
  margin: 8px 0 6px 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
article.post header.post-head .post-meta { margin: 0; }

article.post h2 {
  font-size: 1.45rem;
  margin: 1.8em 0 0.4em 0;
  letter-spacing: -0.01em;
}
article.post h3 {
  font-size: 1.15rem;
  margin: 1.5em 0 0.3em 0;
}
article.post p,
article.post ul,
article.post ol {
  color: var(--ink);
  margin: 0 0 1.1em 0;
}
article.post ul,
article.post ol { padding-left: 1.4em; }
article.post li { margin-bottom: 0.4em; }

article.post a { text-decoration: underline; text-underline-offset: 2px; }

article.post blockquote {
  margin: 1.5em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}

article.post code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
article.post pre {
  background: #1f2937;
  color: #e5e7eb;
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 1.2em 0;
}
article.post pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

article.post img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 1.4em auto;
}

article.post hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2em 0;
}

article.post table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2em 0;
  font-size: 0.95rem;
}
article.post th,
article.post td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
article.post th {
  background: var(--bg-soft);
  font-weight: 600;
}

.post-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.92rem;
}
.post-footer a { color: var(--ink-soft); }
.post-footer a:hover { color: var(--brand); }

/* --- Footer --------------------------------------------------- */
footer.site {
  border-top: 1px solid var(--rule);
  padding: 40px 0 60px 0;
  font-size: 0.9rem;
  color: var(--ink-faint);
  background: var(--bg-soft);
}
footer.site .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
footer.site a { color: var(--ink-soft); }
