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

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e7eb;
  --tag-bg: #f3f4f6;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --max-w: 720px;
  --radius: 8px;
}

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

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

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

img { max-width: 100%; display: block; }

/* ─── Layout ─── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main-content { min-height: calc(100vh - 130px); }

/* ─── Nav ─── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.15s;
}

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

.nav-toggle { display: none; }

/* ─── Hero ─── */
.hero {
  padding: 5rem 0 4rem;
  border-bottom: 1px solid var(--border);
}

.hero-name {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ─── Buttons ─── */
.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

/* ─── Sections ─── */
.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.projects { padding: 3.5rem 0; border-bottom: 1px solid var(--border); }

/* ─── Project Grid ─── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(37,99,235,0.08);
}

.project-card h3 { font-size: 1rem; font-weight: 600; }
.project-card p { font-size: 0.9rem; color: var(--text-muted); flex: 1; }

.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }
.tag {
  background: var(--tag-bg);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.project-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  margin-top: 0.5rem;
}

/* ─── Recent Posts ─── */
.recent-posts { padding: 3.5rem 0; }

.post-list { list-style: none; display: flex; flex-direction: column; gap: 1.1rem; }

.post-list-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 85px;
  font-variant-numeric: tabular-nums;
}

.post-list a {
  color: var(--text);
  font-weight: 500;
}
.post-list a:hover { color: var(--accent); }

.view-all {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ─── Blog Page ─── */
.page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  padding-top: 3rem;
}

.post-list-full { gap: 1.5rem; }

.post-list-full .post-list-item {
  flex-direction: column;
  gap: 0.15rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-list-title { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.post-list-title:hover { color: var(--accent); }
.post-list-excerpt { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; }

.empty-state { color: var(--text-muted); padding-top: 3rem; }

/* ─── Post ─── */
.post-header {
  padding: 3.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.post-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.post-content {
  padding: 2.5rem 0;
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 0.75rem; }
.post-content h3 { font-size: 1.15rem; font-weight: 600; margin: 1.75rem 0 0.6rem; }
.post-content p { margin-bottom: 1.25rem; }
.post-content ul, .post-content ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.post-content li { margin-bottom: 0.35rem; }
.post-content a { text-decoration: underline; text-underline-offset: 3px; }
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--tag-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
.post-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
.post-content pre code { background: none; padding: 0; font-size: 0.9rem; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-muted);
  margin: 1.5rem 0;
}

.post-footer { padding-bottom: 3rem; }
.back-link { font-size: 0.9rem; font-weight: 500; }

/* ─── Page ─── */
.page { padding: 3rem 0; }
.page-content { font-size: 1.05rem; line-height: 1.8; }
.page-content h2 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 0.5rem; }
.page-content ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.page-content li { margin-bottom: 0.3rem; }
.page-content p { margin-bottom: 1rem; }

/* ─── Footer ─── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 2rem;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links a { color: var(--text-muted); margin-left: 1rem; }
.footer-links a:hover { color: var(--text); }

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 1rem;
  }
  .nav-toggle {
    display: block;
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text);
  }
  .project-grid { grid-template-columns: 1fr; }
  .post-list-item { flex-direction: column; gap: 0.1rem; }
  .post-date { min-width: auto; }
  .hero { padding: 3rem 0 2.5rem; }
}
