/* components/section-nav.css from the prototype (rem written as px). Generated: don't edit. */
/*
 * NAV-01 Section navigation.
 * Spec: docs/components/nav-01-section-navigation.md
 *
 * Two parts:
 *  1. .nbs-contents     "Table of contents" dropdown directly after the bookmaker listing,
 *                       where the current one is. A native <details>: collapsed by default, opens
 *                       without JavaScript, and every link is in the server HTML. Generated from the
 *                       page's headings by the CMS template (see the spec).
 *  2. .nbs-section-bar  Sticky bar built by section-nav.js from the same list. Appears only once the
 *                       contents dropdown has scrolled past (never over the listing); shows the
 *                       current group and opens the full list. It overlays content (position: fixed),
 *                       so it never moves anything or causes layout shift.
 */

/* ---------- 1. Contents dropdown ---------- */
.nbs-contents {
  padding-block: var(--nbs-space-5) 0; /* the first content band below supplies the space after it */
  background-color: var(--nbs-surface);
}

.nbs-contents__box {
  background-color: var(--nbs-surface);
  border: 1px solid var(--nbs-border-strong);
  border-inline-start: 4px solid var(--nbs-color-accent);
  border-radius: var(--nbs-radius-md);
}

.nbs-contents__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nbs-space-4);
  min-height: 52px;
  padding: var(--nbs-space-3) var(--nbs-space-5);
  font-size: 18px;
  font-weight: var(--nbs-weight-bold);
  line-height: 1.3;
  color: var(--nbs-color-heading);
  list-style: none;
  cursor: pointer;
}

.nbs-contents__summary::-webkit-details-marker {
  display: none;
}

.nbs-contents__summary:hover {
  color: var(--nbs-color-link-hover);
}

.nbs-contents__count {
  margin-inline-start: auto;
  font-size: var(--nbs-text-sm);
  font-weight: var(--nbs-weight-semibold);
  color: var(--nbs-color-text-muted);
}

/* Chevron drawn with borders: decorative. */
.nbs-contents__summary::after {
  flex: none;
  width: 8.8px;
  height: 8.8px;
  content: "";
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: translateY(-25%) rotate(45deg);
}

.nbs-contents__box[open] > .nbs-contents__summary {
  border-block-end: 1px solid var(--nbs-border);
}

.nbs-contents__box[open] > .nbs-contents__summary::after {
  transform: translateY(25%) rotate(-135deg);
}

.nbs-contents__box > .nbs-contents__groups {
  padding: var(--nbs-space-5);
}

.nbs-contents__groups {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 3 240px;
  column-gap: var(--nbs-space-6);
}

.nbs-contents__group {
  break-inside: avoid;
  padding-block-end: var(--nbs-space-5);
}

/* Group names carry the brand's red rule, the same mark used for group labels on the page. */
.nbs-contents__group-link {
  display: inline-block;
  padding-inline-start: var(--nbs-space-3);
  font-weight: var(--nbs-weight-bold);
  line-height: 1.4;
  color: var(--nbs-color-link);
  text-decoration: none;
  border-inline-start: 3px solid var(--nbs-color-accent);
}

.nbs-contents__group-link:hover {
  color: var(--nbs-color-link-hover);
  text-decoration: underline;
}

/* In the sticky panel, the group currently in view (set by section-nav.js). */
.nbs-contents__group-link[aria-current="true"] {
  color: var(--nbs-color-text);
  border-inline-start-width: 6px;
  padding-inline-start: calc(var(--nbs-space-3) - 3px);
}

.nbs-contents__group-link[aria-current="true"]::after {
  content: " (you are here)";
  content: " (you are here)" / ""; /* silent for screen readers, which already announce aria-current */
  font-weight: var(--nbs-weight-regular);
  color: var(--nbs-color-text-muted);
}

.nbs-contents__sections {
  margin: var(--nbs-space-2) 0 0;
  padding: 0 0 0 calc(var(--nbs-space-3) + 3px);
  list-style: none;
  font-size: var(--nbs-text-md);
  line-height: 1.45;
}

.nbs-contents__sections > li + li {
  margin-block-start: var(--nbs-space-2);
}

