/* =========================================================
   个人的技术分享 — 站点样式
   纯静态，无外部依赖
   ========================================================= */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --text: #16181d;
  --text-2: #3f4753;
  --muted: #6b7280;
  --border: #e7e9ee;
  --border-strong: #d5d9e0;
  --accent: #2457d6;
  --accent-hover: #1b46b3;
  --accent-soft: #eef3ff;
  --code-bg: #f6f7f9;
  --code-border: #e7e9ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px -14px rgba(16, 24, 40, 0.18);
  --max: 1080px;
  --max-read: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #141922;
    --surface-2: #1a2029;
    --text: #e6e9ef;
    --text-2: #c3c9d4;
    --muted: #98a2b3;
    --border: #232a36;
    --border-strong: #2f3846;
    --accent: #7aa2ff;
    --accent-hover: #9ab8ff;
    --accent-soft: #17203a;
    --code-bg: #161c26;
    --code-border: #232a36;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -16px rgba(0, 0, 0, 0.8);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- 顶部导航 ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

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

.site-nav a {
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14.5px;
}

.site-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------------- 首页 Hero ---------------- */

.hero {
  padding: 72px 0 48px;
  border-bottom: 1px solid var(--border);
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.hero .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 750;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  max-width: 620px;
  margin: 0;
  color: var(--text-2);
  font-size: 17px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.chip {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
}

/* ---------------- 区块标题 ---------------- */

.section {
  padding: 56px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------------- 文章卡片 ---------------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.post-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.post-card .tag {
  align-self: flex-start;
  margin-bottom: 14px;
}

.post-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.45;
}

.post-card h3 a {
  color: var(--text);
}

.post-card h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-card p {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.7;
}

.post-card .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
}

.post-card .meta span::before {
  content: "·";
  margin-right: 10px;
  color: var(--border-strong);
}

.post-card .meta span:first-child::before {
  content: none;
  margin: 0;
}

/* ---------------- 文章页 ---------------- */

.article-wrap {
  max-width: var(--max-read);
  margin: 0 auto;
  padding: 56px 24px 24px;
}

.breadcrumb {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 13.5px;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb span {
  margin: 0 8px;
  color: var(--border-strong);
}

.article-header {
  padding-bottom: 26px;
  margin-bottom: 34px;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  margin: 8px 0 16px;
  font-size: clamp(27px, 4.4vw, 36px);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.article-body {
  font-size: 16.5px;
  color: var(--text-2);
}

.article-body h2 {
  margin: 46px 0 16px;
  padding-top: 6px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  scroll-margin-top: 84px;
}

.article-body h3 {
  margin: 32px 0 12px;
  color: var(--text);
  font-size: 18px;
  scroll-margin-top: 84px;
}

.article-body p {
  margin: 0 0 18px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body strong {
  color: var(--text);
  font-weight: 650;
}

.article-body code {
  padding: 2px 6px;
  border: 1px solid var(--code-border);
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88em;
}

.article-body pre {
  margin: 0 0 22px;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--code-border);
  border-radius: 12px;
  background: var(--code-bg);
  line-height: 1.62;
  tab-size: 4;
}

.article-body pre code {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 13.5px;
  white-space: pre;
}

.article-body blockquote {
  margin: 0 0 22px;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--accent-soft);
  color: var(--text-2);
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.article-body table {
  width: 100%;
  margin: 0 0 22px;
  border-collapse: collapse;
  font-size: 14.5px;
}

.article-body th,
.article-body td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.article-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

/* ---------------- 关于页 / 通用内容页 ---------------- */

.page-wrap {
  max-width: var(--max-read);
  margin: 0 auto;
  padding: 56px 24px;
}

.page-wrap h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4.4vw, 36px);
  letter-spacing: -0.02em;
}

.page-wrap .lead {
  margin: 0 0 36px;
  color: var(--muted);
  font-size: 16px;
}

.page-wrap h2 {
  margin: 40px 0 14px;
  font-size: 20px;
}

.page-wrap p,
.page-wrap li {
  color: var(--text-2);
}

.page-wrap ul {
  padding-left: 22px;
}

.page-wrap li {
  margin-bottom: 8px;
}

.card {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 16px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.card p {
  margin: 0;
  font-size: 14.5px;
}

.card dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 14.5px;
}

.card dt {
  color: var(--muted);
}

.card dd {
  margin: 0;
  color: var(--text);
  word-break: break-all;
}

/* ---------------- 页脚 ---------------- */

.site-footer {
  margin-top: 40px;
  padding: 40px 0 48px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 28px;
}

.footer-brand {
  max-width: 420px;
}

.footer-brand .brand {
  margin-bottom: 10px;
}

.footer-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.footer-links a {
  color: var(--text-2);
}

.footer-links a:hover {
  color: var(--accent);
}

.beian {
  width: 100%;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.beian p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.beian a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

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

.beian img {
  width: 16px;
  height: 16px;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 640px) {
  .container {
    padding: 0 18px;
  }

  .brand-sub {
    display: none;
  }

  .site-nav a {
    padding: 7px 9px;
    font-size: 14px;
  }

  .hero {
    padding: 48px 0 36px;
  }

  .section {
    padding: 40px 0;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .article-wrap,
  .page-wrap {
    padding-top: 36px;
  }

  .article-body {
    font-size: 16px;
  }

  .card dl {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .card dd {
    margin-bottom: 8px;
  }
}
