/* readerheader.js: the reader's top bar, rebuilt from scratch (2026-11-18). Fixed to the viewport — not "sticky",
   which is what let the Mac's rubber-band overscroll pull a blank strip of page in above it. Hides on scroll down,
   reveals on scroll up, via one class (.rh-hide on <html>) and a plain transform, so there is exactly one thing
   deciding this and nothing left to flicker against. */

html body header.top.rd{position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:auto!important;
  z-index:40;transform:translateY(0);transition:transform .42s cubic-bezier(.22,1,.36,1);will-change:transform}
html.rh-hide body header.top.rd{transform:translateY(-100%);pointer-events:none}
/* phones: every page's top bar does the same (the user, 2026-11-24) */
@media (max-width:900px){html body header.top{transition:transform .42s cubic-bezier(.22,1,.36,1)}html.rh-hide body header.top{transform:translateY(-100%);pointer-events:none}}
/* the rail (☰) hides with it, as one piece */
html.rh-hide body .railbtn{transform:translateY(-130%);opacity:0;pointer-events:none}
html body .railbtn{transition:transform .28s cubic-bezier(.4,0,.2,1),opacity .2s}
@media (prefers-reduced-motion:reduce){
  html body header.top.rd,html body .railbtn{transition:none!important}
}

/* the header no longer reserves its own space in the page's flow (position:fixed takes it out of flow) — give the
   reader column back exactly that much room at the top, measured for real rather than guessed */
html body main.readp{padding-top:var(--rh-h,68px)!important}

/* only the chapter's own title — the book name above it is hidden */
html body header.top.rd .hd .hbook{display:none!important}

/* ---------- the reading-progress line: its own fixture, independent of the bar above it ---------- */
html body > .pbar.rb-pin{position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:auto!important;
  height:2px!important;margin:0!important;z-index:999!important;pointer-events:none;opacity:1!important;
  transform:none!important;translate:none!important;transition:none!important;background:none}

/* ---------- ⋯ and its menu, at the top right of the (now fixed) bar ---------- */
html:root body header.top.rd > .rbx-more{all:unset;box-sizing:border-box;height:38px;min-width:38px;margin-left:4px;display:inline-grid;place-items:center;cursor:pointer;border-radius:8px;color:var(--ink2,#3b3833);pointer-events:auto!important}
html:root body header.top.rd > .rbx-more svg{width:22px;height:22px}
@media (hover:hover){html:root body header.top.rd > .rbx-more:hover{background:rgba(28,27,25,.06)}}
html:root body header.top.rd > .rbx-more.on{background:rgba(28,27,25,.08)}
html:root body header.top.rd > .rbx-more ~ .rbx-more{display:none!important}

html:root body header.top.rd > .rbx-menu{position:absolute;right:16px;top:calc(100% + 6px);bottom:auto;z-index:70;min-width:250px;padding:8px;background:#fff;border-radius:0;pointer-events:auto!important;
  box-shadow:0 0 0 1px rgba(60,48,36,.12),0 24px 50px -20px rgba(30,18,8,.4);transform-origin:100% 0;animation:rh-down .32s cubic-bezier(.16,1,.3,1)}
html:root body header.top.rd > .rbx-menu[hidden]{display:none}
@keyframes rh-down{from{opacity:0;transform:translateY(-8px) scale(.97)}to{opacity:1;transform:none}}
html:root:root body header.top.rd .rbx-menu button{all:unset!important;box-sizing:border-box!important;display:flex!important;align-items:center!important;gap:14px!important;width:100%!important;height:auto!important;min-width:0!important;
  padding:10px 12px!important;border-radius:0!important;cursor:pointer!important;color:var(--ink,#1C1B19)!important;font:400 17px/1.2 "EB Garamond",Georgia,serif!important;translate:none!important}
html:root:root body header.top.rd .rbx-menu button > :is(svg,.ic,i,span:not(.rbx-l)){flex:none;width:20px!important;height:20px!important;color:var(--ink2,#3b3833)}
html:root:root body header.top.rd .rbx-menu .rbx-l{display:block!important;flex:1;white-space:nowrap}
@media (hover:hover){html:root:root body header.top.rd .rbx-menu button:hover{background:rgba(28,27,25,.05)!important}}
html.night:root body header.top.rd > .rbx-menu{background:#161616;box-shadow:0 0 0 1px rgba(236,232,224,.12),0 24px 50px -20px rgba(0,0,0,.8)}
html.night:root:root body header.top.rd .rbx-menu button{color:#ECE8E0!important}

/* the moon: still removed from the reader (unchanged from the earlier request) */
html:root body header.top.rd .nightbtn{display:none!important}

/* ---------- no bottom bar: it's gone; the Aa panel and others drop to the corner instead of sitting above it ---------- */
html:root body .dock{display:none!important}
html body #rblook.rblook{bottom:24px!important}

/* that's the site-wide "scrolled" shadow meant for other pages' sticky bars (app.css: body.scrolled .top{box-shadow:...}) —
   it was firing on the reader too, since this header carries the same base .top class. The reader's bar sits flush
   above the page with no shadow or seam; content just scrolls up under it plainly (the user, 2026-11-18). */
html body.scrolled header.top.rd{box-shadow:none!important;border-bottom-color:transparent!important}
