/**
 * Simple Truth document viewer — layout, zoom scroll, transitions.
 */

body.flipbook-page {
  margin: 0;
  padding: 0;
  width: 100%;
  background: #080808;
  overflow: hidden;
}

body.flipbook-page .container-page {
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #080808;
  overflow: hidden;
}

body.flipbook-page .cursor {
  display: none;
}

body.flipbook-page .header {
  flex: 0 0 auto;
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  padding: 0;
  transform: none;
  -webkit-transform: none;
  z-index: 20;
  background: rgba(8, 8, 8, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

body.flipbook-page .header .header__builder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 12px 0 16px;
}

body.flipbook-page .logo-image img {
  height: 32px;
  width: auto;
}

body.flipbook-page .wrapper {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.flipbook-page .float-book-cta,
body.flipbook-page #st-float-book,
body.flipbook-page #st-page-back {
  display: none !important;
}

body.flipbook-page .footer {
  display: none;
}

.st-flipbook {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse 90% 75% at 50% 45%, #1c1410 0%, #080808 75%);
}

.st-flipbook.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  height: 100vh;
  height: 100dvh;
}

body.flipbook-fullscreen-active .header {
  display: none;
}

body.flipbook-fullscreen-active .st-flipbook__stage {
  padding: 0;
}

body.flipbook-fullscreen-active.st-flipbook-page .container-page {
  height: 100vh;
  height: 100dvh;
}

/* Loader — absolute overlay so stage keeps full height while loading */
.st-flipbook__loader {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 8, 0.92);
}

.st-flipbook__loader[hidden] {
  display: none !important;
}

.st-flipbook__loader-text {
  font-family: "Roboto", sans-serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.st-flipbook__loader-bar {
  width: 140px;
  height: 2px;
  margin: 14px auto 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.st-flipbook__loader-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: #eb6165;
  transition: width 0.25s ease;
}

/* Stage + scroll viewport (zoom-viewport) */
.st-flipbook__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 0 0;
  overflow: hidden;
}

.st-flipbook__scroll-frame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #080808;
}

/* zoom-spacer: JS sets explicit scaled dimensions */
.st-flipbook__scroll-inner {
  display: block;
  position: relative;
  box-sizing: border-box;
}

/* zoom-content: natural page size + transform scale */
.st-flipbook__viewport {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
  touch-action: none;
}

.st-flipbook__page-track {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Book-style page turn */
.st-flipbook__page-turn-stage {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1800px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  overflow: hidden;
}

.st-flipbook--turn-next .st-flipbook__page-turn-stage {
  perspective-origin: 0% 50%;
}

.st-flipbook--turn-prev .st-flipbook__page-turn-stage {
  perspective-origin: 100% 50%;
}

.st-flipbook__page-under {
  position: absolute;
  inset: 0;
  z-index: 0;
  visibility: hidden;
}

.st-flipbook__page-turn--active .st-flipbook__page-under {
  visibility: visible;
}

.st-flipbook__page-cast-shadow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
}

.st-flipbook__page-turn-sheet {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-style: preserve-3d;
}

.st-flipbook__page-flip-pivot {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform, filter;
}

.st-flipbook__page-flip-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
}

.st-flipbook__page-flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #faf6ee 0%, #ebe3d6 50%, #d5cabb 100%);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.1);
}

.st-flipbook__page-flip-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: linear-gradient(
    105deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(0, 0, 0, 0.06) 35%,
    rgba(0, 0, 0, 0.34) 100%
  );
}

.st-flipbook__canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

.st-flipbook--nav-lock .st-flipbook__page-turn-stage,
.st-flipbook--nav-lock .st-flipbook__page-track {
  overflow: hidden;
}

.st-flipbook--nav-lock .st-flipbook__scroll-frame {
  overflow: hidden;
}

/* Zoom pan */
.st-flipbook--zoom-active .st-flipbook__scroll-frame {
  cursor: grab;
  touch-action: none;
}

.st-flipbook--panning .st-flipbook__scroll-frame {
  cursor: grabbing;
  user-select: none;
}

/* Footer */
.st-flipbook__footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 30;
}

.st-flipbook__slider {
  display: none !important;
}

.st-flipbook__foot-nav {
  flex: 0 0 auto;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(235, 97, 101, 0.55);
  border-radius: 10px;
  background: rgba(235, 97, 101, 0.28);
  color: #fff !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: "Roboto", sans-serif;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.st-flipbook__foot-nav:hover:not(:disabled),
.st-flipbook__foot-nav:focus-visible:not(:disabled) {
  background: rgba(235, 97, 101, 0.42);
}

.st-flipbook__foot-nav:active:not(:disabled) {
  transform: scale(0.97);
}

.st-flipbook__foot-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.st-flipbook__foot-nav-chevron {
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  color: #fff;
}

.st-flipbook__foot-nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}

.st-flipbook__page-num {
  flex: 1 1 auto;
  font-family: "Roboto", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  min-width: 44px;
}

.st-flipbook__zoom-bar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.st-flipbook__zoom-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.st-flipbook__zoom-btn:hover:not(:disabled),
.st-flipbook__zoom-btn:focus-visible:not(:disabled) {
  background: rgba(235, 97, 101, 0.35);
}

.st-flipbook__zoom-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.st-flipbook__zoom-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.st-flipbook__zoom-btn--reset {
  min-width: auto;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.st-flipbook__zoom-label {
  min-width: 44px;
  padding: 0 4px;
  font-family: "Roboto", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  white-space: nowrap;
}

.st-flipbook__footer-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}

.st-flipbook__action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
}

.st-flipbook__action--download {
  background: rgba(235, 97, 101, 0.22);
}

.st-flipbook__action--download:hover {
  background: rgba(235, 97, 101, 0.38);
}

.st-flipbook__action:hover {
  background: rgba(255, 255, 255, 0.18);
}

.st-flipbook__action--close {
  background: rgba(235, 97, 101, 0.22);
}

.st-flipbook__action--close:hover {
  background: rgba(235, 97, 101, 0.38);
}

.st-flipbook__action svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.st-flipbook__action-label {
  white-space: nowrap;
}

.st-flipbook__error {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
}

.st-flipbook__error a {
  color: #eb6165;
}

@media screen and (max-width: 768px) {
  body.flipbook-page .header {
    border-bottom-width: 0;
  }

  body.flipbook-page .header .header__builder {
    min-height: 40px;
    padding: 0 8px 0 10px;
  }

  body.flipbook-page .logo-image img {
    height: 26px;
  }

  .st-flipbook__stage {
    padding: 0;
  }

  .st-flipbook__footer {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  }

  .st-flipbook__foot-nav--prev,
  .st-flipbook__foot-nav--next {
    flex: 1 1 0;
    justify-content: center;
  }

  .st-flipbook__page-num {
    flex: 0 0 auto;
    min-width: 44px;
    font-size: 12px;
  }

  .st-flipbook__zoom-bar {
    gap: 2px;
    padding: 1px;
  }

  .st-flipbook__zoom-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
  }

  .st-flipbook__zoom-btn--reset {
    padding: 0 8px;
    font-size: 9px;
  }

  .st-flipbook__zoom-label {
    min-width: 40px;
    font-size: 11px;
  }

  .st-flipbook__action-label {
    display: none;
  }

  .st-flipbook__action {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }

  .st-flipbook__foot-nav {
    min-height: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .st-flipbook__foot-nav,
  .st-flipbook__action,
  .st-flipbook__zoom-btn {
    transition: none;
  }
}
