/* ==========================================================================
   Scrollspy — highlights the link of the section you're reading.

   <nav class="nav nav-vertical" data-moey-spy>        ← the page scrolls
     <a href="#overview">Overview</a> <a href="#pricing">Pricing</a> …
   </nav>
   <nav class="nav" data-moey-spy="#content">…</nav>   ← a scrolling box scrolls

   The active link gets aria-current="location" (and .active), so navs, list groups,
   trees and tabs show it with their own style. Parent links of nested lists get
   .is-active-parent. Reading progress: <div class="scroll-progress" data-moey-scroll-progress></div>
   ========================================================================== */

/* Nested lists: the parent of the active link is highlighted gently */
[data-moey-spy] .is-active-parent { color: var(--mo-fg-body); }
[data-moey-spy] ul, [data-moey-spy] ol { margin: 0; padding-inline-start: .75rem; list-style: none; }

/* A side nav that follows the page */
.spy-sticky { position: sticky; top: var(--mo-spy-top, 5rem); align-self: start; max-height: calc(100dvh - var(--mo-spy-top, 5rem) - 1rem); overflow-y: auto; }

/* Reading progress: a thin bar that fills as you scroll */
.scroll-progress {
  --mo-scroll-progress: 0;
  height: 3px;
  overflow: hidden;
  background: color-mix(in oklab, var(--mo-fg-body) 8%, transparent);
  border-radius: 99px;
}
.scroll-progress::before {
  display: block;
  height: 100%;
  content: "";
  background: var(--mo-theme-solid);
  border-radius: inherit;
  transform-origin: left;
  scale: var(--mo-scroll-progress) 1;
}
.scroll-progress:dir(rtl)::before { transform-origin: right; }
.scroll-progress-fixed { position: fixed; inset: 0 0 auto; z-index: var(--mo-z-fixed); height: 3px; border-radius: 0; background: transparent; }
