/* ==========================================================================
   范亚鹏的个人博客 —— 个人非经营性学习博客
   纯手写 CSS，无第三方框架、无外部字体、无统计与广告脚本
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --bg-soft: #eceef2;
  --card: #ffffff;
  --text: #1f2733;
  --text-soft: #5b6675;
  --text-mute: #8a94a3;
  --line: #e3e7ec;
  --brand: #2f6f8f;
  --brand-deep: #1f5470;
  --brand-soft: #e7f1f6;
  --accent: #c47a3d;
  --code-bg: #f4f6f8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(24, 39, 58, .05), 0 8px 24px rgba(24, 39, 58, .06);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-deep); text-decoration: underline; }

img { max-width: 100%; height: auto; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(6px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: .5px;
}
.brand:hover { color: var(--brand-deep); text-decoration: none; }

.brand .logo {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.brand small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-mute);
  letter-spacing: 0;
  line-height: 1.3;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 15px;
}
.nav-links a:hover { background: var(--bg-soft); color: var(--brand-deep); text-decoration: none; }
.nav-links a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 15px;
  color: var(--text-soft);
  cursor: pointer;
}

/* ---------- 主体布局 ---------- */
main { flex: 1 0 auto; padding: 28px 0 8px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
}

.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.35; }
.page-head p { margin: 0; color: var(--text-soft); font-size: 15px; }

/* ---------- 首页导语 ---------- */
.intro {
  background: linear-gradient(135deg, #ffffff 0%, var(--brand-soft) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.intro h1 { margin: 0 0 8px; font-size: 24px; }
.intro p { margin: 0 0 10px; color: var(--text-soft); }
.intro .tag-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 13px;
}
.chip.brand { background: var(--brand-soft); border-color: #cfe2ec; color: var(--brand-deep); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text);
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 3px solid var(--brand);
  line-height: 1.2;
}

/* ---------- 文章列表 ---------- */
.post-list { display: grid; gap: 16px; }

.post-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: border-color .18s ease, transform .18s ease;
}
.post-item:hover { border-color: #c9dbe5; transform: translateY(-1px); }

.post-item h2 { margin: 0 0 6px; font-size: 19px; line-height: 1.5; }
.post-item h2 a { color: var(--text); }
.post-item h2 a:hover { color: var(--brand); text-decoration: none; }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.post-meta time { color: var(--text-mute); }

.post-excerpt { margin: 0; color: var(--text-soft); font-size: 15px; }

.read-more { display: inline-block; margin-top: 10px; font-size: 14px; }

/* ---------- 侧栏 ---------- */
.sidebar { display: grid; gap: 18px; position: sticky; top: 84px; }

.kv { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.kv li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv li:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--text-mute); }
.kv span:last-child { color: var(--text-soft); }

.cat-list, .plain-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.cat-list li + li, .plain-list li + li { margin-top: 8px; }
.cat-list a { display: flex; justify-content: space-between; color: var(--text-soft); }
.cat-list a:hover { color: var(--brand); text-decoration: none; }
.cat-list em { font-style: normal; color: var(--text-mute); font-size: 13px; }
.plain-list li { color: var(--text-soft); padding-left: 14px; position: relative; }
.plain-list li::before {
  content: "";
  position: absolute; left: 0; top: .68em;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand);
  opacity: .55;
}

.progress-row { font-size: 13px; color: var(--text-soft); margin-bottom: 8px; }
.bar { height: 7px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

.notice {
  font-size: 13px;
  color: var(--text-soft);
  background: #fbf7f1;
  border: 1px solid #ecdfcb;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.7;
}
.notice strong { color: var(--accent); }

/* ---------- 文章正文 ---------- */
.article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 34px 34px;
  box-shadow: var(--shadow);
}

.article h1 { font-size: 27px; line-height: 1.45; margin: 0 0 10px; }
.article h2 { font-size: 21px; margin: 34px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.article h3 { font-size: 17px; margin: 24px 0 10px; }
.article p { margin: 0 0 14px; }
.article ul, .article ol { margin: 0 0 14px; padding-left: 24px; }
.article li { margin-bottom: 6px; }
.article li::marker { color: var(--brand); }

.article blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
}
.article blockquote p:last-child { margin-bottom: 0; }

.article code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: #b4441f;
}

.article pre {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: #22303c;
  color: #e6edf3;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.65;
  font-size: 14px;
}
.article pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 14px;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 18px;
  font-size: 14.5px;
}
.article th, .article td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.article th { background: var(--bg-soft); font-weight: 600; }

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; }

.article-foot {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text-mute);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}
.pager a {
  flex: 1 1 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-soft);
  box-shadow: var(--shadow);
}
.pager a:hover { border-color: #c9dbe5; color: var(--brand-deep); text-decoration: none; }
.pager a span { display: block; font-size: 12px; color: var(--text-mute); margin-bottom: 4px; }
.pager .next { text-align: right; }

/* ---------- 关于页 ---------- */
.about-grid { display: grid; gap: 18px; }
.about-grid h2 { font-size: 19px; margin: 0 0 10px; }
.def-list { margin: 0; font-size: 15px; }
.def-list div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.def-list div:last-child { border-bottom: 0; }
.def-list dt { color: var(--text-mute); }
.def-list dd { margin: 0; color: var(--text-soft); }

/* ---------- 底部（含备案信息悬挂） ---------- */
.site-footer {
  margin-top: 34px;
  background: #22303c;
  color: #b9c4cf;
  border-top: 3px solid var(--brand);
  font-size: 14px;
}

.footer-inner { padding: 26px 0 22px; }

.footer-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.footer-cols h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #eef2f6;
  letter-spacing: .5px;
}
.footer-cols p { margin: 0 0 8px; color: #a9b5c1; line-height: 1.8; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin-bottom: 7px; }
.footer-cols a { color: #b9c4cf; }
.footer-cols a:hover { color: #fff; }

/* 备案信息：必须全站每页底部可见、可点击跳转工信部 */
.beian {
  padding: 18px 0 4px;
  text-align: center;
  line-height: 2;
  color: #a9b5c1;
}
.beian .beian-line { display: block; }
.beian a {
  color: #d7e2ec;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.beian a:hover { color: #fff; }
.beian .icp { font-weight: 600; letter-spacing: .5px; }
.beian .tip { font-size: 12.5px; color: #8d99a6; }

/* 行内备案号链接：全站所有出现备案号的文字均可点击跳转工信部 */
a.icp-link {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}
a.icp-link:hover { text-decoration-thickness: 2px; }
.intro a.icp-link { color: var(--brand-deep); font-weight: 600; }
.kv a.icp-link { color: var(--brand); }
.notice a.icp-link { color: var(--accent); font-weight: 600; }
.article a.icp-link { color: var(--brand); }
.footer-cols a.icp-link { color: #d7e2ec; }
.footer-cols a.icp-link:hover { color: #fff; }

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 17px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.to-top.show { opacity: 1; visibility: visible; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; }
  .footer-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    left: 0; right: 0; top: 64px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 6px 16px 12px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 10px; border-radius: 6px; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .article { padding: 22px 18px 26px; }
  .intro { padding: 20px 18px; }
  .footer-cols { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .def-list div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pager { flex-direction: column; }
  .pager .next { text-align: left; }
}

@media print {
  .site-header, .sidebar, .to-top, .pager { display: none; }
  body { background: #fff; }
  .article { border: 0; box-shadow: none; padding: 0; }
}
