body.modal-open {
  overflow: hidden;
  width: 100%;
  touch-action: none;
  overscroll-behavior: none;
}

.turnjs-cover {
  text-align: center;
}

.turnjs-launch {
  font-size: 16px;
  cursor: pointer;
}

.turnjs-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0%);
  width: 100%;
  height: 100vh;
  z-index: 100000000000;
}

.turnjs-modal-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #000;
  opacity: 0.7;
  z-index: 100000000000;
}

.turnjs-modal-content {
  position: absolute;
  width: 100%;
  height: 100vh;
  top:0;
  margin: 0;
  min-height: -webkit-fill-available;
  background: #f8f8f8;
  padding: 10px;
  overflow: hidden;
  z-index: 100000000000001;
  display: flex;
  flex-direction: column;
  border: 12px solid;
}

.turnjs-close {
  float: right;
  font-size: 16px;
  padding: 3px;
  cursor: pointer;
}

.flipbook-wrapper {
  position: relative;
  text-align: center;
  cursor: grab;
  flex: 1 1 86%;
  overflow: hidden;
  perspective: 1600px;
  perspective-origin: 50% 50%;
}
.flipbook {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: center center;
  display: flex;
  overflow: hidden;
}
.flipbook img {
  width: auto; /* prevent auto-stretch full width for custom desktop */
  height: 100%;
  display: none; /* shown selectively by JS */
  max-width: none;
}
.flipbook img.spread-left, .flipbook img.spread-right, .flipbook img.single-page {
  display: inline-block !important;
  object-fit: contain;
}
.flipbook img.spread-left, .flipbook img.spread-right {
  vertical-align: top;
}
.flipbook img.spread-left { margin-right: 0; }
.flipbook img.spread-right { margin-left: 0; }
.flipbook img.single-page { display: inline-block; }


@media (orientation: portrait) {
  .flipbook {
    margin: 0 auto !important;
  }
  .flipbook-wrapper {
    display: flex;
    align-items: center;
  }
}
.flipbook-wrapper:active {
  cursor: grabbing;
}
/* Removed old TurnJS page-wrapper shadow */

/* Desktop viewer scope adjustments */
.desktop-viewer-active .flipbook {display:flex;top:0;left:0;margin:0 !important;}
.desktop-viewer-active .flipbook img.single-page { margin: 0 auto; }

/* Mobile slideshow (portrait narrow) reuse original full-width single page style */
@media (max-width: 959px) and (orientation: portrait) {
  .turnjs-modal-content:not(.desktop-viewer-active) .flipbook img { width: 100%; height: auto; display: none; position: relative; }
  .turnjs-modal-content:not(.desktop-viewer-active) .flipbook img.zoomed { transform-origin: top left; }
  .flipbook {
    top: 50%;
    left: 0;
    transform: translateX(0%) translateY(-50%);
  }
}

.turn-controls {
  text-align: center;
}

/* Controls: style buttons like icons */
.turn-controls button {
  display: inline-block;
  margin: 0 5px;
  padding: 0;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  position: absolute;
  z-index: 1000;
  top: 43%;
  width: 32px;
  height: 32px;
  overflow: hidden;
  background-color: rgba(255,255,255,0.5);
  border: 2px solid var(--primary);
  box-shadow: none;
  outline: none;
  border: none;
}
.turn-controls button:before {
  width: 28px;
  height: 28px;
  overflow: hidden;
  content: "";
  display: inline-block;
  background-size: contain;
}
.turn-controls .turn-next { right: 6px; }
.turn-controls .turn-next:before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M184 112l144 144-144 144'/%3E%3C/svg%3E");
}
.turn-controls .turn-prev { left: 6px; }
.turn-controls .turn-prev:before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M328 112L184 256l144 144'/%3E%3C/svg%3E");
}
.turn-controls .turn-zoom-toggle {
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}
.turn-controls .turn-zoom-in {
  top: 6px;
  left: calc(50% + 48px);
  transform: translateX(-50%);
  border-radius: 50%;
}
.turn-controls .turn-zoom-out {
  top: 6px;
  left: calc(50% - 48px);
  transform: translateX(-50%);
  border-radius: 50%;
}
.turn-controls .turn-zoom-in:before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='32' d='M256 112v288M400 256H112'/%3E%3C/svg%3E");
}
.turn-controls .turn-zoom-out:before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='32' d='M400 256H112'/%3E%3C/svg%3E");
}
.turn-controls .turn-zoom-toggle:before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='32' d='M432 320v112H320M421.8 421.77L304 304M80 192V80h112M90.2 90.23L208 208M320 80h112v112M421.77 90.2L304 208M192 432H80V320M90.23 421.8L208 304'/%3E%3C/svg%3E");
}
.turn-controls .turn-zoom-toggle.toggle-on:before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='32' d='M304 416V304h112M314.2 314.23L432 432M208 96v112H96M197.8 197.77L80 80M416 208H304V96M314.23 197.8L432 80M96 304h112v112M197.77 314.2L80 432'/%3E%3C/svg%3E");
}

/* Thumbnails as buttons */
.turn-thumbnails-wrapper {
  display: flex;
  justify-content: center;
  justify-self: end;
  flex: 1 1 12%;
}
.turn-thumbnails {
  display: flex;
  flex-direction: row;
  justify-content: left;
  margin: 10px auto;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 6px 4px;
  gap: 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.turn-thumb {
  height: 60px;
  margin: 0;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  box-shadow: none;
  outline: none;
  min-width: 42px;
}
.turn-thumb.selected {
  border: 2px solid #0074d9;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}
.turn-thumb img {
  display: block;
  height: 100%;
  width: auto;
  pointer-events: none;
  user-select: none;
}
.turnjs-cover-image {
  max-width: 100%;
  height: auto;
}

.turnjs-modal-content button.turnjs-close {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 28px;
  height: 28px;
  overflow: hidden;
  z-index: 1000;
  margin: 0;
}
.turnjs-modal-content button.turnjs-close:before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'%3E%3Cpath fill='none' stroke='%23FFF' stroke-linecap='round' stroke-linejoin='round' stroke-width='32' d='M368 368L144 144M368 144L144 368'/%3E%3C/svg%3E");
  background-size: contain;
}

/* Simple flip only */
.ns-disabled { pointer-events:none !important; opacity:0.5; }

/* Simple flip fallback */
.ns-simple-clone { background:#fff; box-shadow:0 0 12px rgba(0,0,0,0.25); }
.ns-simple-forward { animation: nsSimpleForward 0.55s ease forwards; }
.ns-simple-backward { animation: nsSimpleBackward 0.55s ease forwards; }
@keyframes nsSimpleForward {
  0% { transform: rotateY(0deg); }
  50% { box-shadow:0 0 18px rgba(0,0,0,0.35); }
  100% { transform: rotateY(-180deg); opacity:0; }
}
@keyframes nsSimpleBackward {
  0% { transform: rotateY(0deg); }
  50% { box-shadow:0 0 18px rgba(0,0,0,0.35); }
  100% { transform: rotateY(180deg); opacity:0; }
}
