/* sub-header.css — 全站公共子导航（配套 site.js 自动生成 DOM）。
   与 page-template.css 的 .cp-subnav 样式保持一致；已有内联定义的页面不受影响。
   状态类：body.cp-subnav-on 接管顶部 / html.cp-compact 收成紧凑条。 */
:root { --cp-subnav-h: 64px; }
.cp-subnav {
  position: fixed; left: 0; right: 0; top: 0; z-index: 110;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  transform: translateY(-100%);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .28s ease, opacity .2s ease, visibility .28s;
}
body.cp-subnav-on .cp-subnav {
  transform: translateY(0); opacity: 1; visibility: visible; pointer-events: auto;
}
#site-header { transition: transform .28s ease, opacity .2s ease; }
body.cp-subnav-on #site-header {
  transform: translateY(-100%); opacity: 0; visibility: hidden; pointer-events: none;
}
.cp-subnav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: var(--cp-subnav-h); display: flex; align-items: center; gap: 18px;
}
.cp-subnav__brand { flex: 0 0 auto; font-size: 15px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.cp-subnav__menu { position: relative; flex: 0 0 auto; margin-left: auto; }
.cp-subnav__toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  color: var(--ink-2); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.cp-subnav__toggle:hover { border-color: var(--blue); color: var(--blue); }
.cp-subnav__toggle svg { width: 16px; height: 16px; }
.cp-subnav__panel {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 1;
  width: 274px; max-height: 70vh; overflow-y: auto; padding: 10px;
  display: grid; gap: 2px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 14px 44px rgba(0,0,0,.14);
}
.cp-subnav__panel[hidden] { display: none; }
.cp-subnav__panel a {
  display: flex; align-items: baseline; gap: 10px; padding: 8px 10px;
  border-radius: 9px; font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.cp-subnav__panel a:hover, .cp-subnav__panel a.is-active { background: var(--bg-soft); color: var(--blue); }
.cp-subnav__panel a span { flex: 0 0 auto; font-size: 11px; color: var(--ink-soft); }
.cp-subnav__inquiry { flex: 0 0 auto; display: inline-flex; align-items: center; }
/* h2 自动生成的锚点：跳转时给顶栏留出空间 */
main h2[id] { scroll-margin-top: calc(var(--cp-subnav-h) + 16px); }
html.cp-compact { --cp-subnav-h: 48px; }
html.cp-compact .cp-subnav__brand { font-size: 13px; }
html.cp-compact .cp-subnav__inquiry { padding-top: 6px; padding-bottom: 6px; font-size: 12px; }
@media (max-width: 980px) { .cp-subnav__inner { padding: 0 16px; gap: 12px; } }
@media (max-width: 720px) {
  :root { --cp-subnav-h: 48px; }
  .cp-subnav__inner { padding: 0 14px; gap: 9px; }
  .cp-subnav__brand { font-size: 13px; }
  .cp-subnav__inquiry { padding: 8px 14px; font-size: 13px; }
  .cp-subnav__panel { width: min(274px, calc(100vw - 28px)); }
}
