
/* ==============================
   Fast Flipbook
============================== */

/* ==============================
   翻书外层
============================== */

.fast-flipbook {
  width: 100%;
  max-width: 1500px;
  margin: 40px auto;
  padding: 28px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  box-shadow:
    0 30px 80px rgba(20, 34, 52, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

/* ==============================
   顶部工具栏
============================== */

.fast-book-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.fast-book-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  color: #173650;
  background: #ffffff;
  border: 1px solid #e3e8ed;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 20px rgba(18, 39, 59, 0.07);
}

.fast-book-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fast-book-buttons button {
  min-width: 110px;
  min-height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: #173650;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(23, 54, 80, 0.2);
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

.fast-book-buttons button:hover:not(:disabled) {
  background: #c39531;
  box-shadow: 0 9px 22px rgba(195, 149, 49, 0.25);
  transform: translateY(-2px);
}

.fast-book-buttons button:active:not(:disabled) {
  transform: translateY(0);
}

.fast-book-buttons button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

/* ==============================
   双页书本
============================== */

.fast-book-stage {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding: 1px;
}

.fast-book {
  position: relative;
  width: 100%;

  /*
   * 两张A4比例页面并排。
   * 如果图片比例不同，可以修改这里。
   */
  aspect-ratio: 1.41 / 1;

  overflow: visible;
  background: #ffffff;
  border-radius: 14px;
  perspective: 2600px;
  transform-style: preserve-3d;
  box-shadow:
    0 26px 60px rgba(18, 29, 40, 0.2),
    0 7px 18px rgba(18, 29, 40, 0.1);
  touch-action: pan-y;
  user-select: none;
}

/* 书本下方纸张厚度 */
.fast-book::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 8px;
  bottom: -10px;
  left: 8px;
  height: 16px;
  background: repeating-linear-gradient(
    to bottom,
    #d8d6d0 0,
    #d8d6d0 1px,
    #f8f7f2 1px,
    #f8f7f2 3px
  );
  border-radius: 0 0 12px 12px;
  box-shadow: 0 7px 15px rgba(0, 0, 0, 0.15);
}

/* 中间书脊 */
.fast-book::before {
  content: "";
  position: absolute;
  z-index: 20;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.06);
  box-shadow:
    -16px 0 25px rgba(0, 0, 0, 0.08),
    16px 0 25px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

/* ==============================
   固定页面
============================== */

.fast-page {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
}

.fast-page-left {
  left: 0;
  border-radius: 14px 0 0 14px;
}

.fast-page-right {
  right: 0;
  border-radius: 0 14px 14px 0;
}

.fast-page img,
.fast-turn-face img {
  display: block;
  width: 100%;
  height: 100%;
  background: #ffffff;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.fast-page img.is-empty,
.fast-turn-face img.is-empty {
  opacity: 0;
}

/* 左页书脊阴影 */
.fast-page-left::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 9%;
  height: 100%;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.09), rgba(0, 0, 0, 0));
  pointer-events: none;
}

/* 右页书脊阴影 */
.fast-page-right::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 9%;
  height: 100%;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.09), rgba(0, 0, 0, 0));
  pointer-events: none;
}

/* ==============================
   翻动页面
============================== */

.fast-turn-sheet {
  display: none;
  position: absolute;
  z-index: 30;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.fast-turn-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #ffffff;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.fast-turn-front {
  border-radius: 0 14px 14px 0;
}

.fast-turn-back {
  border-radius: 14px 0 0 14px;
  transform: rotateY(180deg);
}

/* 翻动纸张正面阴影 */
.fast-turn-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to left,
    rgba(0, 0, 0, 0.24),
    rgba(0, 0, 0, 0) 30%
  );
  pointer-events: none;
}

/* 翻动纸张背面阴影 */
.fast-turn-back::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.2),
    rgba(0, 0, 0, 0) 30%
  );
  pointer-events: none;
}

/* ==============================
   翻页时底层阴影
============================== */

.fast-book.is-turning-next .fast-page-right::before,
.fast-book.is-turning-prev .fast-page-left::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  animation: fast-page-shadow 720ms ease both;
}

.fast-book.is-turning-next .fast-page-right::before {
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.22),
    rgba(0, 0, 0, 0) 36%
  );
}

.fast-book.is-turning-prev .fast-page-left::before {
  background: linear-gradient(
    to left,
    rgba(0, 0, 0, 0.22),
    rgba(0, 0, 0, 0) 36%
  );
}

@keyframes fast-page-shadow {
  0%,
  100% {
    opacity: 0;
  }

  45%,
  65% {
    opacity: 1;
  }
}

