/* Navigation occupies a fixed part of the stage, independent of page content.
   In particular, the inside cover must not move the arrows between turns. */
/* A hidden library may extend beyond its zero-width grid track. These layout
   containers must never scroll when an absolute navigation button gets focus. */
html body :is(.workspace,.main).library-collapsed { overflow: clip; }
html body .binder-stage:not(:has(.public-profile-panel:not(.hidden))) {
  position: relative;
  --page-nav-reserve: 78px;
  padding-bottom: var(--page-nav-reserve) !important;
}

/* A landscape phone has room beside the cover, rather than below it. */
@media (max-width: 700px) and (max-height: 500px) and (orientation: landscape) {
  html body.site #spread.cover-mode > .page-wrap:first-child { max-width: calc((100cqh - 40px) * .7); }
  html body.site #spread.cover-mode .binder-overview { max-height: calc(100cqh - 40px); padding: 14px 16px; }
}
html body .binder-stage:has(#spread.cover-mode) { padding-bottom: 10px !important; }

html body #spread.has-inside-cover .inside-cover-container { min-height: 0 !important; }
html body .binder-stage > .binder-nav-dock {
  position: absolute !important;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0 !important;
  flex-wrap: nowrap;
  max-width: calc(100% - 20px);
}
html body .binder-nav-dock :is(#prevBtn,#nextBtn):hover:not(:disabled) { transform: none !important; }
html body .binder-nav-dock #pageLabel,
html body #spread.has-inside-cover ~ .binder-nav-dock #pageLabel {
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
}
html body:not(.binder-edit-mode) .binder-stage #spread:not(.cover-mode):not(.locked-single-page) {
  max-width: min(100%,calc((100cqh - 20px) * 1.45),1600px) !important;
  max-height: none !important;
}
html body #spread.locked-single-page:not(.cover-mode) {
  width: min(100%,calc((100cqh - 20px) * var(--single-page-ar)),680px) !important;
  max-width: min(100%,calc((100cqh - 20px) * var(--single-page-ar)),680px) !important;
}

@media (min-width: 701px) {
  @container (max-width: 620px) {
    html body .binder-stage > .binder-nav-dock { flex-direction: column; gap: 6px !important; }
    html body .binder-nav-dock .dock-divider { display: none !important; }
  }
}

@media (max-width: 700px) {
  html body .binder-stage:not(:has(.public-profile-panel:not(.hidden))) { --page-nav-reserve: 146px; }
  html body .binder-stage > .binder-nav-dock {
    flex-direction: column;
    gap: 5px !important;
    width: max-content;
    min-width: 0;
    bottom: max(10px,env(safe-area-inset-bottom));
    padding: 4px 6px !important;
  }
  html body .binder-nav-dock .dock-divider { display: none !important; }
  html body .binder-nav-dock .jump-nav {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 6px !important;
  }
  html body .binder-nav-dock .jump-nav span { display: inline; font-size: 11px; white-space: nowrap; }
  
  html body .binder-nav-dock .jump-nav :is(input,button) { min-height: 40px; height: 40px; }
  html body .binder-nav-dock .jump-nav input { width: 48px; padding: 6px; font-size: 12px; }
  html body .binder-nav-dock .jump-nav button { min-width: 40px; padding: 6px 10px; }
  html body .binder-nav-dock .jump-nav #jumpBtn { display: none !important; }
  html body .binder-nav-dock #pageLabel,
  html body #spread.has-inside-cover ~ .binder-nav-dock #pageLabel {
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
  }
  html body:not(.binder-edit-mode) .binder-stage #spread:not(.cover-mode):not(.locked-single-page) {
    max-width: min(100%,calc((100cqh - 20px) * .72)) !important;
  }
  html body #spread:not(.cover-mode) > .page-wrap { aspect-ratio: .72; }
  html body #spread.has-inside-cover:not(.locked-single-page) > .page-wrap:first-child { height: auto !important; }
  html body #spread.has-inside-cover > .page-wrap:first-child,
  html body #spread.has-inside-cover .inside-cover-container { min-height: 0 !important; }
}
