:root {
  --zoom-height-scale: 100;
  --zoom-height-borders: 62px;
  --zoom-epub-ebook-scale-factor: 1;
  --zoom-width-page1: 50%;
  --zoom-width-page2: 50%;
}

#reader {
  margin-bottom: 30px;
  position: absolute;
  top: 30px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: auto;
}

#reader:has(> #pages-container:empty) {
  margin-bottom: 0px !important;
}
#reader:has(> #pages-container:empty) > .info-anchor {
  display: none !important;
}
#reader:has(> #pages-container:empty) > #toolbar {
  display: none !important;
}

/* PAGES *********************************************************/

#pages-container {
  height: 100%;
  margin: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  text-align: center;
  /* pointer-events: none; */
  user-select: none;
}

.pages-row {
  display: flex;
  flex-direction: row;
}
.pages-rtl > .pages-row {
  flex-direction: row-reverse;
}

.pages-row-hidden-rendering {
  position: absolute;
  filter: opacity(0);
}

.pages-row-2p {
  justify-content: center;
  align-items: center;
}

.pages-row-2p .page {
  height: inherit;
  width: inherit;
}

.page {
  /* pointer-events: none; */
  user-select: none;
}

.page-filter-old-page {
  filter: brightness(80%) saturate(90%) sepia(40%);
}

/* ZOOM  *********************************************************/

.set-rotate-180 {
  transform: rotate(180deg);
}

.set-scale-to-height {
  --scale-to-height-size: calc(
    100vh * var(--zoom-height-scale) / 100 - var(--zoom-height-borders)
  );
  height: var(--scale-to-height-size);
}

.set-scale-to-height > .pages-row {
  height: calc(var(--scale-to-height-size));
}

.set-fit-to-height {
  height: 100% !important;
}

.set-fit-to-height > .pages-row {
  height: calc(100vh - var(--zoom-height-borders));
}

/* .set-fit-to-height > .pages-row-2p .page {
  height: inherit;
  width: inherit !important;
} */

.set-fit-to-width > .pages-row {
  width: 100%;
}
.set-fit-to-width .page {
  width: 100%;
}

.set-fit-to-width .page-1 {
  width: var(--zoom-width-page1);
}
.set-fit-to-width .page-2 {
  width: var(--zoom-width-page2);
}
.set-fit-to-width .page-centered {
  width: 50%;
}

/* epub */

.epub-container {
  transform-origin: top left;
  transform: scale(calc(var(--zoom-epub-ebook-scale-factor)));
}

.epub-container iframe {
  pointer-events: none;
  user-select: none;
}

.set-scale-to-height > #epub-ebook-container {
  height: var(--scale-to-height-size);
  width: calc(var(--scale-to-height-size) / 600 * 450);
}

.set-fit-to-height > #epub-ebook-container {
  height: calc(100vh - var(--zoom-height-borders));
  width: calc((100vh - var(--zoom-height-borders)) / 600 * 450);
}

.set-fit-to-width > #epub-ebook-container {
  height: calc((100vw - 25px) / 450 * 600);
  width: calc(100vw - 25px);
}

/* INFO *********************************************************/

.info-anchor {
  position: fixed;
  border: 0;
  z-index: 9;
  user-select: none;
  pointer-events: none;

  display: flex;
  flex-direction: row;
  gap: 3px;
}

.info-anchor-top {
  top: calc(var(--menubar-height));
  margin-top: 10px;
}

.info-anchor-bottom {
  bottom: calc(var(--toolbar-height));
  margin-bottom: 10px;
}

.info-anchor-left {
  left: 10px;
}

.info-anchor-right {
  right: 25px;
  align-items: end;
}

.info-anchor-center {
  width: 100%;
  justify-content: center;
}

.info-bubble {
  font-size: 15px;
  color: white;
  opacity: 0.5;
  background-color: rgb(109, 109, 109);
  padding: 2px 5px;
  border-radius: 5px;
  width: fit-content;
  white-space: nowrap;
  direction: ltr;
  line-height: 100%;
}
