/* Topic navigation menu */
.topic-nav-wrapper .topic-pill.active,
.topic-nav-wrapper .section-pill.active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: white !important;
}

.topic-nav-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 0.75rem 0;
  text-align: left;
  width: 100%;
}

.topic-nav-toggle__main {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-width: 0;
}

.topic-nav-toggle__hamburger {
  align-items: center;
  border: 1px solid var(--border-light);
  border-radius: 0.75rem;
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 3px;
  height: 2.5rem;
  justify-content: center;
  width: 2.5rem;
}

.topic-nav-toggle__hamburger span {
  background: var(--text-primary);
  border-radius: 999px;
  display: block;
  height: 2px;
  width: 16px;
}

.topic-nav-toggle__copy {
  min-width: 0;
}

.topic-nav-toggle__label {
  color: var(--accent);
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.topic-nav-toggle__current {
  color: var(--text-secondary);
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  margin-top: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-nav-toggle__chevron {
  color: var(--text-secondary);
  flex: 0 0 auto;
  transition: transform 0.2s ease;
}

.topic-nav-wrapper.is-topic-nav-open .topic-nav-toggle__chevron {
  transform: rotate(180deg);
}

.topic-nav-wrapper .topic-nav-scroll {
  display: none;
  padding-bottom: 0.75rem;
}

.topic-nav-wrapper.is-topic-nav-open .topic-nav-scroll {
  display: block;
}

.topic-nav-wrapper .topic-nav-scroll::before,
.topic-nav-wrapper .topic-nav-scroll::after {
  display: none;
}

.topic-nav-wrapper .topic-nav-scroll > nav {
  align-items: stretch;
  flex-direction: column;
  gap: 0.35rem;
  margin-left: 0;
  margin-right: 0;
  max-height: min(60vh, 420px);
  overflow-x: visible;
  overflow-y: auto;
  padding: 0.25rem 0 0;
}

.topic-nav-wrapper .topic-nav-scroll > nav .topic-pill,
.topic-nav-wrapper .topic-nav-scroll > nav .section-pill {
  border-radius: 0.75rem;
  display: block;
  padding: 0.7rem 0.85rem;
  text-align: left;
  white-space: normal;
  width: 100%;
}

@media (min-width: 1024px) {
  .topic-nav-wrapper .topic-nav-scroll > nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    max-height: min(52vh, 480px);
  }

  .topic-nav-wrapper .topic-nav-scroll > nav .topic-pill,
  .topic-nav-wrapper .topic-nav-scroll > nav .section-pill {
    min-height: 2.6rem;
  }
}
