/* =========================================================
   Material for MkDocs
   Primary Navigation — Compact & Clear

   IMPORTANT:
   Only affects the LEFT primary navigation.
   Does NOT affect Table of Contents.
   ========================================================= */


/* =========================================================
   1. Primary navigation base
   ========================================================= */

.md-sidebar--primary .md-nav {
  font-size: 0.73rem;
}

.md-sidebar--primary .md-nav__list {
  margin: 0;
  padding: 0;
}

.md-sidebar--primary .md-nav__item {
  margin: 1px 0;
}


/* =========================================================
   2. Primary navigation links
   ========================================================= */

.md-sidebar--primary .md-nav__link {
  position: relative;

  display: flex;
  align-items: center;

  min-height: 1.8rem;

  margin: 0;
  padding: 0.28rem 0.55rem;

  border-radius: 5px;

  line-height: 1.3;

  color: var(--md-default-fg-color);

  /*
   * Only primary navigation uses single-line behavior.
   *
   * TOC is NOT affected.
   */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}


/* =========================================================
   3. Hover
   ========================================================= */

.md-sidebar--primary .md-nav__link:hover {
  background-color: rgba(0, 0, 0, 0.045);
}

[data-md-color-scheme="slate"]
  .md-sidebar--primary
  .md-nav__link:hover {
  background-color: rgba(255, 255, 255, 0.055);
}


/* =========================================================
   4. Active page
   ========================================================= */

.md-sidebar--primary
  .md-nav__link--active {
  font-weight: 600;

  color: #1565c0 !important;

  background-color: rgba(25, 118, 210, 0.09);
}


/* Active indicator */

.md-sidebar--primary
  .md-nav__link--active::before {
  content: "";

  position: absolute;

  left: 0;
  top: 22%;
  bottom: 22%;

  width: 2px;

  border-radius: 2px;

  background-color: #1976d2;
}


/* Active hover */

.md-sidebar--primary
  .md-nav__link--active:hover {
  color: #0d47a1 !important;

  background-color: rgba(25, 118, 210, 0.14);
}


/* =========================================================
   5. Dark / Slate theme
   ========================================================= */

[data-md-color-scheme="slate"]
  .md-sidebar--primary
  .md-nav__link--active {
  color: #90caf9 !important;

  background-color: rgba(144, 202, 249, 0.11);
}


[data-md-color-scheme="slate"]
  .md-sidebar--primary
  .md-nav__link--active::before {
  background-color: #90caf9;
}


[data-md-color-scheme="slate"]
  .md-sidebar--primary
  .md-nav__link--active:hover {
  color: #bbdefb !important;

  background-color: rgba(144, 202, 249, 0.16);
}


/* =========================================================
   6. Primary navigation hierarchy
   ========================================================= */


/* Level 1 */

.md-sidebar--primary
  .md-nav--primary
  > .md-nav__list
  > .md-nav__item
  > .md-nav__link {
  font-size: 0.75rem;
  font-weight: 600;
}


/* Level 2 */

.md-sidebar--primary
  .md-nav--primary
  .md-nav__item
  .md-nav__item
  > .md-nav__link {
  padding-left: 0.9rem;

  font-size: 0.72rem;
  font-weight: 450;
}


/* Level 3 */

.md-sidebar--primary
  .md-nav--primary
  .md-nav__item
  .md-nav__item
  .md-nav__item
  > .md-nav__link {
  padding-left: 1.45rem;

  font-size: 0.70rem;
}


/* Level 4 */

.md-sidebar--primary
  .md-nav--primary
  .md-nav__item
  .md-nav__item
  .md-nav__item
  .md-nav__item
  > .md-nav__link {
  padding-left: 2rem;

  font-size: 0.69rem;
}


/* =========================================================
   7. Nested tree
   ========================================================= */

.md-sidebar--primary
  .md-nav--primary
  .md-nav__item
  .md-nav__item
  > .md-nav {
  margin-left: 0.35rem;
  padding-left: 0.35rem;

  border-left: 1px solid
    var(--md-default-fg-color--lightest);
}


[data-md-color-scheme="slate"]
  .md-sidebar--primary
  .md-nav--primary
  .md-nav__item
  .md-nav__item
  > .md-nav {
  border-left-color: rgba(255, 255, 255, 0.07);
}


/* =========================================================
   8. Section titles
   ========================================================= */

.md-sidebar--primary
  .md-nav__item--section
  > .md-nav__link {
  margin-top: 0.55rem;
  margin-bottom: 0.1rem;

  min-height: 1.65rem;

  padding-top: 0.25rem;
  padding-bottom: 0.2rem;

  font-size: 0.68rem !important;
  font-weight: 700;

  letter-spacing: 0.025em;

  color: var(--md-default-fg-color) !important;

  background: transparent !important;
}


/* Section doesn't need indicator */

.md-sidebar--primary
  .md-nav__item--section
  > .md-nav__link::before {
  display: none;
}


/* =========================================================
   9. Parent of active item
   ========================================================= */

.md-sidebar--primary
  .md-nav__item--active
  > .md-nav__link:not(.md-nav__link--active) {
  font-weight: 600;

  color: var(--md-default-fg-color);
}


/* =========================================================
   10. Expand / collapse icon
   ========================================================= */

.md-sidebar--primary .md-nav__icon {
  flex-shrink: 0;

  opacity: 0.5;

  transition: opacity 0.15s ease;
}

.md-sidebar--primary
  .md-nav__link:hover
  .md-nav__icon {
  opacity: 0.8;
}


/* =========================================================
   11. Mobile
   ========================================================= */

@media screen and (max-width: 76.24em) {

  .md-sidebar--primary .md-nav {
    font-size: 0.78rem;
  }

  .md-sidebar--primary .md-nav__link {
    min-height: 2.1rem;

    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }

}


/* =========================================================
   12. Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  .md-sidebar--primary .md-nav__link,
  .md-sidebar--primary .md-nav__icon {
    transition: none;
  }

}

/* 给 h2 标题添加背景色，区分标题和正文 */
.md-typeset h2 {
    background-color: #e3f2fd;  /* 浅蓝色背景 */
    padding: 8px 16px;          /* 内边距 */
    border-radius: 4px;         /* 圆角 */
    border-left: 4px solid #1976d2; /* 左侧蓝色竖线装饰 */
}

/* 也可以给 h3 加不同的背景 */
.md-typeset h3 {
    background-color: #f3e5f5;
    padding: 6px 12px;
    border-radius: 4px;
    border-left: 4px solid #7b1fa2;
}

/* ===== 强制重置自定义主页标题样式 ===== */
.custom-home h2,
.custom-home h3 {
    background: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    border-left: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}