/* 全站公共追加样式（非 hub 专属）
   ---------------------------------------
   - 品牌 logo 悬浮无下划线
   - 备案预览面板 .vp-*（长按品牌 logo 唤起）
*/

/* 品牌 logo 悬浮不要下划线（全局 a:hover 会加） */
.brand,
.brand:hover,
.brand:focus {
  text-decoration: none;
}

/* 顶部导航交互样式：统一点击区 + hover 颜色。
   ⛔ 之前用 var(--primary)，但全站只定义了 --accent，导致颜色失效。
   只作用于普通 tab，保留 lang-switch / nav-back 各自样式。 */
.nav-links a:not(.lang-switch):not(.nav-back) {
  padding: 6px 12px;
  border-radius: 999px;
  transition: color .15s, background .15s;
}
.nav-links a:not(.lang-switch):not(.nav-back):hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
/* 当前页：醒目胶囊高亮（aria-current="page" 由 mark-nav-current.cjs 静态写入） */
.nav-links a[aria-current="page"] {
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}
.nav-links a[aria-current="page"]:hover {
  color: #fff;
  background: var(--accent);
}

.vp-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 20px;
  animation: vp-fade .18s ease;
}
@keyframes vp-fade { from { opacity: 0; } to { opacity: 1; } }
.vp-dialog {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  color: var(--ink);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--divider);
}
.vp-title { font-size: 17px; font-weight: 700; }
.vp-sub {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}
.vp-warn {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--badge-warn-bg);
  color: var(--badge-warn-fg);
  font-size: 12px;
  line-height: 1.55;
}
.vp-hub input[disabled] { accent-color: var(--muted); cursor: not-allowed; }
.vp-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}
.vp-row:hover { background: var(--bg); }
.vp-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.vp-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex: 0 0 auto;
}
.vp-name { color: var(--ink); }
.vp-tag {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
}
.vp-row input:disabled {
  accent-color: var(--accent);
  cursor: not-allowed;
}
.vp-row:has(input:disabled) { cursor: default; opacity: 0.92; }
.vp-hub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
  font-size: 13.5px;
  color: var(--ink2);
  cursor: pointer;
}
.vp-hub input { width: 17px; height: 17px; accent-color: var(--accent); }
.vp-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.vp-actions button {
  font-size: 13.5px;
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--divider);
  background: var(--surface);
  color: var(--ink2);
  cursor: pointer;
}
.vp-actions .vp-save {
  background: var(--fill-strong);
  color: var(--on-fill);
  border-color: var(--fill-strong);
}
.vp-actions button:hover { opacity: .9; }

/* ─── 文档页悬浮目录 (TOC) ───────────────────────
   宽屏：目录与文章同处一个居中容器，grid 两栏，目录 sticky 贴在文章左边缘；
   窄屏：浮动按钮唤起底部抽屉。 */

/* 浮动按钮 + 遮罩（仅窄屏显示） */
.toc-fab {
  display: none;
  position: fixed;
  left: 20px;
  bottom: 24px;
  z-index: 60;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--fill-strong);
  color: var(--on-fill);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  place-items: center;
  line-height: 0;
}
.toc-fab:hover { transform: translateY(-1px); }
.toc-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 70;
  opacity: 0;
  transition: opacity .2s ease;
}
.toc-mask.open { display: block; opacity: 1; }

/* 两栏布局：左侧用一个空占位点(.toc-anchor)留出目录宽度，把文章挤到右列；
   真正的目录面板是 position:fixed 钉在视口垂直居中，JS 把它的 left/width
   对齐到占位点，所以滚动时目录始终在视口中间、不随内容移动。 */
.doc-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.toc-anchor {
  /* 仅用于占位取坐标，本身不可见 */
  width: 220px;
  height: 1px;
}

.toc-panel {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);  /* 始终钉在视口垂直居中，不随滚动移动 */
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 4px 4px 8px;
  font-size: 13px;
  line-height: 1.4;
  -webkit-overflow-scrolling: touch;
  z-index: 50;
}
.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--ink);
  margin: 0 6px 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.toc-close {
  display: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { margin: 1px 0; }
.toc-list a {
  display: block;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}
.toc-list .toc-h3 a { padding-left: 20px; font-size: 12.5px; }
.toc-list a:hover { color: var(--ink); background: var(--bg); }
.toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-weight: 600;
}

/* 窄屏（<1024px）：单列，常驻面板隐藏，浮动按钮唤起底部抽屉 */
@media (max-width: 1023px) {
  .doc-layout { display: block; }
  .toc-fab { display: grid; }
  .toc-panel {
    position: fixed;
    left: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: 380px;
    max-height: 78vh;
    padding: 16px;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-card);
    border-top: 1px solid var(--divider);
    z-index: 80;
    transform: translateY(105%);
    transition: transform .25s cubic-bezier(.2,.8,.2,1);
    overflow-y: auto;
  }
  .toc-panel.open { transform: translateY(0); }
  .toc-close { display: block; }
}
