/* ============================================================
   Bookmark sidebar (fixed right-side jump navigation)
   Shared across detail pages. Pair with bookmark-nav.js for
   IntersectionObserver-based active-link highlighting.
   ============================================================ */

.bookmark-nav {
  position: fixed;
  top: 110px;
  right: 0;
  left: auto;
  z-index: 1030;
  width: 44px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-right: none;
  border-top-left-radius: 0.6rem;
  border-bottom-left-radius: 0.6rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: width 0.2s ease;
}

.bookmark-nav:hover,
.bookmark-nav.expanded {
  width: 220px;
}

.bookmark-nav ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
}

.bookmark-nav li {
  margin: 4px 0;
}

.bookmark-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.42rem 0.55rem;
  border-radius: 0.45rem;
  color: var(--bs-body-color);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
}

.bookmark-nav a:hover {
  background: var(--bs-secondary-bg);
  color: var(--bs-emphasis-color);
}

.bookmark-nav a > i {
  flex: 0 0 20px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--bs-secondary-color);
  transition: color 0.15s ease;
}

.bookmark-nav a > span {
  opacity: 0;
  transition: opacity 0.2s ease;
  text-overflow: ellipsis;
  overflow: hidden;
  flex: 1 1 auto;
  min-width: 0;
}

.bookmark-nav:hover a > span,
.bookmark-nav.expanded a > span {
  opacity: 1;
}

.bookmark-nav a.is-active {
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
  border-left-color: #0d6efd;
  font-weight: 600;
}

.bookmark-nav a.is-active > i {
  color: inherit;
}

[data-bs-theme="dark"] .bookmark-nav a.is-active {
  background: rgba(110, 168, 254, 0.16);
  color: #6ea8fe;
  border-left-color: #6ea8fe;
}

.bookmark-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 8px;
  width: 100%;
  color: var(--bs-body-color);
}

.bookmark-fab {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1031;
  background: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.bookmark-fab:hover {
  filter: brightness(1.05);
}

.has-bookmark-nav {
  scroll-behavior: smooth;
}

.has-bookmark-nav [id] {
  scroll-margin-top: 90px;
}

@media (max-width: 992px) {
  .bookmark-nav {
    top: auto;
    bottom: 16px;
    right: 16px;
    width: 44px;
    max-height: 60vh;
    transform: translateX(120%);
    transition: transform 0.2s ease, width 0.2s ease;
    border-right: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
  }

  .bookmark-nav.expanded {
    transform: translateX(0);
    width: min(260px, calc(100vw - 32px));
  }

  .bookmark-fab {
    display: inline-flex;
  }

  .bookmark-toggle {
    display: block;
    text-align: right;
  }
}
