/* Docsify 多层级侧栏手风琴。 */
body.docs-page .sidebar-group {
  position: relative;
}

/* 一级目录也可以是没有子项的独立页面。固定其定位上下文，避免段落外边距
   与相邻分组发生不同方式的折叠，保持一级入口的垂直间距一致。 */
body.docs-page .sidebar-nav > ul > li.sidebar-depth-1 {
  position: relative;
}

body.docs-page .sidebar-group > p,
body.docs-page .sidebar-group > a,
body.docs-page .sidebar-group > strong {
  padding-left: 1.4rem;
}

body.docs-page .sidebar-group > ul[hidden] {
  display: none !important;
}

body.docs-page .sidebar-group-toggle {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.45em;
  padding: 0;
  border: 0;
  background: transparent;
  color: #64748b;
  font: inherit;
  cursor: pointer;
}

body.docs-page .sidebar-group-toggle > svg {
  width: 0.78rem;
  height: 0.78rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: center;
  transition: transform 160ms ease;
}

body.docs-page .sidebar-group.is-expanded > .sidebar-group-toggle > svg {
  transform: rotate(90deg);
}

body.docs-page .sidebar-group-toggle:hover,
body.docs-page .sidebar-group-toggle:focus-visible {
  color: #1677ff;
}

body.docs-page .sidebar-group-toggle:focus-visible {
  outline: 2px solid #91caff;
  outline-offset: -2px;
  border-radius: 0.25rem;
}

body.docs-page .sidebar-depth-1 > p,
body.docs-page .sidebar-depth-1 > a,
body.docs-page .sidebar-depth-1 > strong {
  margin-top: 0.75rem;
  padding-left: 1.4rem;
  font-size: 1rem;
}

body.docs-page .sidebar-depth-2 > p,
body.docs-page .sidebar-depth-2 > a,
body.docs-page .sidebar-depth-2 > strong {
  font-weight: 600;
}

body.docs-page .sidebar-depth-3 > p,
body.docs-page .sidebar-depth-3 > a,
body.docs-page .sidebar-depth-3 > strong {
  color: #475569;
  font-size: 0.875rem;
}

body.docs-page .sidebar-nav li > a,
body.docs-page .sidebar-nav li > p,
body.docs-page .sidebar-nav li > strong {
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  line-height: 1.45;
}

/* 叶子节点才是文章。用“+”与分组箭头区分，并用左内边距形成悬挂缩进。 */
body.docs-page .sidebar-nav li:not(.sidebar-group) > a:not(.section-link) {
  position: relative;
  display: block;
  padding-left: 1.35rem;
}

body.docs-page .sidebar-nav li:not(.sidebar-group) > a:not(.section-link)::before {
  content: "+";
  position: absolute;
  top: 0;
  left: 0.2rem;
  color: #94a3b8;
  font-weight: 700;
}

body.docs-page .sidebar-nav li.active:not(.sidebar-group) > a:not(.section-link)::before {
  color: #1677ff;
}

/* 随笔的发布时间单独成行；标题保留普通字重，便于快速扫读时间。 */
body.docs-page .sidebar-nav li:not(.sidebar-group) > a.sidebar-dev-note-link {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding-top: 0.18rem;
  padding-bottom: 0.28rem;
}

body.docs-page .sidebar-nav .sidebar-dev-note-link > time {
  display: block;
  color: #64748b;
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.3;
}

body.docs-page .sidebar-nav .sidebar-dev-note-link > span {
  display: block;
  line-height: 1.42;
}

/* 当前文章的页内目录再向右缩进一级，避免与前后文章混成同一层。 */
body.docs-page .sidebar-nav li > ul.app-sub-sidebar {
  margin: 0.2rem 0 0.45rem 1.35rem;
  padding-left: 0.7rem;
  border-left: 1px solid #dbe4ef;
}

body.docs-page .sidebar-nav .app-sub-sidebar li {
  position: relative;
  margin: 0.15rem 0;
}

body.docs-page .sidebar-nav .app-sub-sidebar li::before {
  content: none;
  float: none;
  padding: 0;
}

body.docs-page .sidebar-nav .app-sub-sidebar a.section-link {
  padding-left: 0;
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.45;
}

body.docs-page .sidebar-nav .app-sub-sidebar ul {
  margin-left: 0.85rem;
  padding-left: 0.65rem;
  border-left: 1px solid #e8edf3;
}

@media (prefers-reduced-motion: reduce) {
  body.docs-page .sidebar-group-toggle > svg {
    transition: none;
  }
}
