/* Keep the mobile leaflet in a window above the visible website. */
@media (max-width: 900px) {
 .viewer {
  inset: 0;
  width: min(760px, calc(100vw - 24px));
  height: min(76vh, 720px);
  height: min(76dvh, 720px);
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  border: 1px solid #ffffff70;
  border-radius: 18px;
  box-shadow: 0 24px 70px #081b3659;
 }
 .viewer::backdrop {
  background: #081b368c;
  backdrop-filter: blur(3px);
 }
 .viewer-head {
  position: relative;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
 }
 .viewer-head > div:first-child {
  width: calc(100% - 52px);
  min-width: 0;
  min-height: 40px;
 }
 .viewer-head h2 {
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
 }
 .viewer-head small {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  margin-top: 3px;
 }
 .viewer-tools {
  display: grid;
  grid-template-columns: 44px 44px 44px minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 4px;
  width: 100%;
  align-items: stretch;
 }
 .viewer-tools .icon-btn,
 .viewer-tools .viewer-zoom,
 .viewer-tools .btn {
  width: 100%;
  height: 44px;
  min-height: 44px;
  min-width: 0;
  border-radius: 8px;
 }
 .viewer-tools .icon-btn {
  font-size: 22px;
 }
 .viewer-tools .viewer-zoom {
  padding: 4px;
  font-size: 11px;
  background: #f2f5f9;
  color: #506580;
 }
 .viewer-tools .btn {
  padding: 5px 4px;
  font-size: 11px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
 }
 .viewer-tools [data-action="close"] {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
 }
 .viewer-stage {
  padding: 8px;
  background: #e9eef5;
 }
 .viewer-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 8px;
  padding: 7px 12px 9px;
  font-size: 11px;
 }
 .viewer-bottom .page-controls {
  grid-column: 1;
  grid-row: 1;
  justify-content: flex-start;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
 }
 .viewer-bottom .page-controls .icon-btn {
  width: 44px;
  height: 44px;
  font-size: 24px;
  border-radius: 8px;
 }
 .viewer-bottom > span:not(.sr-only) {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 10.5px;
  line-height: 1.5;
  text-align: center;
 }
 .viewer-bottom .text-link {
  grid-column: 2;
  grid-row: 1;
  min-height: 44px;
  align-items: center;
  font-size: 11px;
  line-height: 1.3;
 }
 .viewer.is-fullscreen {
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
 }
 .viewer.is-fullscreen .viewer-stage {
  padding: 8px;
 }
}

@media (max-width: 350px) {
 .viewer-tools {
  grid-template-columns: 44px 44px 44px minmax(0, 1fr);
 }
 .viewer-tools > a {
  grid-column: 1 / -1;
 }
 .viewer-bottom {
  padding-inline: 8px;
  column-gap: 4px;
 }
 .viewer-bottom .page-controls,
 .viewer-bottom .text-link {
  font-size: 10.5px;
 }
}

@media (max-width: 900px) and (max-height: 520px) {
 .viewer {
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  max-height: calc(100dvh - 24px);
 }
 .viewer-bottom > span:not(.sr-only) {
  display: none;
 }
 .viewer.is-fullscreen {
  height: 100dvh;
  max-height: 100dvh;
 }
}

/* A simple, instant, one-page reader replaces the animated flipbook. */
.viewer-simple #book{position:relative;width:100%;display:block;box-shadow:0 8px 30px #0002;background:white}
.viewer-simple .pdf-page{position:relative;width:100%;height:100%;background:#fff;overflow:hidden}
.viewer-simple .pdf-page[hidden]{display:none!important}
.viewer-simple .book-scale{margin:auto;flex-shrink:0;transform-origin:top center}
.viewer-simple .viewer-stage{overflow:auto;display:flex;align-items:flex-start}
.viewer-simple .pdf-page>img{width:100%;height:100%;object-fit:contain}