.nbs-contents__sections a {
  color: var(--nbs-color-link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.nbs-contents__sections a:hover {
  color: var(--nbs-color-link-hover);
}

/* ---------- 2. Sticky bar ---------- */
.nbs-section-bar {
  position: fixed;
  inset-inline: 0;
  inset-block-start: var(--nbs-header-height);
  z-index: var(--nbs-z-sticky);
  font-family: var(--nbs-font-sans);
  background-color: var(--nbs-surface);
  border-block-end: 1px solid var(--nbs-border);
  box-shadow: var(--nbs-shadow-raised);
}

.nbs-section-bar[data-nbs-state="hidden"] {
  visibility: hidden;
  transform: translateY(calc(-100% - var(--nbs-header-height)));
}

@media (prefers-reduced-motion: no-preference) {
  .nbs-section-bar {
    transition: transform var(--nbs-duration-base) var(--nbs-ease), visibility 0s linear 0s;
  }

  .nbs-section-bar[data-nbs-state="hidden"] {
    transition: transform var(--nbs-duration-base) var(--nbs-ease), visibility 0s linear var(--nbs-duration-base);
  }
}

.nbs-section-bar__inner {
  display: flex;
  align-items: stretch;
  gap: var(--nbs-space-4);
  min-height: var(--nbs-section-nav-height);
}

.nbs-section-bar__label {
  display: none;
  align-self: center;
  margin: 0;
  font-size: var(--nbs-text-sm);
  font-weight: var(--nbs-weight-semibold);
  color: var(--nbs-color-text-muted);
  white-space: nowrap;
}

.nbs-section-bar__groups {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nbs-section-bar__groups a {
  display: flex;
  align-items: center;
  height: 100%;
  padding-inline: var(--nbs-space-3);
  font-size: 15px;
  font-weight: var(--nbs-weight-semibold);
  color: var(--nbs-color-link);
  text-decoration: none;
  white-space: nowrap;
}

.nbs-section-bar__groups a:hover {
  color: var(--nbs-color-link-hover);
  text-decoration: underline;
}

/* Current group: weight, colour and a red underline bar, so it does not rely on colour alone. */
.nbs-section-bar__groups a[aria-current="true"] {
  font-weight: var(--nbs-weight-heavy);
  color: var(--nbs-color-text);
  box-shadow: inset 0 -3px 0 var(--nbs-color-accent);
}

.nbs-section-bar__groups a:focus-visible,
.nbs-section-bar__toggle:focus-visible {
  outline-offset: -3px;
}

.nbs-section-bar__toggle {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: var(--nbs-space-3);
  min-height: var(--nbs-section-nav-height);
  padding: 0;
  font: inherit;
  font-size: var(--nbs-text-md);
  color: var(--nbs-color-text);
  text-align: start;
  background: none;
  border: 0;
  cursor: pointer;
}

.nbs-section-bar__toggle-label {
  font-weight: var(--nbs-weight-semibold);
  color: var(--nbs-color-text-muted);
}

.nbs-section-bar__current {
  margin-inline-start: auto;
  overflow: hidden;
  font-weight: var(--nbs-weight-bold);
  color: var(--nbs-color-link);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Chevron drawn with borders: no icon font needed. Decorative. */
.nbs-section-bar__toggle::after {
  flex: none;
  width: 8px;
  height: 8px;
  margin-inline-end: 4px;
  content: "";
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: translateY(-25%) rotate(45deg);
}

.nbs-section-bar__toggle[aria-expanded="true"]::after {
  transform: translateY(25%) rotate(-135deg);
}

.nbs-section-bar__panel {
  max-height: calc(100vh - var(--nbs-header-height) - var(--nbs-section-nav-height) - 80px);
  max-height: calc(100dvh - var(--nbs-header-height) - var(--nbs-section-nav-height) - 80px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-block: var(--nbs-space-5) var(--nbs-space-2);
  background-color: var(--nbs-surface);
  border-block-start: 1px solid var(--nbs-border);
  box-shadow: var(--nbs-shadow-overlay);
}

/* Wide screens: show the groups as links in the bar; the toggle becomes "All sections". */
@media (min-width: 68.75em) {
  .nbs-section-bar__label {
    display: block;
  }

  .nbs-section-bar__groups {
    display: flex;
    flex: 1 1 auto;
  }

  .nbs-section-bar__toggle {
    flex: none;
    gap: var(--nbs-space-2);
    font-size: 15px;
    font-weight: var(--nbs-weight-semibold);
    color: var(--nbs-color-link);
  }

  .nbs-section-bar__toggle-label,
  .nbs-section-bar__current {
    display: none;
  }

  .nbs-section-bar__toggle-wide {
    display: inline;
  }
}

@media (max-width: 68.6875em) {
  .nbs-section-bar__toggle-wide {
    display: none;
  }
}

/* Compact bar for pages whose table of contents has more entries than fit in one row (set by
   section-nav.js when there are more than seven): the "Contents · current section" button at every width. */
.nbs-section-bar--compact .nbs-section-bar__label,
.nbs-section-bar--compact .nbs-section-bar__groups,
.nbs-section-bar--compact .nbs-section-bar__toggle-wide {
  display: none;
}

.nbs-section-bar--compact .nbs-section-bar__toggle {
  flex: 1 1 auto;
  font-size: var(--nbs-text-md);
  font-weight: var(--nbs-weight-regular);
  color: var(--nbs-color-text);
}

.nbs-section-bar--compact .nbs-section-bar__toggle-label,
.nbs-section-bar--compact .nbs-section-bar__current {
  display: inline;
}
