/* WSTG sidebar contents: fixed-width panel with internal scroll */
.wstg-nav {
  /* Do not use position:sticky — later sidebar blocks (events, etc.)
     would scroll underneath the stuck menu. */
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: min(70vh, 36rem);
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 0.9em;
  margin-bottom: 1.5rem;
  padding-right: 0.25rem;
}

.wstg-nav-title {
  margin: 0 0 0.5rem;
  font-size: 1.1em;
}

.wstg-nav-filter {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.5rem;
}

.wstg-nav-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  font-size: 0.85em;
}

.wstg-nav-controls button {
  padding: 0.15rem 0.4rem;
  cursor: pointer;
}

.wstg-nav-list,
.wstg-nav-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Indent nested levels without forcing the sidebar column wider;
   horizontal overflow is handled by .wstg-nav. */
.wstg-nav-list ul {
  padding-left: 0.75rem;
  border-left: 1px solid rgba(0, 0, 0, 0.12);
  margin-left: 0.35rem;
}

.wstg-nav-item {
  margin: 0.15rem 0;
}

.wstg-nav-item > a,
.wstg-nav-summary-row > a {
  display: inline-block;
  vertical-align: top;
  white-space: nowrap;
  text-decoration: none;
}

.wstg-nav-item > a:hover,
.wstg-nav-summary-row > a:hover {
  text-decoration: underline;
}

.wstg-nav-item.is-active > a,
.wstg-nav-item.is-active > details > summary .wstg-nav-summary-row > a,
.wstg-nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
}

.wstg-nav details {
  margin: 0;
}

.wstg-nav summary {
  list-style: none;
  cursor: pointer;
}

.wstg-nav summary::-webkit-details-marker {
  display: none;
}

.wstg-nav-summary-row {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  width: max-content;
  max-width: none;
}

.wstg-nav-chevron {
  flex: 0 0 auto;
  width: 0.9em;
  text-align: center;
  user-select: none;
}

.wstg-nav details[open] > summary .wstg-nav-chevron::before {
  content: "▾";
}

.wstg-nav details:not([open]) > summary .wstg-nav-chevron::before {
  content: "▸";
}

.wstg-nav-summary-row > a {
  flex: 0 1 auto;
}

.wstg-nav-item.is-filtered-out {
  display: none;
}

/* Keep the theme sidebar column from growing when the tree is expanded. */
.sidebar {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar .wstg-nav {
  /* Prefer the sidebar's own width; never expand the grid track. */
  width: 100%;
  max-width: 100%;
}

.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}
