/* Open Library Publications — PDF Reader/Flipbook only — 2026-09-08 v86
 * Loaded conditionally on article galley pages.
 */

/* --------------------------------------------------------------------------
   5) PDF host page: v72-style red header + full viewport shell
   -------------------------------------------------------------------------- */
html body.pkp_page_article.pkp_op_view {
  --openlib-pdf-header-h: 2.143rem;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #d1d5db !important;
}
html body.pkp_page_article.pkp_op_view .header_view {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  z-index: 100 !important;
  height: var(--openlib-pdf-header-h) !important;
  min-height: var(--openlib-pdf-header-h) !important;
  margin: 0 !important;
  background: #dc2626 !important;
  box-shadow: none !important;
  overflow: visible !important;
}
html body.pkp_page_article.pkp_op_view .header_view .return,
html body.pkp_page_article.pkp_op_view .header_view .download {
  box-sizing: border-box !important;
  top: 0 !important;
  height: var(--openlib-pdf-header-h) !important;
  min-height: var(--openlib-pdf-header-h) !important;
  line-height: var(--openlib-pdf-header-h) !important;
  background: #fff !important;
  color: #dc2626 !important;
}
html body.pkp_page_article.pkp_op_view .header_view .return {
  left: 0 !important;
  width: var(--openlib-pdf-header-h) !important;
}
html body.pkp_page_article.pkp_op_view .header_view .download {
  right: 0 !important;
  width: auto !important;
  min-width: 92px !important;
  padding: 0 14px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}
html body.pkp_page_article.pkp_op_view .header_view .return:hover,
html body.pkp_page_article.pkp_op_view .header_view .return:focus,
html body.pkp_page_article.pkp_op_view .header_view .download:hover,
html body.pkp_page_article.pkp_op_view .header_view .download:focus {
  background: #fff1f2 !important;
  color: #b91c1c !important;
}
html body.pkp_page_article.pkp_op_view .header_view .title {
  box-sizing: border-box !important;
  display: block !important;
  height: var(--openlib-pdf-header-h) !important;
  line-height: var(--openlib-pdf-header-h) !important;
  margin: 0 !important;
  padding: 0 310px 0 calc(var(--openlib-pdf-header-h) + 12px) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  background: #dc2626 !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}
html body.pkp_page_article.pkp_op_view .header_view .title:hover,
html body.pkp_page_article.pkp_op_view .header_view .title:focus {
  background: #c81e2a !important;
  color: #fff !important;
}

html body.pkp_page_article.pkp_op_view #pdfCanvasContainer.galley_view,
html body.pkp_page_article.pkp_op_view .galley_view {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  max-height: 100vh !important;
  margin: 0 !important;
  overflow: hidden !important;
  background: #d1d5db !important;
}
html body.pkp_page_article.pkp_op_view .galley_view iframe {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding-top: var(--openlib-pdf-header-h) !important;
  border: 0 !important;
  background: #d1d5db !important;
}
html body.pkp_page_article.pkp_op_view .galley_view_with_notice iframe {
  padding-top: 6.429rem !important;
}

/* Reader / Flipbook mode switch in the red PDF header. */
.openlib_pdf_modes {
  position: absolute;
  z-index: 105;
  top: 4px;
  right: 102px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: calc(var(--openlib-pdf-header-h) - 8px);
  padding: 2px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  background: rgba(127,29,29,.16);
}
.openlib_pdf_mode_btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  height: 100%;
  padding: 0 10px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.openlib_pdf_mode_btn:hover,
.openlib_pdf_mode_btn:focus-visible {
  background: rgba(255,255,255,.18);
  outline: none;
}
.openlib_pdf_mode_btn.is-active {
  background: #fff;
  color: #dc2626;
}

/* Reader loading shell; disappears after PDF.js paints a page. */
.openlib_pdf_loading {
  position: fixed;
  z-index: 90;
  inset: var(--openlib-pdf-header-h) 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #d1d5db;
  color: #202938;
  text-align: center;
  transition: opacity .16s ease, visibility .16s ease;
}
.openlib_pdf_loading.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.openlib_pdf_loading__card,
.openlib_flipbook_loading__card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 12px;
  background: #202938;
  color: #fff;
  box-shadow: 0 10px 28px rgba(17,24,39,.18);
  font-size: 12px;
  font-weight: 700;
}
.openlib_pdf_loading__spinner,
.openlib_flipbook_spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: openlibPdfSpin .8s linear infinite;
}
.openlib_pdf_loading__fallback {
  display: none;
  margin-left: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 7px;
  color: #fff !important;
  text-decoration: none !important;
  white-space: nowrap;
}
.openlib_pdf_loading.is-slow .openlib_pdf_loading__fallback { display: inline-flex; }
@keyframes openlibPdfSpin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   6) Flipbook mode — PDF.js renders only the visible spread (lazy rendering)
   -------------------------------------------------------------------------- */