/* ==============================
   左右点击翻页区域
============================== */

.fast-book-hotspot {
  position: absolute;
  z-index: 40;
  top: 0;
  width: 14%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent !important;
  cursor: pointer;
}

.fast-book-hotspot-prev {
  left: 0;
}

.fast-book-hotspot-next {
  right: 0;
}

.fast-book-hotspot::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.fast-book-hotspot-prev::after {
  left: 22px;
  border-bottom: 3px solid rgba(23, 54, 80, 0.7);
  border-left: 3px solid rgba(23, 54, 80, 0.7);
  transform: translateY(-50%) rotate(45deg);
}

.fast-book-hotspot-next::after {
  right: 22px;
  border-top: 3px solid rgba(23, 54, 80, 0.7);
  border-right: 3px solid rgba(23, 54, 80, 0.7);
  transform: translateY(-50%) rotate(45deg);
}

.fast-book-hotspot:hover:not(:disabled)::after {
  opacity: 1;
}

.fast-book-hotspot:disabled {
  cursor: default;
}

.fast-book-hotspot:disabled::after {
  display: none;
}

/* ==============================
   提示文字
============================== */

.fast-book-tip {
  margin: 20px 0 0;
  color: #657383;
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

/* ==============================
   1199px及以下：单页模式
============================== */

.fast-flipbook.is-single-page .fast-book-stage {
  width: 100%;
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
}

.fast-flipbook.is-single-page .fast-book {
  /*
   * 单张A4竖版页面比例。
   */
  aspect-ratio: 0.707 / 1;
}

/* 隐藏左页 */
.fast-flipbook.is-single-page .fast-page-left {
  display: none;
}

/* 右页扩展为整页 */
.fast-flipbook.is-single-page .fast-page-right {
  right: auto;
  left: 0;
  width: 100%;
  border-radius: 14px;
}

/* 单页模式隐藏中间书脊 */
.fast-flipbook.is-single-page .fast-book::before {
  display: none;
}

/* 单页模式隐藏书脊阴影 */
.fast-flipbook.is-single-page .fast-page-right::after {
  display: none;
}

/* 单页翻动纸张占满整个书本 */
.fast-flipbook.is-single-page .fast-turn-sheet {
  width: 100%;
}

.fast-flipbook.is-single-page .fast-turn-front,
.fast-flipbook.is-single-page .fast-turn-back {
  border-radius: 14px;
}

.fast-flipbook.is-single-page .fast-book-hotspot {
  width: 22%;
}

/* 单页模式翻页底层阴影 */
.fast-flipbook.is-single-page
  .fast-book.is-turning-next
  .fast-page-right::before,
.fast-flipbook.is-single-page
  .fast-book.is-turning-prev
  .fast-page-right::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.18),
    rgba(0, 0, 0, 0) 42%
  );
  pointer-events: none;
  animation: fast-page-shadow 720ms ease both;
}

/* ==============================
   平板
============================== */

@media (max-width: 1199px) {
  .page-container {
    padding: 30px 16px;
  }

  .fast-flipbook {
    padding: 20px;
  }

  .fast-book-toolbar {
    margin-bottom: 18px;
  }

  .fast-book-buttons button {
    min-width: 96px;
    padding: 0 18px;
    font-size: 14px;
  }
}

/* ==============================
   手机
============================== */

@media (max-width: 767px) {
  .page-container {
    padding: 14px 10px;
  }

  .fast-flipbook {
    padding: 12px;
    border-radius: 16px;
  }

  .fast-book-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .fast-book-counter {
    width: 100%;
  }

  .fast-book-buttons {
    width: 100%;
  }

  .fast-book-buttons button {
    flex: 1;
    min-width: 0;
    padding: 0 12px;
  }

  .fast-flipbook.is-single-page .fast-page-right,
  .fast-flipbook.is-single-page .fast-turn-front,
  .fast-flipbook.is-single-page .fast-turn-back {
    border-radius: 8px;
  }

  .fast-book {
    border-radius: 8px;
  }

  .fast-book-tip {
    margin-top: 15px;
    font-size: 12px;
  }

  .fast-book-hotspot {
    width: 20%;
  }

  .fast-flipbook.is-single-page .fast-book-hotspot {
    width: 25%;
  }

  .fast-book-hotspot-prev::after {
    left: 12px;
  }

  .fast-book-hotspot-next::after {
    right: 12px;
  }
}

/* ==============================
   减少动画偏好
============================== */

@media (prefers-reduced-motion: reduce) {
  .fast-book-buttons button,
  .fast-book-hotspot::after {
    transition: none;
  }
}
/* ==============================
   Fast Flipbook
============================== */