:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef1ee;
  --text: #0d1512;
  --muted: #5b6862;
  --line: #dfe5e1;
  --accent: #0f9d78;
  --accent-ink: #ffffff;
  --accent-soft: rgba(15, 157, 120, .1);
  --trace: rgba(15, 157, 120, .14);
  --code-bg: #0f1714;
  --code-text: #d7e4dd;
  --warn: #d97706;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080d0b;
    --surface: #0f1714;
    --surface-2: #14201b;
    --text: #e8efeb;
    --muted: #8a9a92;
    --line: #1d2a24;
    --accent: #22d3a6;
    --accent-ink: #04120d;
    --accent-soft: rgba(34, 211, 166, .1);
    --trace: rgba(34, 211, 166, .08);
    --code-bg: #050907;
    --warn: #f59e0b;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 780px; }
.center { text-align: center; margin-top: 40px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* Nav */
.topnav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topnav .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.logo { font-weight: 800; letter-spacing: -.02em; font-size: 17px; white-space: nowrap; }
.logo span { color: var(--accent); }
.links { display: flex; gap: 26px; font-size: 14px; color: var(--muted); }
.links a:hover, .links a[aria-current] { color: var(--text); }
.links a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent); padding-bottom: 2px; }
@media (max-width: 760px) {
  .links { gap: 16px; }
  .links a:not([href="/blog"]) { display: none; }
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  transition: border-color .2s, transform .2s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 96px 0 88px; border-bottom: 1px solid var(--line); }
.hero svg.traces { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .container { position: relative; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--accent);
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); margin-bottom: 24px;
}
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink 2.4s ease-in-out infinite; }
.led.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
@keyframes blink { 50% { opacity: .35; } }
.hero h1, .page-head h1 {
  font-size: clamp(38px, 7vw, 76px);
  line-height: 1.04; font-weight: 800; letter-spacing: -.04em;
  max-width: 860px; margin-bottom: 22px;
}
h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: clamp(16px, 2.2vw, 19px); color: var(--muted); max-width: 640px; margin-bottom: 34px; }
.lead a { color: var(--accent); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.stats {
  display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 1px;
  margin-top: 64px; background: var(--line);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.stat { background: var(--surface); padding: 22px 20px; }
.stat b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.stat span { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Page head */
.page-head { padding: 80px 0 48px; border-bottom: 1px solid var(--line); }
.page-head.center { text-align: center; padding: 120px 0; border-bottom: 0; }
.page-head.center .lead { margin-left: auto; margin-right: auto; }
.page-head h1 { font-size: clamp(34px, 6vw, 60px); }
.center-row { justify-content: center; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-filter .tag { padding: 5px 11px; font-size: 13px; }
.tag-filter .tag:hover, .tag-filter .tag.on { border-color: var(--accent); color: var(--accent); }

/* Sections */
section { padding: 96px 0; border-bottom: 1px solid var(--line); }
section.tight { padding: 56px 0 96px; border-bottom: 0; }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 44px; flex-wrap: wrap; }
.section-head .idx { font-size: 13px; color: var(--accent); }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.03em; }
.section-head p { flex-basis: 100%; color: var(--muted); max-width: 640px; }

/* About */
.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: start; }
.about.single { grid-template-columns: 1fr; max-width: 760px; }
.prose-lite p { color: var(--muted); margin-bottom: 16px; font-size: 17px; }
.prose-lite strong { color: var(--text); font-weight: 600; }
.prose-lite a { color: var(--accent); }
.about-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); margin-bottom: 16px; }
.spec { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 20px; font-size: 14px; }
.spec div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.spec div:last-child { border-bottom: 0; }
.spec dt { color: var(--muted); }
.spec dd { text-align: right; font-weight: 500; }
.spec a { color: var(--accent); }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; gap: 32px; } }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 26px; transition: border-color .2s; }
.skill:hover { border-color: var(--accent); }
.skill .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 18px; }
.skill h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.skill p { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px; padding: 3px 9px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
@media (max-width: 960px) { .skills { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .skills { grid-template-columns: 1fr; } }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.project { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: transform .25s, border-color .25s; }
.project:hover { transform: translateY(-3px); border-color: var(--accent); }
.project .visual { aspect-ratio: 16 / 9; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow: hidden; }
.project .visual svg, .project .visual img { width: 100%; height: 100%; object-fit: cover; }
.project .body { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.meta { font-size: 12px; color: var(--accent); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }
.project h3 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 10px; }
.project h3 a:hover { color: var(--accent); }
.project p { font-size: 15px; color: var(--muted); margin-bottom: 18px; flex: 1; }
.project-links { display: flex; gap: 18px; margin-top: 18px; }
.more { font-size: 14px; font-weight: 600; color: var(--accent); }
@media (max-width: 760px) { .projects { grid-template-columns: 1fr; } }

/* Experience */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.job { position: relative; padding-bottom: 44px; }
.job:last-child { padding-bottom: 0; }
.job::before { content: ""; position: absolute; left: -28px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.job .when { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.job h3 { font-size: 19px; font-weight: 700; }
.job .org { color: var(--accent); font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.job-desc { color: var(--muted); font-size: 15px; max-width: 760px; }
.job-desc p { margin-bottom: 8px; }
.job-desc ul { list-style: none; display: grid; gap: 6px; }
.job-desc li { padding-left: 18px; position: relative; }
.job-desc li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

/* Education */
.edu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.card .when { font-size: 13px; color: var(--muted); }
.card h3 { font-size: 17px; font-weight: 700; margin: 6px 0 4px; }
.card p { font-size: 14px; color: var(--muted); }
.card .note { margin-top: 8px; }
.card ul { list-style: none; display: grid; gap: 10px; margin-top: 8px; font-size: 14px; }
.card li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.card li:last-child { border-bottom: 0; padding-bottom: 0; }
.card li small { color: var(--muted); margin-left: 6px; }
.card li span { color: var(--muted); white-space: nowrap; }
.card li a { color: var(--accent); }
@media (max-width: 760px) { .edu { grid-template-columns: 1fr; } }

/* Posts */
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.post-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: transform .25s, border-color .25s; }
.post-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.post-cover { display: block; aspect-ratio: 16 / 9; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow: hidden; }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-cover-fallback {
  height: 100%; display: grid; place-items: center; color: var(--accent); font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  background-image: linear-gradient(var(--trace) 1px, transparent 1px), linear-gradient(90deg, var(--trace) 1px, transparent 1px);
  background-size: 22px 22px;
}
.post-card .body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.post-card h3 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; line-height: 1.35; margin-bottom: 10px; }
.post-card h3 a:hover { color: var(--accent); }
.post-card p { font-size: 14px; color: var(--muted); margin-bottom: 16px; flex: 1; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 48px; font-size: 14px; color: var(--muted); }
.pager a { color: var(--accent); }
@media (max-width: 960px) { .posts { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .posts { grid-template-columns: 1fr; } }

/* Article */
.preview-bar { background: var(--warn); color: #1a1205; text-align: center; font-size: 13px; padding: 8px; }
.post-head { padding: 64px 0 36px; }
.back { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.back:hover { color: var(--accent); }
.post-head h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.1; font-weight: 800; letter-spacing: -.035em; margin-bottom: 18px; }
.post-head .lead { margin-bottom: 22px; }
.post-hero { width: 100%; border-radius: 14px; border: 1px solid var(--line); margin-bottom: 40px; }
.post-grid { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 56px; justify-content: center; padding-bottom: 64px; }
.toc { position: relative; }
.toc-inner { position: sticky; top: 96px; display: grid; gap: 8px; font-size: 13px; border-left: 2px solid var(--line); padding-left: 16px; }
.toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.toc a { color: var(--muted); line-height: 1.4; }
.toc a:hover { color: var(--accent); }
.toc a.l3 { padding-left: 12px; font-size: 12px; }
@media (max-width: 960px) { .post-grid { grid-template-columns: minmax(0, 1fr); gap: 0; } .toc { display: none; } }
.project-spec { margin-bottom: 40px; }

.prose { font-size: 17px; line-height: 1.75; color: var(--text); padding-bottom: 32px; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 27px; letter-spacing: -.025em; line-height: 1.25; margin-top: 2em; }
.prose h3 { font-size: 21px; letter-spacing: -.015em; line-height: 1.3; margin-top: 1.7em; }
.prose h4 { font-size: 17px; margin-top: 1.5em; }
.prose p, .prose li { color: color-mix(in srgb, var(--text) 86%, var(--muted)); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { font-weight: 650; color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4em; display: grid; gap: .4em; }
.prose li::marker { color: var(--accent); }
.prose li.task { list-style: none; margin-left: -1.4em; }
.prose code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .86em; background: var(--surface-2); border: 1px solid var(--line); padding: .1em .4em; border-radius: 5px; }
.prose pre { background: var(--code-bg); color: var(--code-text); border-radius: 12px; padding: 20px 22px; overflow-x: auto; font-size: 14px; line-height: 1.6; position: relative; border: 1px solid var(--line); }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.prose pre code[data-lang]::before { content: attr(data-lang); position: absolute; top: 8px; right: 12px; font-size: 11px; color: #6f8a7d; text-transform: uppercase; letter-spacing: .06em; }
.prose blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; color: var(--muted); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose figure img, .prose > p > img { border-radius: 12px; border: 1px solid var(--line); }
.prose figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 10px; }
.prose .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 600; font-size: 14px; }
.prose tr:last-child td { border-bottom: 0; }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 14px 18px; }
.callout > strong { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 4px; }
.callout p { margin: 0; }
.callout > * + * { margin-top: .6em; }
.callout-warning { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.callout-warning > strong { color: var(--warn); }

.author { display: flex; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding-top: 28px; padding-bottom: 32px; flex-wrap: wrap; }
.author .avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.author b { display: block; }
.author span { color: var(--muted); font-size: 14px; }
.author .btn { margin-left: auto; }
.related-title { font-size: 24px; letter-spacing: -.02em; margin-bottom: 24px; }

/* Contact */
.contact { text-align: center; border-bottom: 0; }
.contact h2 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; letter-spacing: -.035em; margin-bottom: 16px; }
.contact p { color: var(--muted); max-width: 520px; margin: 0 auto 32px; font-size: 17px; }
.contact p.small { font-size: 13px; margin-top: 24px; margin-bottom: 0; }
.contact .cta { justify-content: center; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 13px; color: var(--muted); }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; }
.footer-links a:hover { color: var(--accent); }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .led { animation: none; }
}
