/* An opaque, quiet surface keeps the navigation readable without optical halos. */
.chapter-navigation{--chapter-index:0;--chapter-surface:#151a1a;--chapter-hover:#e8e6df0a;position:fixed;z-index:11;left:50%;bottom:max(26px,env(safe-area-inset-bottom));width:min(1000px,calc(100vw - 72px));transform:translate(-50%,18px);opacity:0;visibility:hidden;pointer-events:none;color:var(--ink);transition:opacity .4s,transform .6s cubic-bezier(.2,.75,.3,1),visibility .6s}
body.light-background .chapter-navigation{--chapter-surface:#f1f1ec;--chapter-hover:#242a2908}
.chapter-navigation.is-visible{transform:translate(-50%,0);opacity:1;visibility:visible;pointer-events:auto}
.chapter-bar{background:var(--chapter-surface);border:1px solid var(--fine-line);border-radius:3px;padding:0 14px}
.chapter-track{position:relative;display:grid;grid-template-columns:repeat(var(--chapter-count,5),minmax(0,1fr))}
.chapter-link{position:relative;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:9px;min-width:0;min-height:82px;padding:14px 17px 18px;color:var(--quiet-ink);text-decoration:none;transition:color .25s,background .25s}
.chapter-number{font:9px/1 WordmarkMono,monospace;letter-spacing:.10em;opacity:.55}
.chapter-label{font:13px/1.4 WordmarkMono,monospace;letter-spacing:.055em;white-space:nowrap;transition:translate .3s cubic-bezier(.2,.75,.3,1)}
.chapter-link:hover,.chapter-link[aria-current=page]{color:var(--ink)}
.chapter-link:hover{background:var(--chapter-hover)}
.chapter-link:hover .chapter-label{translate:0 -2px}
.chapter-link[aria-current=page] .chapter-number{opacity:1}
.chapter-link+.chapter-link::before{content:'';position:absolute;left:0;top:21px;bottom:25px;width:1px;background:var(--fine-line);opacity:.45}
.chapter-indicator{position:absolute;left:0;bottom:0;width:calc(100% / var(--chapter-count,5));height:2px;transform:translateX(calc(var(--chapter-index)*100%));pointer-events:none;transition:transform .65s cubic-bezier(.22,.75,.15,1)}
.chapter-indicator::after{content:'';display:block;position:absolute;left:17px;right:17px;height:2px;background:currentColor}
.chapter-mobile,.chapter-menu{display:none}
.chapter-navigation a:focus-visible,.chapter-navigation button:focus-visible{outline:1px solid currentColor;outline-offset:-5px;border-radius:2px}
@media(min-width:768px) and (max-width:1000px){.chapter-navigation{width:calc(100vw - 40px)}.chapter-bar{padding:0 8px}.chapter-link{padding-left:11px;padding-right:8px}.chapter-label{font-size:12px;letter-spacing:.025em}.chapter-indicator::after{left:11px;right:11px}}
@media(max-width:767px){
 .chapter-navigation{width:calc(100vw - 32px);bottom:max(16px,env(safe-area-inset-bottom));z-index:14}
 .chapter-bar{padding:0}
 .chapter-track{display:none}
 .chapter-mobile{display:grid;grid-template-columns:62px minmax(0,1fr) 62px;min-height:68px}
 .chapter-mobile button,.chapter-close{min-width:0;border:0;border-radius:0;background:none;color:var(--ink);padding:0;transition:background .25s,color .25s}
 .chapter-mobile button:hover,.chapter-close:hover{background:var(--chapter-hover)}
 .chapter-step{display:grid;place-items:center}
 .chapter-step svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.2;stroke-linecap:round;stroke-linejoin:round;transition:transform .3s}
 .chapter-step:first-child svg{rotate:180deg}
 .chapter-step:hover svg{transform:translateX(3px)}
 .chapter-mobile #chapter-toggle{display:flex;position:relative;flex-direction:column;align-items:center;justify-content:center;gap:7px;padding:12px 28px;border-left:1px solid var(--fine-line);border-right:1px solid var(--fine-line)}
 #chapter-count{font:9px/1 WordmarkMono,monospace;letter-spacing:.10em;color:var(--quiet-ink)}
 #chapter-name{font:13px/1.3 WordmarkMono,monospace;letter-spacing:.035em}
 .chapter-chevron{position:absolute;right:14px;top:calc(50% - 5px);width:10px;height:10px;fill:none;stroke:currentColor;stroke-width:1;transition:rotate .35s}
 .menu-open .chapter-chevron{rotate:180deg}
 .chapter-menu{display:block;position:absolute;left:0;right:0;bottom:calc(100% + 10px);max-height:calc(100dvh - 190px);overflow-y:auto;overscroll-behavior:contain;background:var(--chapter-surface);border:1px solid var(--fine-line);border-radius:3px;opacity:0;visibility:hidden;transform:translateY(10px);pointer-events:none;transition:opacity .22s,transform .35s cubic-bezier(.2,.75,.3,1),visibility 0s .35s}
 .menu-open .chapter-menu{opacity:1;visibility:visible;transform:translateY(0);pointer-events:auto;transition-delay:0s}
 .chapter-menu-heading{min-height:49px;display:flex;align-items:center;justify-content:space-between;padding-left:20px;border-bottom:1px solid var(--fine-line);font:9px/1.4 WordmarkMono,monospace;letter-spacing:.12em;color:var(--quiet-ink)}
 .chapter-close{width:49px;height:49px;font:23px/1 Arial;font-weight:300}
 .chapter-choice{display:flex;position:relative;align-items:center;gap:25px;min-height:54px;padding:14px 21px;text-decoration:none;color:var(--quiet-ink);transition:background .2s,color .2s}
 .chapter-choice+.chapter-choice{border-top:1px solid var(--fine-line)}
 .chapter-choice[aria-current=page],.chapter-choice:hover{color:var(--ink);background:var(--chapter-hover)}
 .chapter-choice[aria-current=page]::after{content:'';position:absolute;right:22px;top:calc(50% - 2px);width:4px;height:4px;background:currentColor}
 .chapter-choice .chapter-label{font-size:14px;letter-spacing:.05em}
}
@media(prefers-reduced-motion:reduce){.chapter-navigation,.chapter-indicator,.chapter-menu,.chapter-label,.chapter-step svg,.chapter-chevron{transition:none!important}.chapter-link:hover .chapter-label,.chapter-step:hover svg{transform:none;translate:none}}
