/* ===== Design tokens ===== */
:root {
  --bg: #ffffff;
  --bg-subtle: #f7f8fa;
  --bg-card: #ffffff;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --border: #e7e9ee;
  --accent: #4f46e5;
  --accent-soft: #eef0fe;
  --code-bg: #f3f4f6;
  --code-text: #24292f;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
  --maxw: 680px;
}

html[data-theme="dark"] {
  --bg: #0d1117;
  --bg-subtle: #11161d;
  --bg-card: #141a22;
  --text: #e6edf3;
  --text-muted: #98a2b3;
  --border: #232a33;
  --accent: #818cf8;
  --accent-soft: #1c2030;
  --code-bg: #161b22;
  --code-text: #d6dee7;
  --shadow: none;
}

/* ===== Base ===== */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}

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

img { max-width: 100%; height: auto; border-radius: 8px; }

.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 80px;
}

.dot { color: var(--text-muted); margin: 0 .15em; }

/* ===== Header ===== */
.site-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -.01em;
  color: var(--text);
}
.site-title:hover { text-decoration: none; color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

/* ===== Intro ===== */
.intro { padding: 24px 0 8px; }
.intro-title {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.15;
  margin: 0 0 .35em;
}
.intro-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ===== Post list ===== */
.post-list {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.post-card-link { display: block; padding: 22px 24px; color: inherit; }
.post-card-link:hover { text-decoration: none; }

.post-card-title {
  margin: 0 0 .35em;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--text);
}
.post-card-meta { margin: 0; font-size: .85rem; color: var(--text-muted); }
.post-card-excerpt { margin: .7em 0 0; color: var(--text-muted); font-size: .97rem; }

/* ===== Tags ===== */
.tags { margin: .9em 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: .76rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: .01em;
}

/* ===== Post page ===== */
.post-header { padding: 16px 0 28px; border-bottom: 1px solid var(--border); margin-bottom: 36px; }
.post-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin: 0 0 .4em;
}
.post-meta { margin: 0; font-size: .9rem; color: var(--text-muted); }

.post-body { font-size: 1.06rem; }
.post-body h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 1.8em 0 .6em; }
.post-body h3 { font-size: 1.2rem; font-weight: 600; margin: 1.6em 0 .5em; }
.post-body p { margin: 1.1em 0; }
.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body li { margin: .4em 0; }
.post-body blockquote {
  margin: 1.4em 0;
  padding: .2em 1.1em;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-radius: 0 8px 8px 0;
}
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }

/* code */
.post-body code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: .15em .4em;
  border-radius: 5px;
}
.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: .9rem;
  line-height: 1.55;
}
.post-body pre code { background: none; padding: 0; font-size: inherit; }

.post-nav { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border); font-weight: 500; }

/* ===== Footer ===== */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 48px;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ===== Small screens ===== */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .intro-title { font-size: 1.7rem; }
  .post-title { font-size: 1.7rem; }
}