.openlib_flipbook {
  position: absolute;
  z-index: 80;
  inset: var(--openlib-pdf-header-h) 0 0 0;
  display: none;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #cfd2d7;
  color: #172033;
}
.openlib_flipbook.is-active { display: flex; }
.openlib_flipbook_toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 12px;
  border-bottom: 1px solid #b8bdc5;
  background: #f6f7f8;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.openlib_flipbook_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid #c8ccd2;
  border-radius: 7px;
  background: #fff;
  color: #1f2937;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.openlib_flipbook_btn:hover:not(:disabled),
.openlib_flipbook_btn:focus-visible:not(:disabled) {
  border-color: #dc2626;
  color: #dc2626;
  outline: none;
}
.openlib_flipbook_btn:disabled {
  opacity: .42;
  cursor: default;
}
.openlib_flipbook_counter {
  min-width: 92px;
  color: #4b5563;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.openlib_flipbook_stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 18px 34px 24px;
  overflow: hidden;
  perspective: 1800px;
  background: radial-gradient(circle at center, #e0e2e5 0%, #c9ccd1 70%, #c2c5ca 100%);
}
.openlib_flipbook_book {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: 100%;
  max-height: 100%;
  transform-style: preserve-3d;
  filter: drop-shadow(0 16px 22px rgba(17,24,39,.20));
}
.openlib_flipbook_page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(17,24,39,.08);
  backface-visibility: hidden;
  transform-origin: center center;
}
.openlib_flipbook_page:first-child { transform-origin: right center; }
.openlib_flipbook_page:last-child { transform-origin: left center; }
.openlib_flipbook_page canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
}
.openlib_flipbook_page--empty {
  width: 0 !important;
  min-width: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
.openlib_flipbook_book.is-flipping-next .openlib_flipbook_page:last-child {
  animation: openlibFlipNext .24s ease-in-out;
}
.openlib_flipbook_book.is-flipping-prev .openlib_flipbook_page:first-child {
  animation: openlibFlipPrev .24s ease-in-out;
}
@keyframes openlibFlipNext {
  0% { transform: rotateY(0deg); }
  48% { transform: rotateY(-18deg) translateX(-4px); filter: brightness(.92); }
  100% { transform: rotateY(0deg); }
}
@keyframes openlibFlipPrev {
  0% { transform: rotateY(0deg); }
  48% { transform: rotateY(18deg) translateX(4px); filter: brightness(.92); }
  100% { transform: rotateY(0deg); }
}
.openlib_flipbook_loading {
  position: absolute;
  z-index: 4;
  inset: 44px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(207,210,215,.94);
  transition: opacity .16s ease, visibility .16s ease;
}
.openlib_flipbook_loading.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.openlib_flipbook_error {
  max-width: 520px;
  padding: 16px 20px;
  border-radius: 12px;
  background: #fff;
  color: #7f1d1d;
  box-shadow: 0 10px 28px rgba(17,24,39,.12);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
body.openlib-flipbook-active .galley_view > iframe { visibility: hidden !important; }
body.openlib-flipbook-active .openlib_pdf_loading { display: none !important; }

@media (max-width: 900px) {
  html body.pkp_page_article.pkp_op_view .header_view .title {
    padding-right: 250px !important;
  }
  .openlib_pdf_modes { right: 88px; }
  html body.pkp_page_article.pkp_op_view .header_view .download {
    min-width: 80px !important;
    padding: 0 10px !important;
  }
  .openlib_flipbook_stage { padding: 12px 10px 18px; }
}
@media (max-width: 640px) {
  html body.pkp_page_article.pkp_op_view .header_view .title {
    padding-right: 164px !important;
    font-size: 10px !important;
  }
  html body.pkp_page_article.pkp_op_view .header_view .download {
    width: var(--openlib-pdf-header-h) !important;
    min-width: var(--openlib-pdf-header-h) !important;
    padding: 0 !important;
  }
  html body.pkp_page_article.pkp_op_view .header_view .download .label { display: none !important; }
  .openlib_pdf_modes { right: calc(var(--openlib-pdf-header-h) + 4px); }
  .openlib_pdf_mode_btn { padding: 0 7px; font-size: 9px; }
  .openlib_flipbook_toolbar { min-height: 40px; }
  .openlib_flipbook_btn { min-width: 62px; height: 28px; padding: 0 9px; }
  .openlib_flipbook_counter { min-width: 72px; }
}

/* --------------------------------------------------------------------------
   7) 0908 v84 — PDF header action polish + reliable flipbook controls
   -------------------------------------------------------------------------- */
/* The lightweight PDF page does not always inherit every declaration from
   viewPdf.less, so keep the right-side Download button fully self-contained. */
html body.pkp_page_article.pkp_op_view .header_view .download {
  display: inline-flex !important;
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 108 !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: auto !important;
  min-width: 94px !important;
  height: var(--openlib-pdf-header-h) !important;
  margin: 0 !important;
  padding: 0 14px !important;
  float: none !important;
  transform: none !important;
  background: #fff !important;
  color: #dc2626 !important;
  white-space: nowrap !important;
}
html body.pkp_page_article.pkp_op_view .header_view .download .label {
  display: inline-block !important;
  color: inherit !important;
}

/* Reader / Flipbook is intentionally styled like the Login/Register capsule:
   white shell, red active button, clearly clickable inactive button. */
html body.pkp_page_article.pkp_op_view .openlib_pdf_modes {
  top: 3px !important;
  right: 106px !important;
  height: calc(var(--openlib-pdf-header-h) - 6px) !important;
  gap: 3px !important;
  padding: 3px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 1px 5px rgba(17,24,39,.16) !important;
}
html body.pkp_page_article.pkp_op_view .openlib_pdf_mode_btn {
  min-width: 64px !important;
  height: 100% !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: #dc2626 !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease !important;
}
html body.pkp_page_article.pkp_op_view .openlib_pdf_mode_btn:hover,
html body.pkp_page_article.pkp_op_view .openlib_pdf_mode_btn:focus-visible {
  background: #fff1f2 !important;
  color: #b91c1c !important;
  outline: none !important;
}
html body.pkp_page_article.pkp_op_view .openlib_pdf_mode_btn.is-active {
  background: #dc2626 !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(220,38,38,.26) !important;
}

/* Keep the flipbook navigation above all book/loading surfaces and guarantee
   that the controls receive pointer events. */
.openlib_flipbook_toolbar {
  z-index: 12 !important;
  pointer-events: auto !important;
}
.openlib_flipbook_btn {
  position: relative !important;
  z-index: 13 !important;
  pointer-events: auto !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}
.openlib_flipbook_btn:hover:not(:disabled),
.openlib_flipbook_btn:focus-visible:not(:disabled) {
  border-color: #dc2626 !important;
  background: #dc2626 !important;
  color: #fff !important;
  box-shadow: 0 3px 8px rgba(220,38,38,.18) !important;
}

@media (max-width: 900px) {
  html body.pkp_page_article.pkp_op_view .openlib_pdf_modes {
    right: 94px !important;
  }
  html body.pkp_page_article.pkp_op_view .header_view .download {
    min-width: 84px !important;
    padding: 0 10px !important;
  }
}
@media (max-width: 640px) {
  html body.pkp_page_article.pkp_op_view .openlib_pdf_modes {
    right: calc(var(--openlib-pdf-header-h) + 4px) !important;
    padding: 2px !important;
  }
  html body.pkp_page_article.pkp_op_view .openlib_pdf_mode_btn {
    min-width: 0 !important;
    padding: 0 7px !important;
    font-size: 9px !important;
  }
  html body.pkp_page_article.pkp_op_view .header_view .download {
    width: var(--openlib-pdf-header-h) !important;
    min-width: var(--openlib-pdf-header-h) !important;
    padding: 0 !important;
  }
  html body.pkp_page_article.pkp_op_view .header_view .download .label {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   8) 0908 v85 — tactile book interaction: drag/swipe/click-edge page turning
   -------------------------------------------------------------------------- */
.openlib_flipbook_stage {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.openlib_flipbook_stage.is-gesture-active { cursor: grabbing; }
.openlib_flipbook_page {
  will-change: transform, filter, box-shadow;
  transition: transform .16s ease-out, filter .16s ease-out, box-shadow .16s ease-out;
}
.openlib_flipbook_stage.is-gesture-active .openlib_flipbook_page {
  transition: none;
}
.openlib_flipbook_page::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.16) 18%, rgba(255,255,255,0) 44%);
  transition: opacity .12s ease;
}
.openlib_flipbook_page.is-openlib-dragging::after { opacity: .72; }
.openlib_flipbook_page.is-openlib-dragging-prev::after {
  background: linear-gradient(270deg, rgba(0,0,0,.18), rgba(255,255,255,.16) 18%, rgba(255,255,255,0) 44%);
}
.openlib_flipbook_turnsheet {
  position: absolute !important;
  z-index: 25 !important;
  margin: 0 !important;
  pointer-events: none !important;
  transform-style: preserve-3d;
  will-change: transform, filter, box-shadow;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 10px 26px rgba(17,24,39,.28), 0 0 0 1px rgba(17,24,39,.08);
}
.openlib_flipbook_turnsheet::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(17,24,39,.26), rgba(255,255,255,.10) 16%, rgba(255,255,255,0) 48%);
  opacity: .72;
}
.openlib_flipbook_turnsheet.is-prev::after {
  background: linear-gradient(270deg, rgba(17,24,39,.26), rgba(255,255,255,.10) 16%, rgba(255,255,255,0) 48%);
}
.openlib_flipbook_gesture_hint {
  position: absolute;
  z-index: 5;
  right: 18px;
  bottom: 14px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(17,24,39,.68);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  opacity: .82;
  transition: opacity .2s ease;
}
.openlib_flipbook_stage:hover .openlib_flipbook_gesture_hint { opacity: 1; }
.openlib_flipbook_stage.is-gesture-active .openlib_flipbook_gesture_hint { opacity: 0; }
@media (max-width: 700px) {
  .openlib_flipbook_gesture_hint {
    right: 10px;
    bottom: 10px;
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .openlib_flipbook_page,
  .openlib_flipbook_turnsheet {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}


/* --------------------------------------------------------------------------
   9) 0908 v86 — lightweight magnifier for Flipbook detail reading
   -------------------------------------------------------------------------- */
.openlib_flipbook_btn--magnify {
  min-width: 92px;
  margin-left: 2px;
}
.openlib_flipbook_btn--magnify.is-active {
  border-color: #dc2626 !important;
  background: #dc2626 !important;
  color: #fff !important;
  box-shadow: 0 3px 8px rgba(220,38,38,.18) !important;
}
.openlib_flipbook_stage.is-magnify-mode {
  cursor: crosshair !important;
}
.openlib_flipbook_stage.is-magnify-mode .openlib_flipbook_gesture_hint {
  opacity: 0 !important;
}
.openlib_flipbook_loupe {
  position: absolute;
  z-index: 40;
  display: none;
  width: 188px;
  height: 188px;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 12px 32px rgba(17,24,39,.34), 0 0 0 2px rgba(220,38,38,.72);
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.openlib_flipbook_stage.is-magnify-mode .openlib_flipbook_loupe.is-visible {
  display: block;
}
.openlib_flipbook_loupe canvas {
  display: block;
  width: 180px;
  height: 180px;
  background: #fff;
}
.openlib_flipbook_loupe__badge {
  position: absolute;
  right: 9px;
  bottom: 8px;
  min-width: 30px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(17,24,39,.76);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
@media (hover: none), (pointer: coarse), (max-width: 700px) {
  .openlib_flipbook_btn--magnify,
  .openlib_flipbook_loupe { display: none !important; }
}
