/* Scroll index (scroll-index.js): a rail of ticks beside long content, one per heading. Ported from KokonutUI's Scroll
 * Index (MIT), in the site's colors: its panels, lines and text, and its accent blue for the section being read. */
.scroll-index{--si-height:520px;--si-tick:var(--line,#222d3e);--si-passed:var(--text,#edf2f9);--si-current:var(--accent,#3b82f6);position:relative;box-sizing:border-box;width:100%}
.scroll-index:not(.scroll-index-window){height:var(--si-height);overflow:hidden;border:1px solid var(--line,#222d3e);border-radius:16px;background:var(--panel,#111722)}
:root.light .scroll-index{--si-tick:#cbd5e1}
.si-box{box-sizing:border-box}
.scroll-index:not(.scroll-index-window) .si-box{height:100%;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.scroll-index:not(.scroll-index-window) .si-content{padding:28px 64px 28px 24px}
.scroll-index-window{display:grid;grid-template-columns:minmax(0,1fr) 3rem;gap:24px}
/* The rail: centred on the right of the box, or sticky beside the page's content. */
.si-nav{z-index:2;display:flex;justify-content:flex-end;width:48px}
.scroll-index:not(.scroll-index-window) .si-nav{position:absolute;top:50%;right:12px;transform:translateY(-50%)}
.scroll-index-window .si-nav{position:sticky;top:calc(50vh - 140px);align-self:start;height:fit-content}
.si-rail{position:relative;width:100%;height:280px;cursor:pointer;touch-action:none;-webkit-user-select:none;user-select:none}
.si-rail[data-dragging]{cursor:grabbing}
.scroll-index .si-tick{position:absolute;right:0;display:block;width:14px;height:16px;margin:0;padding:0;border:0;border-radius:3px;background:none;cursor:pointer;outline:none;transform:translateY(-50%);-webkit-tap-highlight-color:transparent}
.scroll-index .si-tick-minor{width:8px}
.scroll-index .si-tick:focus-visible{box-shadow:0 0 0 2px var(--accent,#3b82f6)}
.si-mark{position:absolute;top:50%;right:0;width:100%;height:1.5px;border-radius:999px;background:var(--si-tick);transform:translateY(-50%) scaleX(var(--swell,1));transform-origin:right;transition:background-color .2s ease-out}
.si-tick[data-state="passed"] .si-mark{background:var(--si-passed)}
.si-tick[data-state="current"] .si-mark{background:var(--si-current)}
/* Where the reader is, between ticks too; and the name of the section near the pointer. */
.si-head{position:absolute;top:0;right:0;width:24px;height:2px;border-radius:999px;background:var(--si-passed);pointer-events:none;transform:translateY(-50%);will-change:transform}
.si-label{position:absolute;top:0;right:36px;padding:4px 8px;border:1px solid var(--line,#222d3e);border-radius:8px;background:var(--panel2,#151d2a);color:var(--text,#edf2f9);font-size:12px;font-weight:500;line-height:1.3;white-space:nowrap;box-shadow:0 4px 14px rgba(0,0,0,.18);opacity:0;pointer-events:none;transition:opacity .15s ease-out,transform .15s ease-out}
@media (prefers-reduced-motion:reduce){
  .si-mark,.si-label{transition:none}
}
