.flipbook-body { background: #EEEEEE; overflow: hidden; margin: 0; }
#flipbook-viewport { width: 100vw; height: 100vh; }
#flipbook-viewport { display: flex; align-items: center; justify-content: center; }
.page { background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.page img { width: 100%; height: 100%; display: block; object-fit: contain; }
/* A sheet is typeset at print size and cannot reflow, so it is scaled from its
   top-left corner to whatever width page-flip gives the page. */
.doc-sheet { transform-origin: top left; }
.page:has(> .doc-sheet) { overflow: hidden; }

/* The PDF preview: a page of a unit's PDF drawn by PDF.js — the canvas fills the sheet, and
   the page's text lies over it as transparent spans (PDF.js's text layer, its own rules) for
   search and selection. The sheet is the page in CSS pixels, so the layer's scale is 1. */
.pdf-sheet { position: relative; background: white; --scale-factor: 1; }
.pdf-sheet canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pdf-sheet .textLayer {
  position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-align: initial;
  text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 0;
}
.pdf-sheet .textLayer span, .pdf-sheet .textLayer br {
  color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%;
}
.pdf-sheet .textLayer ::selection { background: rgba(0, 0, 255, 0.25); }
/* Text-layer spans have a box of their own, so a search hit is just a background. */
.pdf-sheet .textLayer span.flipbook-hit { background: rgba(255, 214, 0, 0.45); border-radius: 2px; }
.toc-overlay-fixed {
  position: fixed;
  pointer-events: none;
  z-index: 20;
  display: none;
}
.toc-hotspot {
  pointer-events: auto;
  cursor: pointer;
}
.toc-hotspot:hover {
  fill: rgba(0, 0, 0, 0.05) !important;
}
.page { position: relative; }
.flipbook-help {
  position: fixed;
  display: none;
  flex-direction: column;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  color: #555;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding: 0 1.5rem;
}
.flipbook-help__title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #888;
}
.flipbook-help__list {
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 0.8rem;
  align-items: baseline;
}
.flipbook-help__list dt {
  margin: 0;
  white-space: nowrap;
}
.flipbook-help__list dd {
  margin: 0;
  color: #555;
}
.flipbook-help kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #ccc;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #fafafa;
  color: #333;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.2;
  min-width: 1.4em;
  text-align: center;
}
.flipbook-help__hint {
  margin: 0;
  color: #888;
  font-size: 12px;
  font-style: italic;
}
#flipbook-gradient {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 2vw;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(60, 60, 60, 0.25) 35%,
    rgba(60, 60, 60, 0.85) 50%,
    rgba(60, 60, 60, 0.25) 65%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 10;
  display: none;
}

/* Search. The bar sits over the book rather than beside it: the viewport is the
   whole window, and a book that resized when you searched would move the very
   text you were looking for. */
.flipbook-search {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
  z-index: 20; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.75rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.96); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.flipbook-search[hidden] { display: none; }
.flipbook-search__input {
  border: 0; outline: 0; background: transparent;
  font-size: 0.95rem; min-width: 16rem;
}
/* The browser's own clear button, next to our close button, is two crosses
   side by side meaning different things. The input keeps type="search" for
   what it announces to a screen reader; only the glyph goes. */
.flipbook-search__input::-webkit-search-cancel-button { display: none; }
.flipbook-search__btn {
  border: 0; background: transparent; cursor: pointer; color: #444;
  width: 1.75rem; height: 1.75rem; border-radius: 999px; font-size: 1rem; line-height: 1;
}
.flipbook-search__btn:hover { background: rgba(0, 0, 0, 0.06); }
.flipbook-search__btn:focus-visible { outline: 2px solid #0b5fff; outline-offset: 1px; }
.flipbook-search__close { color: #777; }

.flipbook-search__status {
  font-size: 0.8rem; color: #666; font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* Zoomed, the book is bigger than the frame and is dragged rather than turned.
   The stage's own transform does the scaling; this only says so. */
#flipbook-viewport.is-zoomed { cursor: grab; }
#flipbook-viewport.is-zoomed:active { cursor: grabbing; }

/* Always-visible controls. The keyboard does all of this too, but the panel
   listing the shortcuts only appears on the cover — so from the second page on
   nothing said that zoom or search existed. */
.flipbook-controls {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 20;
  display: flex; align-items: center; gap: 0.125rem;
  padding: 0.25rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.96); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.flipbook-controls__btn {
  border: 0; background: transparent; cursor: pointer; color: #333;
  min-width: 2rem; height: 2rem; padding: 0 0.5rem; border-radius: 999px;
  font-size: 1rem; line-height: 1;
}
.flipbook-controls__btn:hover { background: rgba(0, 0, 0, 0.06); }
.flipbook-controls__btn:focus-visible { outline: 2px solid #0b5fff; outline-offset: 1px; }
.flipbook-controls__search { font-size: 1.15rem; }
/* Tabular figures so the pill does not jump between 100% and 225%. */
.flipbook-controls__level {
  font-size: 0.8rem; color: #666; font-variant-numeric: tabular-nums; min-width: 3.25rem;
}
/* At 100% the level is just a readout; once zoomed it is the way back. */
.flipbook-controls.is-zoomed .flipbook-controls__level { color: #0b5fff; font-weight: 600; }


/* Shown while a newer build is under way: these pages are the earlier one's. Above the
   controls at the bottom, clear of the search bar at the top. */
.flipbook-updating {
  position: fixed;
  bottom: 4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  margin: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.75);
  color: #FFFFFF;
  font: 0.8rem/1.4 system-ui, sans-serif;
  width: max-content;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  text-align: center;
}
.flipbook-updating a { color: inherit; margin-left: 0.5rem; text-decoration: underline; }
