/* reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17.5px; }

/* base */
body {
  font-family: "Inter","Helvetica Neue",sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--text);
  transition: background .2s ease, color .2s ease;
}

.site { display: flex; flex-direction: column; min-height: 100vh; }

/* topbar */
.topbar {
  max-width: 660px;
  width: 100%;
  margin: 0 auto;
  padding: 1.7rem 1.5rem 0;
  display: flex;
  align-items: center;
}

.nav-brand {
  font-family: "JetBrains Mono", monospace;
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--accent);
  cursor: pointer;
  margin-right: auto;
  user-select: none;
  transition: color .15s;
}
.nav-brand:hover { color: var(--accent-dim); }

nav { display: flex; align-items: center; }

nav a {
  font-family: "JetBrains Mono", monospace;
  font-size: .71rem;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  padding: .32rem .7rem;
  border-radius: 3px;
  user-select: none;
  transition: color .15s, background .15s;
}
nav a:hover  { color: var(--text); background: var(--bg-alt); }
nav a.active { color: var(--accent); }

.nav-icons {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin-left: .55rem;
  padding-left: .55rem;
  border-left: 1px solid var(--border);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: var(--bg-alt); }
.icon-btn svg   { width: 15px; height: 15px; fill: currentColor; display: block; }

/* main */
#main {
  flex: 1;
  padding: 3rem 0 5rem;
  transition: opacity .11s ease;
}
#main.out { opacity: 0; }

.page {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* home */
.hero {
  margin-bottom: 2.4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.9rem, 6vw, 2.65rem);
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: .5rem;
}
.hero h1::after {
  content: '_';
  color: var(--accent);
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

.tagline {
  font-family: "JetBrains Mono", monospace;
  font-size: .79rem;
  color: var(--text-muted);
  letter-spacing: .02em;
}

.bio p {
  font-size: .975rem;
  line-height: 1.78;
  color: var(--text);
  margin-bottom: 1rem;
}
.bio p:last-of-type { margin-bottom: 0; }

.bio a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: color .15s, text-decoration-color .15s;
}
.bio a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}

.ext-links {
  margin-top: 1.7rem;
  display: flex;
  align-items: center;
  gap: .45rem;
  font-family: "JetBrains Mono", monospace;
  font-size: .79rem;
}
.ext-links a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.ext-links a:hover { color: var(--link-hover); border-color: var(--link-hover); }
.ext-links .sep    { color: var(--text-dim); }

/* blog list */
.page-title {
  font-family: "JetBrains Mono", monospace;
  font-size: .69rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2.4rem;
}

.post-list { display: flex; flex-direction: column; }

.post-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin-bottom: 1.8rem;
}

.post-item time {
  font-family: "JetBrains Mono", monospace;
  font-size: .68rem;
  color: var(--text-muted);
}

.post-link {
  display: inline;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: color .15s;
}
.post-link:hover { color: var(--link-hover); }

.post-desc {
  font-size: .83rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: .05rem;
}

.empty {
  font-family: "JetBrains Mono", monospace;
  font-size: .82rem;
  color: var(--text-muted);
}

/* single post */
.back-link {
  font-family: "JetBrains Mono", monospace;
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-block;
  margin-bottom: 2.2rem;
  transition: color .15s;
  user-select: none;
}
.back-link:hover { color: var(--text); }

.post-header {
  margin-bottom: 2.4rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header time {
  font-family: "JetBrains Mono", monospace;
  font-size: .7rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: .6rem;
}

.post-header h1 {
  font-family: "Lora","Georgia", serif;
  font-size: clamp(1.4rem, 4vw, 1.95rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: .65rem;
}

.post-lead {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* prose */
.prose {
  font-size: .97rem;
  line-height: 1.82;
  color: var(--text);
}

.prose h2 {
  font-family: "JetBrains Mono", monospace;
  font-size: .77rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 2.7rem 0 .85rem;
}

.prose h3 {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.9rem 0 .65rem;
}

.prose p { margin-bottom: 1.3rem; }

.prose a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: color .15s, text-decoration-color .15s;
}
.prose a:hover { color: var(--link-hover); text-decoration-color: var(--link-hover); }

.prose :not(pre) > code {
  font-family: "JetBrains Mono", monospace;
  font-size: .8rem;
  background: var(--code-bg);
  color: var(--accent);
  padding: .14em .38em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.prose pre {
  background: var(--code-bg) !important;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 1.4rem 0;
  overflow-x: auto;
}
.prose pre > code {
  font-family: "JetBrains Mono", monospace !important;
  font-size: .79rem !important;
  line-height: 1.7 !important;
  background: transparent !important;
  border: none !important;
  padding: 1.1rem 1.3rem !important;
  display: block !important;
  color: var(--syn-base) !important;
  text-shadow: none !important;
}

.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--syn-comment) !important; font-style: italic; }
.token.keyword, .token.boolean, .token.important { color: var(--syn-keyword) !important; }
.token.function, .token.function-name, .token.method { color: var(--syn-fn) !important; }
.token.string, .token.char, .token.attr-value { color: var(--syn-string) !important; }
.token.number, .token.hexcode, .token.symbol { color: var(--syn-number) !important; }
.token.operator, .token.punctuation { color: var(--syn-punct) !important; }
.token.class-name, .token.builtin, .token.namespace { color: var(--syn-type) !important; }
.token.parameter, .token.attr-name, .token.variable { color: var(--syn-param) !important; }
.token.macro, .token.directive, .token.macro.directive-hash { color: var(--syn-macro) !important; }
.token.deleted { color: var(--syn-del) !important; }
.token.inserted { color: var(--syn-string) !important; }
.token.selector, .token.tag { color: var(--syn-type) !important; }

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.1rem;
  margin: 1.4rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.prose ul, .prose ol { padding-left: 1.4rem; margin-bottom: 1.3rem; }
.prose li { margin-bottom: .3rem; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.4rem 0; }
.prose strong { color: var(--text); font-weight: 600; }
.prose img { max-width: 100%; border-radius: 4px; border: 1px solid var(--border); display: block; margin: 1.4rem 0; }

/* footer */
footer {
  border-top: 1px solid var(--border);
  padding: 1.2rem 1.5rem;
  text-align: center;
}
footer p {
  font-family: "JetBrains Mono", monospace;
  font-size: .67rem;
  color: var(--text-dim);
  letter-spacing: .04em;
}

/* scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* responsive */
@media (max-width: 500px) {
  .topbar { padding: 1.2rem 1rem 0; }
  .page   { padding: 0 1rem; }
}
