/* ===== 天安集成样册翻页相册 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f2f0ec;
  --ink: #2b2b2b;
  --accent: #a8845c;
  --accent-dark: #8a6a45;
  --paper-edge: #d8d4cc;
}

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
}

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  flex: 0 0 auto;
  z-index: 50;
}
.topbar .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(0,0,0,.08);
  transition: background .2s;
}
.topbar .back-link:hover { background: #fff; }
.topbar .logo-badge {
  height: 40px;
  display: flex;
  align-items: center;
}
.topbar .logo-badge img { height: 100%; width: auto; }

/* 舞台 */
.stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

/* 书本 */
.book-viewport {
  position: relative;
  height: min(92%, 1000px);
  aspect-ratio: 283 / 510;
  perspective: 2200px;
}
.book-shadow {
  position: absolute;
  inset: 4% -12% -2% -12%;
  background: radial-gradient(ellipse at 50% 60%, rgba(0,0,0,.22), transparent 65%);
  pointer-events: none;
}

/* 纸页 */
.sheet {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform .75s cubic-bezier(.25,.1,.25,1);
  will-change: transform;
}
.sheet.instant { transition: none !important; }
.sheet.flipped { transform: rotateY(-180deg); }
.sheet.gone { visibility: hidden; }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 3px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 18px rgba(0,0,0,.15);
}
.face.front { cursor: zoom-in; }
.face.front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none; /* 由 .face 容器接收点击，避免拖动图片 */
}
.face.back {
  transform: rotateY(180deg);
  background-color: #efe9df;
  display: flex;
  align-items: center;
  justify-content: center;
}
.face.back::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: linear-gradient(90deg, rgba(0,0,0,.14), transparent);
}

/* 左右点击热区（点击翻页） */
.hotzone {
  position: absolute;
  top: 0; bottom: 0;
  width: 17%;
  z-index: 60;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 10px;
}
.hotzone.prev { left: 0; justify-content: flex-start; }
.hotzone.next { right: 0; justify-content: flex-end; }
.hotzone .hint {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #666;
  opacity: 0;
  transition: opacity .25s;
}
.hotzone:hover .hint { opacity: 1; }

/* 翻页按钮 */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 70;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(255,255,255,.92);
  color: #444;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  transition: transform .15s, background .2s;
}
.nav-btn:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.nav-btn:disabled { opacity: .25; cursor: default; }
.nav-btn.prev { left: 18px; }
.nav-btn.next { right: 18px; }

/* 底部：页码 + 缩略图 */
.bottombar {
  flex: 0 0 auto;
  padding: 6px 16px 12px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.045));
  z-index: 80;
}
.page-indicator {
  text-align: center;
  font-size: 13px;
  letter-spacing: 1px;
  color: #777;
  margin-bottom: 6px;
  cursor: default;
}
.page-indicator b { color: var(--accent-dark); font-size: 15px; }
.thumb-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 8px;
  scrollbar-width: thin;
}
.thumb-strip::-webkit-scrollbar { height: 6px; }
.thumb-strip::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 3px; }
.thumb {
  flex: 0 0 auto;
  width: 34px;
  aspect-ratio: 283 / 510;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: .55;
  transition: opacity .2s, border-color .2s;
  background: #fff;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { opacity: 1; }
.thumb.active {
  border-color: var(--accent);
  opacity: 1;
}

/* ===== 点击放大（lightbox）===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 10, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s;
  touch-action: none;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox .lb-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.lightbox .lb-img {
  position: absolute;
  top: 50%; left: 50%;
  transform-origin: center center;
  max-width: none;
  will-change: transform;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox .lb-close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 5;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.lightbox .lb-close:hover { background: rgba(255,255,255,.3); }
.lightbox .lb-nav {
  position: absolute;
  top: 0; bottom: 0;
  width: 15%;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.65);
  font-size: 30px;
  cursor: pointer;
  z-index: 4;
}
.lightbox .lb-nav:hover { color: #fff; background: rgba(255,255,255,.06); }
.lightbox .lb-nav.prev { left: 0; }
.lightbox .lb-nav.next { right: 0; }
.lightbox .lb-hint {
  position: absolute;
  bottom: 18px; left: 0; right: 0;
  text-align: center;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  letter-spacing: 1px;
  z-index: 3;
  pointer-events: none;
}

/* ===== 移动端 ===== */
@media (max-width: 640px) {
  .nav-btn { display: none; }
  .book-viewport { height: 96%; }
  .topbar { padding: 6px 10px; }
  .topbar .logo-badge { height: 28px; }
  .topbar .back-link { font-size: 12px; padding: 5px 10px; gap: 4px; }
  .bottombar { padding: 4px 10px 8px; }
  .page-indicator { margin-bottom: 4px; }
  .thumb-strip { display: none; }
  .thumb-strip.open { display: flex; }
  .hotzone { width: 14%; }
}
