/* ---------- 设计令牌 ---------- */
:root {
  --bg: #fdfdfc;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #59636e;
  --faint: #8b949e;
  --line: #e6e9ec;
  --line-soft: #eff2f4;
  --accent: #146c43;
  --accent-soft: #eaf5ee;
  --code-bg: #14181d;
  --code-text: #d6dde5;
  --mark: #fff8c5;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #151921;
    --text: #e6e9ee;
    --muted: #9aa4b2;
    --faint: #6b7482;
    --line: #232833;
    --line-soft: #1b2028;
    --accent: #4ec98a;
    --accent-soft: rgba(78, 201, 138, 0.12);
    --code-bg: #0a0d11;
    --code-text: #cfd7e0;
    --mark: rgba(255, 213, 0, 0.16);
  }
}

/* ---------- 基础 ---------- */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--mark);
}

/* ---------- 布局 ---------- */
.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 页头 ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 58px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand .sigil {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 2px 7px;
  font-weight: 500;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14.5px;
  padding: 6px 10px;
  border-radius: 6px;
  transition:
    color 140ms ease,
    background-color 140ms ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--line-soft);
}

.nav a[aria-current='page'] {
  color: var(--text);
  font-weight: 600;
  background: var(--line-soft);
}

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 84px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.site-footer .wrap {
  padding-top: 22px;
  padding-bottom: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--faint);
}

.site-footer a {
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 140ms ease,
    border-color 140ms ease;
}

.site-footer a:hover {
  color: var(--muted);
  border-bottom-color: var(--line);
}

/* ---------- 首页 hero ---------- */
.hero {
  padding: 64px 0 40px;
}

.hero .kicker {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 14px;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.hero p {
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 34em;
}

.hero p:last-child {
  margin-bottom: 0;
}

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 46px 0 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.section-head a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.section-head a:hover {
  color: var(--accent);
}

/* ---------- 文章列表 ---------- */
.posts {
  list-style: none;
  margin: 0;
  padding: 0;
}

.posts li {
  border-bottom: 1px solid var(--line-soft);
}

.posts li:last-child {
  border-bottom: none;
}

.posts a {
  display: block;
  padding: 20px 4px;
  text-decoration: none;
  color: inherit;
  transition: background-color 140ms ease;
  border-radius: 6px;
}

.posts a:hover {
  background: var(--line-soft);
}

.posts h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 620;
  line-height: 1.45;
  color: var(--text);
}

.posts a:hover h3 {
  color: var(--accent);
}

.posts p {
  margin: 0 0 8px;
  font-size: 14.5px;
  color: var(--muted);
}

.meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

/* ---------- 文章页 ---------- */
.article {
  padding: 52px 0 0;
}

.article-head {
  margin-bottom: 34px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.article-head h1 {
  margin: 0 0 14px;
  font-size: clamp(24px, 4.4vw, 32px);
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: -0.012em;
}

.prose {
  font-size: 16.5px;
  line-height: 1.85;
}

.prose > *:first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.1em 0 0.7em;
  font-size: 20px;
  font-weight: 640;
  letter-spacing: -0.008em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line-soft);
}

.prose h3 {
  margin: 1.7em 0 0.55em;
  font-size: 17px;
  font-weight: 620;
}

.prose p {
  margin: 0 0 1.05em;
}

.prose strong {
  font-weight: 620;
}

.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.prose a:hover {
  border-bottom-color: var(--accent);
}

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

.prose li {
  margin: 0.3em 0;
}

.prose li::marker {
  color: var(--faint);
}

.prose blockquote {
  margin: 1.3em 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.prose hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* 行内代码 */
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono',
    monospace;
  font-size: 0.88em;
  background: var(--line-soft);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* 代码块 */
.prose pre {
  margin: 1.35em 0;
  padding: 16px 18px;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13.2px;
  line-height: 1.72;
  tab-size: 2;
}

.prose pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  white-space: pre;
  font-size: inherit;
}

/* 表格 */
.prose table {
  width: 100%;
  margin: 1.3em 0;
  border-collapse: collapse;
  font-size: 14.5px;
}

.prose th,
.prose td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.prose th {
  font-weight: 600;
  color: var(--muted);
  font-size: 13.5px;
  border-bottom-color: var(--line);
}

.prose tbody tr:hover {
  background: var(--line-soft);
}

/* 提示块 */
.note {
  margin: 1.4em 0;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
}

.note .label {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 5px;
}

/* 文末导航 */
.article-foot {
  margin-top: 46px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 14px;
}

.article-foot a {
  color: var(--muted);
  text-decoration: none;
}

.article-foot a:hover {
  color: var(--accent);
}

/* ---------- 关于页 ---------- */
.page {
  padding: 52px 0 0;
}

.page h1 {
  margin: 0 0 26px;
  font-size: clamp(24px, 4.4vw, 32px);
  font-weight: 650;
  letter-spacing: -0.012em;
}

.dl-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.dl-list > div {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 8px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.dl-list dt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 3px;
}

.dl-list dd {
  margin: 0;
  color: var(--muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 600px) {
  .wrap {
    padding: 0 18px;
  }
  .site-header .wrap {
    min-height: 54px;
    gap: 12px;
  }
  .nav a {
    padding: 6px 8px;
    font-size: 14px;
  }
  .hero {
    padding: 44px 0 30px;
  }
  .prose {
    font-size: 16px;
  }
  .dl-list > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .prose table {
    font-size: 13.5px;
  }
  .prose th,
  .prose td {
    padding: 8px 8px;
  }
}
