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

:root {
  --bg:        #F9F8F5;
  --bg-card:   #FFFFFF;
  --ink:       #111110;
  --ink-mid:   #4A4A44;
  --ink-muted: #8A8A7E;
  --accent:    #2563EB;
  --border:    #E5E3DC;
  --tag-bg:    #EFEFEA;

  --ff-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ff-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

  --max-w: 680px;
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ── Nav ── */
.nav {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  transition: color .12s;
}
.nav-brand:hover {
  color: var(--ink);
}
.nav-links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  align-items: center;
}
.nav-links a {
  font-size: .82rem;
  color: var(--ink-muted);
  transition: color .12s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--ink); }
.nav-research {
  font-size: .82rem;
  color: var(--accent);
  border: 1px solid #BFDBFE;
  padding: .2rem .65rem;
  border-radius: 4px;
  transition: background .12s;
}
.nav-research:hover { background: #EFF6FF; }

/* ── Bio ── */
.bio {
  max-width: var(--max-w);
  margin: 3.5rem auto 0;
  padding: 0 1.5rem 2.5rem;
  border-bottom: 1px solid var(--border);
}
.bio-top {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  margin-bottom: 1rem;
}
.bio-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #BFDBFE 0%, #C7D2FE 100%);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  object-fit: cover;
}
.bio-name {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: .2rem;
}
.bio-role {
  font-size: .78rem;
  color: var(--ink-muted);
  font-family: var(--ff-mono);
}
.bio-text {
  font-size: .93rem;
  color: var(--ink-mid);
  line-height: 1.75;
}
.bio-text a {
  color: var(--accent);
  border-bottom: 1px solid #BFDBFE;
  transition: border-color .12s;
}
.bio-text a:hover { border-color: var(--accent); }

/* ── Posts ── */
.posts-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.series-block { padding: 2.2rem 0 0; }
.series-block + .series-block { border-top: 1px solid var(--border); }

.series-label {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1.3rem;
}
.series-name {
  font-family: var(--ff-mono);
  font-size: .72rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.series-count {
  font-family: var(--ff-mono);
  font-size: .68rem;
  color: var(--ink-muted);
  background: var(--tag-bg);
  padding: .1rem .4rem;
  border-radius: 3px;
}

.post-list { display: flex; flex-direction: column; }
.post-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.post-item:last-child { border-bottom: none; }
.post-left { flex: 1; min-width: 0; }

.post-badges { display: flex; gap: .4rem; margin-bottom: .3rem; flex-wrap: wrap; align-items: center; }
.badge {
  font-family: var(--ff-mono);
  font-size: .64rem;
  padding: .1rem .4rem;
  border-radius: 3px;
  letter-spacing: .04em;
}
.badge-intro { background: #DCFCE7; color: #15803D; }
.badge-inter { background: #FEF9C3; color: #A16207; }
.badge-adv   { background: #FEE2E2; color: #B91C1C; }
.badge-tag   { background: var(--tag-bg); color: var(--ink-muted); }

.post-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
  line-height: 1.4;
  margin-bottom: .3rem;
  transition: color .12s;
}
.post-item:hover .post-title { color: var(--accent); }

.post-excerpt {
  font-size: .82rem;
  color: var(--ink-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-date {
  font-family: var(--ff-mono);
  font-size: .7rem;
  color: var(--ink-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Research page ── */
.r-header {
  max-width: var(--max-w);
  margin: 3.5rem auto 0;
  padding: 0 1.5rem 2.5rem;
  border-bottom: 1px solid var(--border);
}
.r-eyebrow {
  font-family: var(--ff-mono);
  font-size: .7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .8rem;
}
.r-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .6rem;
  line-height: 1.15;
}
.r-sub {
  font-size: .88rem;
  color: var(--ink-mid);
  max-width: 480px;
  line-height: 1.7;
}

.r-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.r-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  display: flex;
  transition: box-shadow .2s;
}
.r-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.07); }
.r-card-thumb {
  width: 130px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-mono);
  font-size: .62rem;
  color: var(--ink-muted);
  text-align: center;
  padding: .5rem;
  background: var(--tag-bg);
}
.r-card-body { padding: 1rem 1.2rem; flex: 1; }
.r-card-tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .5rem; }
.r-card-title {
  font-size: .93rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .35rem;
  line-height: 1.35;
  letter-spacing: -.01em;
  transition: color .12s;
}
.r-card:hover .r-card-title { color: var(--accent); }
.r-card-desc { font-size: .8rem; color: var(--ink-muted); line-height: 1.6; }

/* ── Post / Project page ── */
.page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.page-eyebrow {
  font-family: var(--ff-mono);
  font-size: .7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .7rem;
}
.page-sub {
  font-size: .78rem;
  color: var(--ink-muted);
  margin-top: .3rem;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
  margin-bottom: .6rem;
}
.post-meta {
  font-family: var(--ff-mono);
  font-size: .72rem;
  color: var(--ink-muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Prose ── */
.prose { padding-bottom: 3rem; }
.prose p { margin-bottom: 1.1rem; font-size: .93rem; color: var(--ink-mid); line-height: 1.75; }
.prose h2 { font-size: 1.05rem; font-weight: 700; margin: 2rem 0 .6rem; letter-spacing: -.01em; }
.prose h3 { font-size: .95rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin-bottom: 1rem; }
.prose li { font-size: .93rem; color: var(--ink-mid); margin-bottom: .3rem; line-height: 1.65; }
.prose a { color: var(--accent); border-bottom: 1px solid #BFDBFE; }
.prose a:hover { border-color: var(--accent); }
.prose code {
  font-family: var(--ff-mono);
  font-size: .8em;
  background: var(--tag-bg);
  padding: .1em .35em;
  border-radius: 3px;
  color: #C2410C;
}
.prose pre {
  background: #1A1A18;
  color: #D4D4D4;
  padding: 1.1rem 1.3rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.3rem 0;
  font-family: var(--ff-mono);
  font-size: .78rem;
  line-height: 1.65;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose blockquote {
  border-left: 3px solid var(--border);
  padding: .5rem 1rem;
  color: var(--ink-muted);
  margin: 1.2rem 0;
  font-size: .9rem;
}
.prose .note {
  background: #EFF6FF;
  border-left: 3px solid var(--accent);
  padding: .7rem 1rem;
  border-radius: 0 4px 4px 0;
  margin: 1.3rem 0;
  font-size: .88rem;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin: 1.3rem 0;
}
.prose th, .prose td {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.prose th { background: var(--tag-bg); font-weight: 600; }

.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--border);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .4rem .9rem;
  border-radius: 4px;
  font-size: .82rem;
  font-weight: 500;
  transition: background .12s;
  border: 1px solid var(--border);
  color: var(--ink);
}
.btn:hover { background: var(--tag-bg); }

/* ── Footer ── */
.site-footer {
  max-width: var(--max-w);
  margin: 3rem auto 0;
  padding: 1.5rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-copy { font-size: .78rem; color: var(--ink-muted); }
.footer-links { display: flex; gap: 1.2rem; }
.footer-links a { font-size: .78rem; color: var(--ink-muted); }
.footer-links a:hover { color: var(--ink); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .post-item { flex-direction: column; gap: .3rem; }
  .post-date { display: none; }
  .r-card-thumb { display: none; }
}
