* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --code-bg: #f3f4f6;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --card-hover-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --fg: #e4e4e7;
    --muted: #a1a1aa;
    --border: #27272a;
    --accent: #60a5fa;
    --accent-hover: #93bbfd;
    --code-bg: #1c1c1f;
    --card-bg: #18181b;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --card-hover-shadow: 0 4px 12px rgba(0,0,0,0.4);
  }
}

html { min-height: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-wrap { display: flex; flex: 1; position: relative; }

main { flex: 1; min-width: 0; }

/* TOC sidebar */
.toc {
  position: fixed;
  left: max(0.5rem, calc((100vw - 720px) / 2 - 220px));
  top: 6rem;
  width: 200px;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 0.8rem;
  line-height: 1.5;
}

.toc-title {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border);
}

.toc li a {
  display: block;
  padding: 0.25rem 0.75rem;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.toc li a:hover {
  color: var(--fg);
  text-decoration: none;
}

.toc li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.toc .toc-h3 a {
  padding-left: 1.5rem;
  font-size: 0.75rem;
}

.toc .toc-h4 a {
  padding-left: 2rem;
  font-size: 0.7rem;
}

@media (max-width: 1560px) {
  .toc { display: none; }
}

/* Header */
header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.logo {
  text-decoration: none;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  line-height: 1;
  background: linear-gradient(135deg, #ef4444, #a855f7, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo:hover {
  background: linear-gradient(135deg, #dc2626, #9333ea, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

/* Search */
.search-wrap {
  position: relative;
  width: 220px;
  flex-shrink: 0;
}

.search-wrap svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

#search {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

#search::placeholder { color: var(--muted); }

/* Post list */
.post-list { list-style: none; padding: 0; }

.post-list li {
  margin-bottom: 0.75rem;
}

.post-list a {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg);
  font-weight: 500;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.post-list a:hover {
  border-color: var(--accent);
  box-shadow: var(--card-hover-shadow);
}

.post-meta {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 0.2rem;
}

/* Post content */
h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #3b82f6, #a855f7, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
h2 { font-size: 1.4rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.15rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1.25rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Code blocks */
pre {
  background: var(--code-bg);
  padding: 1.25rem;
  overflow-x: auto;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 0.875em;
}

p code, li code, h1 code, h2 code, h3 code, a code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
  -webkit-text-fill-color: initial;
  color: var(--fg);
}

/* hljs overrides */
.hljs { background: var(--code-bg) !important; }

/* Lists */
ul, ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
li { margin-bottom: 0.25rem; }

/* Blockquote */
blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-style: italic;
}

/* Callouts */
.callout {
  border-left: 4px solid var(--accent);
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  border-radius: 4px;
  margin-bottom: 1.25rem;
  color: var(--fg);
  font-style: normal;
}
.callout p:last-child { margin-bottom: 0; }
.callout .callout-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.callout-note { border-left-color: #3b82f6; }
.callout-note .callout-title { color: #3b82f6; }
.callout-tip { border-left-color: #10b981; }
.callout-tip .callout-title { color: #10b981; }
.callout-warning { border-left-color: #f59e0b; }
.callout-warning .callout-title { color: #f59e0b; }
.callout-error, .callout-danger { border-left-color: #ef4444; }
.callout-error .callout-title, .callout-danger .callout-title { color: #ef4444; }

/* Images */
img { max-width: 100%; border-radius: 8px; margin-bottom: 1.25rem; }

/* Horizontal rule */
hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

th, td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

th { background: var(--code-bg); font-weight: 600; }

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

/* No results */
.no-results {
  display: none;
  text-align: center;
  color: var(--muted);
  padding: 2rem 0;
}
center;
  color: var(--muted);
  padding: 2rem 0;
}
