/* ============================================================
   qpm-theme.css — 子站风格匹配主站（www.51qpm.cn）A 层覆盖
   原则：只覆盖视觉，不动 DOM 结构；加载于 theme.min.css 之后。
   主站 token：竹绿 #159a68 / 深绿 #0f8357 / 墨绿 #143528
   ============================================================ */

/* ---------- 1. 变量重映射：Relearn 蓝 → 主站竹绿 ---------- */
:root {
  --MAIN-LINK-color: #159a68;
  --MAIN-LINK-HOVER-color: #0f8357;
  --MAIN-font: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --MAIN-letter-spacing: 0;
  --MAIN-TITLES-H1-color: #143528;
  --MAIN-TITLES-H2-color: #143528;
  --MAIN-TITLES-H3-color: #1c4a38;
  --MAIN-TITLES-H1-letter-spacing: 0;
  --MAIN-TITLES-H2-letter-spacing: 0;
  --MAIN-TITLES-H3-letter-spacing: 0;
  --MAIN-TITLES-H1-font-weight: 700;
  --MAIN-TITLES-H2-font-weight: 700;
  --MAIN-TITLES-H3-font-weight: 600;
  --MENU-HEADER-BG-color: transparent;
  --INTERNAL-MENU-SECTIONS-ACTIVE-BG-color: #eaf6ef;
  /* sidebar 浅色底 + 深色文字 */
  --INTERNAL-MENU-SECTIONS-BG-color: #f7faf8;
  --INTERNAL-MENU-SECTIONS-LINK-color: #33463d;
  --INTERNAL-MENU-SECTIONS-LINK-HOVER-color: #159a68;
}

/* ---------- 2. 全局字体：去 Roboto Flex，系统字体栈 ---------- */
html, body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
  letter-spacing: 0 !important;
  font-variation-settings: normal !important;
}
h1, h2, h3, h4, h5, h6 {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
  letter-spacing: 0 !important;
  font-variation-settings: normal !important;
  line-height: 1.35;
}
#R-body p, #R-body li {
  line-height: 1.85;
}
#R-body h1 { font-size: 2rem; font-weight: 700; color: #143528; }
#R-body h2 { font-size: 1.5rem; font-weight: 700; color: #143528; margin-top: 2.2rem; }
#R-body h3 { font-size: 1.25rem; font-weight: 600; color: #1c4a38; }

/* ---------- 3. topbar 主站化：白底 + 阴影 + pill 按钮 ---------- */
#R-topbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e9efeb !important;
  box-shadow: 0 1px 2px rgba(16, 42, 32, 0.05), 0 10px 28px -12px rgba(16, 42, 32, 0.10) !important;
  min-height: 56px !important;
}
#R-topbar .topbar-wrapper {
  background: transparent !important;
}
#R-topbar .topbar-control,
#R-topbar button.topbar-control {
  border-radius: 999px !important;
  transition: background-color .2s ease, color .2s ease !important;
}
#R-topbar .topbar-control:hover,
#R-topbar button.topbar-control:hover {
  background: #eaf6ef !important;
  color: #0f8357 !important;
}
/* 返回主站按钮：绿色 pill */
#R-topbar .topbar-button-home .topbar-control {
  background: #159a68 !important;
  color: #ffffff !important;
  font-weight: 600;
}
#R-topbar .topbar-button-home .topbar-control:hover {
  background: #0f8357 !important;
  color: #ffffff !important;
}

/* ---------- 4. 面包屑绿色系 ---------- */
.topbar-breadcrumbs .breadcrumbs a,
.topbar-breadcrumbs .breadcrumbs span {
  color: #7a8b82 !important;
  font-size: .82rem;
}
.topbar-breadcrumbs .breadcrumbs a:hover {
  color: #159a68 !important;
}

/* ---------- 5. sidebar 浅色底 + 深色文字（与主站内页一致） ---------- */
#R-sidebar {
  background: #f7faf8 !important;
  border-right: 1px solid #e4ece7 !important;
}
#R-sidebar .R-sidebarmenu .padding a {
  color: #33463d !important;
  border-radius: 8px;
  transition: color .15s ease, background-color .15s ease !important;
}
#R-sidebar .R-sidebarmenu .padding a:hover {
  color: #159a68 !important;
  background: #eaf6ef !important;
}
#R-sidebar li.active > label,
#R-sidebar li.active > a {
  color: #0f8357 !important;
  font-weight: 700 !important;
  background: #dcefe3 !important;
  box-shadow: inset 3px 0 0 #159a68 !important;
}
#R-sidebar .R-sidebarmenu > ul > li > a {
  font-weight: 500;
}
/* 搜索框与 logo 标题（浅色底） */
#R-sidebar .searchbox input,
#R-sidebar .searchbox input::placeholder {
  color: #33463d !important;
}
#R-sidebar .searchbox {
  background: #ffffff !important;
  border-radius: 8px !important;
}
#R-sidebar .searchbox input {
  background: #ffffff !important;
  border: 1px solid #e4ece7 !important;
}
#R-sidebar .searchbox input::placeholder {
  color: #9aab9f !important;
}
#R-sidebar .logo-title {
  color: #143528 !important;
}

/* ---------- 6. 列表卡片化：children-title → 主站 q-card 语言 ---------- */
#R-body .children .children-title {
  display: block;
  margin: 0 -1.2rem;
  padding: .85rem 1.2rem;
  border-radius: 16px;
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease !important;
}
#R-body .children .children-title a {
  color: #143528 !important;
  font-weight: 600 !important;
  font-size: 1.02rem !important;
}
#R-body .children .children-title:hover {
  background: #f7faf8 !important;
  box-shadow: 0 1px 2px rgba(16, 42, 32, 0.05), 0 10px 28px -12px rgba(16, 42, 32, 0.14) !important;
  transform: translateY(-2px);
}
#R-body .children .children-title:hover a {
  color: #159a68 !important;
}

/* ---------- 7. 正文链接绿色 ---------- */
#R-body a {
  color: #159a68 !important;
}
#R-body a:hover {
  color: #0f8357 !important;
}

/* ---------- 8. 代码块/引用等细节调绿（可选轻量） ---------- */
#R-body blockquote {
  border-left-color: #159a68 !important;
  background: #f7faf8 !important;
}

/* ---------- 9. 移动端：隐藏主站按钮和面包屑，释放空间 ---------- */
@media screen and (max-width: 47.999rem) {
  #R-topbar .topbar-button-home {
    display: none !important;
  }
  .topbar-breadcrumbs {
    display: none !important;
  }
  /* 文章底部和页脚的"返回主站"也隐藏，手机端用浏览器返回键即可 */
  .back-to-mainsite,
  .footer-back-mainsite {
    display: none !important;
  }
}

/* ---------- 10. 打印页还原 ---------- */
@media print {
  #R-topbar { background: #fff !important; box-shadow: none !important; }
  #R-body .children .children-title { box-shadow: none !important; transform: none !important; }
}
