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

:root {
  --bg:          #f2ede8;
  --surface:     #e9e2da;
  --surface-2:   #dfd8cf;
  --border:      #d0c9c0;
  --border-2:    #bfb8ae;
  --text:        #1a1714;
  --text-2:      #6b6560;
  --text-3:      #a09890;
  --accent:      #1a1714;
  --accent-dim:  rgba(26, 23, 20, 0.06);
  --accent-ring: rgba(26, 23, 20, 0.14);
  --code-bg:     #e3dcd4;
  --nav-h:       56px;
  --r:           10px;
  --font:        -apple-system, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono:        "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Navigation ───────────────────────────────────────────── */

.blog-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(242, 237, 232, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 100;
}

.nav-logo {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

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

.nav-links a {
  font-size: 0.85rem;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ─── Blog Index ───────────────────────────────────────────── */

.blog-index {
  max-width: 860px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 5rem) 2rem 8rem;
}

.index-hero {
  margin-bottom: 4rem;
}

.index-hero h1 {
  font-size: 3.25rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.index-hero p {
  color: var(--text-2);
  font-size: 1.05rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ─── Post cards ───────────────────────────────────────────── */

.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem 1.75rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.post-card:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--accent-dim);
  color: var(--text-2);
  border: 1px solid var(--accent-ring);
}

.card-date {
  font-size: 0.78rem;
  color: var(--text-3);
}

.post-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.45;
  margin-bottom: 0.4rem;
}

.post-card p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.55;
}

/* ─── Post Page ────────────────────────────────────────────── */

.post-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 3.5rem) 2rem 8rem;
}

.post-header {
  margin-bottom: 3rem;
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.meta-dot { color: var(--text-3); font-size: 0.75rem; }

.post-date, .post-read-time {
  font-size: 0.82rem;
  color: var(--text-3);
}

.post-header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1rem;
}

.post-description {
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.65;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

/* ─── Article typography ───────────────────────────────────── */

.post-content { margin-top: 2.5rem; }

.post-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 3rem 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}

.post-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 2.25rem 0 0.75rem;
}

.post-content h4 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2rem 0 0.625rem;
}

.post-content p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.post-content a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-2);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
.post-content a:hover { text-decoration-color: var(--text); }

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

.post-content li {
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.post-content strong { font-weight: 600; }
.post-content em { color: var(--text-2); }

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

/* ─── Inline code ──────────────────────────────────────────── */

.post-content :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.83em;
  background: var(--code-bg);
  color: var(--text);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

/* ─── Code blocks ──────────────────────────────────────────── */

.post-content pre,
.post-content .highlight {
  background: var(--code-bg) !important;
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin: 1.75rem 0;
  overflow-x: auto;
}

.post-content pre {
  padding: 1.25rem 1.5rem;
}

.post-content .highlight pre {
  border: none;
  padding: 1.25rem 1.5rem;
  margin: 0;
  border-radius: var(--r);
}

.post-content pre code,
.post-content .highlight code {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.72;
  color: #2d2620;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}

/* Warm light syntax highlighting (Rouge) */
.post-content .highlight .k,
.post-content .highlight .kd,
.post-content .highlight .kn,
.post-content .highlight .kr  { color: #7c3aed; }           /* violet — keyword */
.post-content .highlight .nf,
.post-content .highlight .fm  { color: #1d4ed8; }           /* blue — function */
.post-content .highlight .nb,
.post-content .highlight .bp  { color: #b45309; }           /* amber — builtin */
.post-content .highlight .nc  { color: #b45309; }           /* amber — class */
.post-content .highlight .s,
.post-content .highlight .s1,
.post-content .highlight .s2,
.post-content .highlight .sa  { color: #16a34a; }           /* green — string */
.post-content .highlight .mi,
.post-content .highlight .mf,
.post-content .highlight .mh  { color: #dc2626; }           /* red — number */
.post-content .highlight .c,
.post-content .highlight .c1,
.post-content .highlight .cm,
.post-content .highlight .cp  { color: #a09890; font-style: italic; } /* muted — comment */
.post-content .highlight .o,
.post-content .highlight .ow  { color: #374151; }           /* dark — operator */
.post-content .highlight .n,
.post-content .highlight .p   { color: #2d2620; }           /* near black — name/punct */
.post-content .highlight .na  { color: #0369a1; }           /* sky — attr */
.post-content .highlight .nd  { color: #7c3aed; }           /* violet — decorator */

/* ─── Tables ───────────────────────────────────────────────── */

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.post-content th {
  background: var(--surface);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.post-content td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
  line-height: 1.6;
}

.post-content tr:last-child td { border-bottom: none; }
.post-content tr:hover td { background: var(--accent-dim); }

/* ─── Callout / Note ───────────────────────────────────────── */

.note,
.post-content blockquote {
  background: var(--surface);
  border-left: 3px solid var(--border-2);
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1.75rem 0;
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.7;
}

.note strong,
.post-content blockquote strong { color: var(--text); }

/* ─── Post footer ──────────────────────────────────────────── */

.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-footer a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

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

/* ─── Responsive ───────────────────────────────────────────── */

@media (max-width: 640px) {
  .blog-nav { padding: 0 1.25rem; }
  .blog-index { padding: calc(var(--nav-h) + 3rem) 1.25rem 5rem; }
  .index-hero h1 { font-size: 2.25rem; }
  .post-wrap { padding: calc(var(--nav-h) + 2rem) 1.25rem 5rem; }
  .post-header h1 { font-size: 1.75rem; }
  .post-content h2 { font-size: 1.2rem; }
  .post-content pre,
  .post-content .highlight pre { padding: 1rem; font-size: 0.8rem; }
}
