/* 侧栏目录（算法手册 / 帮助手册共用）
   样式源文件：pages/sass/nav-select.scss，修改后同步到本文件。
   目录 iframe 不加载 main.css，因此单独成文件。
   颜色优先取算法手册的 --algo-* 变量，帮助手册未定义时用同样的品牌色兜底。 */
html, body {
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  background: transparent;
  overflow-y: auto;
  overscroll-behavior-x: none;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #d8e2ee; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bfd0e2; }
::-webkit-scrollbar-track { background: transparent; }

.nav-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--algo-border, #e3e9f0);
  border-radius: 12px;
  padding: 16px 14px;
  box-shadow: 0 6px 18px rgba(31, 45, 61, .05);
}
.nav-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--algo-ink, #1f2d3d);
  padding: 2px 10px 12px;
  border-bottom: 1px solid var(--algo-border, #e3e9f0);
  margin-bottom: 10px;
}
.nav-title small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--algo-muted, #5c6b7e);
  margin-top: 4px;
}
.nav-group { margin-bottom: 4px; }
.nav-group--plain { margin-bottom: 10px; }
.nav-group-title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .04em;
  color: var(--algo-muted, #5c6b7e);
  text-align: left;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  min-width: 0;
  overflow-wrap: anywhere;
}
.nav-group-title > span:first-child { min-width: 0; }
.nav-caret { flex: 0 0 auto; }
.nav-group-title:hover { background: #f2f8ff; color: var(--algo-link, #178aec); }
.nav-group--collapsible.is-current > .nav-group-title {
  color: var(--algo-ink, #1f2d3d);
  background: #f7fbff;
}
.nav-group-title:focus-visible {
  outline: 2px solid rgba(15, 111, 196, .45);
  outline-offset: 2px;
}
.nav-group-title--static {
  cursor: default;
  font-weight: 700;
  color: var(--algo-ink, #1f2d3d);
  padding-bottom: 4px;
}
.nav-group-title--static:hover { background: transparent; color: var(--algo-ink, #1f2d3d); }
.nav-caret {
  font-size: 11px;
  line-height: 1;
  transition: transform .15s ease;
}
.nav-group-title[aria-expanded="true"] .nav-caret { transform: rotate(90deg); }
.nav-group-body { padding: 0 0 6px; }
.nav-group-body[hidden] { display: none; }
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #3d4d5f;
  padding: 7px 10px;
  border-radius: 6px;
  text-decoration: none;
  min-width: 0;
  overflow-wrap: anywhere;
}
.nav-link:hover { background: #f2f8ff; color: var(--algo-link, #178aec); }
/* 标签单独占一列，避免 <i>t</i> 这类行内标记被 flex 拆成多个项 */
.nav-label { flex: 1 1 auto; min-width: 0; }
.nav-link.active {
  background: #eaf4ff;
  color: var(--algo-link, #178aec);
  font-weight: 600;
}

/* 独立模块：整行就是一个链接，与分组标题同高同宽 */
.nav-standalone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 6px;
  padding: 9px 10px;
  border: 1px solid #d8e8fb;
  border-radius: 8px;
  background: #f7fbff;
  color: var(--algo-ink, #1f2d3d);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.4;
  text-decoration: none;
  min-width: 0;
}
.nav-standalone:hover,
.nav-standalone:focus {
  background: #eef6ff;
  border-color: #bfdcfa;
  color: var(--algo-link-hover, #0f6fc4);
  text-decoration: none;
}
.nav-standalone.is-current { border-color: #a9d2f7; }
.nav-standalone__text { min-width: 0; }
.nav-standalone__arrow { flex: 0 0 auto; font-size: 13px; }

/* 抽屉里目录条目比帮助中心紧凑一些，但不至于挤 */
@media (max-width: 980px) {
  /* 抽屉底部贴着屏幕底边，给 iPhone 底部安全区留出空间，最后一条不会被挡住 */
  .nav-card { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .nav-group-title,
  .nav-link,
  .nav-standalone {
    min-height: 30px;
    padding-top: 4px;
    padding-bottom: 4px;
    box-sizing: border-box;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nav-caret { transition: none; }
}
