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

:root {
  --nav-h:       53px;
  --bg:          #0a0a0a;
  --surface:     #111113;
  --elev:        #18181b;
  --ink:         #fafafa;
  --ink-soft:    #a1a1aa;
  --ink-faint:   #71717a;
  --rule:        #27272a;
  --accent:      #3b59f7;
  --accent-dim:  rgba(59,89,247,0.13);
  --sans:        'Inter', system-ui, sans-serif;
  --mono:        'JetBrains Mono', ui-monospace, monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Nav ──────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.nav-logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.nav-logo-text {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.2px;
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  display: inline-flex;
  align-items: center;
}

.nav-link:hover { background: var(--surface); color: var(--ink); }
.nav-link.active { background: var(--surface); color: var(--ink); }

.theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 6px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  transition: background 0.12s, color 0.12s;
}

.theme-toggle:hover { background: var(--surface); color: var(--ink); }
.theme-toggle svg { display: block; }

@media (max-width: 620px) {
  .nav-inner {
    padding: 0 14px;
    gap: 10px;
  }

  .nav-logo-text { display: none; }

  .nav-link {
    font-size: 12px;
    padding: 6px 8px;
    white-space: nowrap;
  }
}

/* ── Home hero ────────────────────────────────────────── */
.home-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 24px 120px;
}

.home-hero {
  max-width: 760px;
  margin-bottom: 56px;
}

@media (max-width: 720px) {
  .home-hero { margin-bottom: 40px; }
}

.hero-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.2);
  animation: pulse 2.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50%       { box-shadow: 0 0 0 6px transparent; }
}

.hero-status-text {
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--mono);
}

.hero-title {
  font-weight: 600;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: -1.6px;
  margin-bottom: 18px;
  text-wrap: balance;
}

.hero-bio {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 520px;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
  flex-wrap: wrap;
}

/* ── Profile sections ─────────────────────────────────── */
.impact-grid {
  display: grid;
  grid-template-columns: minmax(0, 260px);
  gap: 12px;
  margin-bottom: 48px;
}

@media (max-width: 860px) {
  .impact-grid { grid-template-columns: minmax(0, 260px); }
}

@media (max-width: 520px) {
  .impact-grid { grid-template-columns: 1fr; }
}

.impact-item,
.profile-panel {
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 12px;
}

.impact-item {
  padding: 18px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.impact-value {
  font-size: 30px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: 0;
}

.impact-label {
  color: var(--ink-soft);
  font-size: 13px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 52px;
}

@media (max-width: 760px) {
  .profile-grid { grid-template-columns: 1fr; }
}

.summary-grid {
  margin-bottom: 14px;
}

.profile-panel {
  padding: 24px;
}

.section-kicker {
  font-size: 12px;
  color: var(--ink-faint);
  font-family: var(--mono);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.section-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0;
  text-wrap: balance;
}

.timeline-list {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 16px;
}

.timeline-item.compact {
  grid-template-columns: 92px 1fr;
}

@media (max-width: 540px) {
  .timeline-item { grid-template-columns: 1fr; gap: 6px; }
}

.timeline-date {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 11px;
  padding-top: 3px;
}

.timeline-item h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-item p {
  color: var(--ink-soft);
  font-size: 14px;
}

.summary-list {
  margin-top: 24px;
  padding-left: 18px;
  color: var(--ink-soft);
}

.summary-list li {
  margin-bottom: 10px;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 720px) {
  .tech-grid { grid-template-columns: 1fr; }
}

.tech-grid h3,
.credential-list h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.skill-cloud {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 0;
}

.skill-cloud span {
  font-size: 12px;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  background: var(--elev);
  border-radius: 6px;
  padding: 5px 9px;
}

.education-panel {
  margin-top: 14px;
}

.credential-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (max-width: 640px) {
  .credential-list { grid-template-columns: 1fr; }
}

.credential-list p {
  color: var(--ink-soft);
  font-size: 14px;
}

/* ── Single post ──────────────────────────────────────── */
.post-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 24px 120px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 28px;
  transition: color 0.12s;
}

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

.post-header { margin-bottom: 36px; }

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink-faint);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.post-h1 {
  font-weight: 600;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -1.4px;
  margin-bottom: 16px;
  text-wrap: balance;
}

.post-subtitle {
  font-size: 19px;
  color: var(--ink-soft);
  line-height: 1.5;
  text-wrap: pretty;
}

.post-header-tags {
  display: flex;
  gap: 6px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.post-header-tag {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.12s, color 0.12s;
}

.post-header-tag:hover { border-color: var(--ink-soft); color: var(--ink); }

/* ── Prose ────────────────────────────────────────────── */
.prose { font-size: 16px; line-height: 1.75; }
.prose p { margin-bottom: 1.4em; }

.prose h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin: 2.2em 0 0.7em;
}

.prose h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 1.8em 0 0.5em;
}

.prose ul, .prose ol {
  padding-left: 1.4em;
  margin-bottom: 1.4em;
}

.prose li { margin-bottom: 0.35em; }

.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(255,255,255,0.07);
  padding: 1px 6px;
  border-radius: 4px;
}

.prose pre {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 20px 22px;
  margin: 1.8em 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 13px;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 18px;
  margin: 1.8em 0;
  background: var(--accent-dim);
  border-radius: 0 8px 8px 0;
  color: var(--ink-soft);
  font-style: italic;
}

/* Rouge syntax highlighting — dark theme tokens */
.highlight .c, .highlight .c1, .highlight .cm { color: #6c727d; font-style: italic; } /* comments */
.highlight .s, .highlight .s1, .highlight .s2 { color: #f9b87f; }                     /* strings */
.highlight .k, .highlight .kd, .highlight .kn { color: #a5b4fc; font-weight: 600; }   /* keywords */
.highlight .m, .highlight .mi, .highlight .mf { color: #f0a875; }                     /* numbers */
.highlight .nf { color: #86efac; }                                                      /* function names */
.highlight .n  { color: var(--ink); }                                                   /* names */
.highlight .o  { color: var(--ink-soft); }                                              /* operators */
.highlight .p  { color: var(--ink-soft); }                                              /* punctuation */

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all 0.12s;
}

.btn:hover { background: var(--elev); }

.btn-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover { opacity: 0.87; }

/* ── Fade-in entrance ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in   { animation: fadeUp 0.4s ease both; }
.fade-in-1 { animation-delay: 0.05s; }
.fade-in-2 { animation-delay: 0.12s; }
.fade-in-3 { animation-delay: 0.19s; }
.fade-in-4 { animation-delay: 0.26s; }

/* ── Reading progress bar ─────────────────────────────── */
.progress-bar {
  position: fixed;
  top: var(--nav-h); left: 0;
  height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 49;
  transition: width 0.1s linear;
}

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none; }
  .fade-in, .fade-in-1, .fade-in-2, .fade-in-3, .fade-in-4 { animation: none; }
}

/* ── Light theme (warm paper) ─────────────────────────── */
[data-theme="light"] {
  --bg:        #faf9f7;
  --surface:   #f5f3ef;
  --elev:      #ffffff;
  --ink:       #1c1917;
  --ink-soft:  #57534e;
  --ink-faint: #a8a29e;
  --rule:      #e7e5e4;
}

[data-theme="light"] .topbar {
  background: rgba(250,249,247,0.88);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #c7c4c1;
}
