/* =========================================
   On This Page — hover dropdown TOC
   ========================================= */

.toc-nav-item {
  position: relative;
}

.toc-nav-item > a {
  display: inline-block;
  text-decoration: none;
  color: #333;
  transition: color 0.3s;
  white-space: nowrap;
}

.toc-nav-item > a:hover {
  color: #2566af;
}

.toc-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #e0e0e0;
  border-top: 3px solid #2566af;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  min-width: 220px;
  z-index: 1000;
  padding: 6px 0;
  border-radius: 0 0 6px 6px;
}

.toc-nav-item:hover .toc-dropdown {
  display: block;
}

.toc-dropdown li {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-dropdown a {
  display: block;
  padding: 9px 20px;
  color: #333;
  font-size: 1.15rem;
  font-weight: 400;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.toc-dropdown a:hover {
  background: #f0f5fb;
  color: #2566af;
}

.toc-dropdown a.toc-active {
  font-weight: 600;
  color: #2566af;
  border-left: 3px solid #2566af;
  padding-left: 17px;
}

/* Nested subsection links */
.toc-sub > a {
  padding-left: 32px !important;
  font-size: 1.05rem !important;
  color: #555 !important;
}

.toc-sub > a:hover {
  color: #2566af !important;
}

.toc-sub > a.toc-active {
  padding-left: 29px !important;
}

/* Divider between top-level items */
.toc-divider {
  height: 1px;
  background: #eee;
  margin: 4px 0;
}

/* =========================================
   On This Page — mobile accordion dropdown
   ========================================= */

@media only screen and (max-width: 944px) {
  .main-nav {
    overflow-y: auto;
    padding: 2rem 0;
  }

  .main-nav-list {
    width: 80%;
    margin: 0 auto;
  }

  .toc-nav-item {
    width: 100%;
  }

  .toc-nav-item > .main-nav-link {
    display: block;
    position: relative;
    text-align: center;
  }

  .toc-nav-item > .main-nav-link::after {
    content: '\25BE';
    position: absolute;
    right: -1.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    transition: transform 0.2s ease;
  }

  .toc-nav-item.toc-open > .main-nav-link::after {
    transform: translateY(-50%) rotate(180deg);
  }

  .toc-dropdown {
    display: none;
    position: static;
    transform: none;
    border: none;
    box-shadow: none;
    min-width: 0;
    width: 100%;
    padding: 0;
    margin-top: 0.75rem;
    background: transparent;
    text-align: left;
  }

  /* the desktop hover-reveal shouldn't apply once a touch-simulated
     hover fires; only the JS-toggled class controls visibility here */
  .toc-nav-item:hover .toc-dropdown {
    display: none;
  }

  .toc-nav-item.toc-open .toc-dropdown {
    display: block;
  }

  .toc-dropdown a {
    display: block;
    font-size: 1.05rem;
    padding: 10px 0 10px 1.5rem;
    color: #555;
    border-left: 2px solid #e0e0e0;
  }
}
