/* ============================================================
   产品图册翻页阅读器  catalog.css
   独立样式，不复用 tailwind.css 的构建产物，
   避免新增工具类不在已构建的 CSS 里而失效。
   ============================================================ */

.cb-reader {
  --cb-bar-h: 58px;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: radial-gradient(125% 90% at 50% 0%, #17324f 0%, #0d1726 52%, #070c14 100%);
  color: #fff;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
@supports (height: 100dvh) {
  .cb-reader { height: 100dvh; }
}
body.cb-page-body { padding-top: 0; }
@media (max-width: 1023px) {
  .cb-reader { --cb-bar-h: 54px; }
}

/* ---------- 顶部信息条 ---------- */
/* 本页不加载站点导航，只留一个返回按钮 */
.cb-back {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: #eaf2fb;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.cb-back:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .3); }
.cb-back:active { transform: scale(.95); }
.cb-back svg { width: 18px; height: 18px; }

.cb-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  background: rgba(7, 12, 20, .55);
}
.cb-top-main { min-width: 0; flex: 1 1 auto; }
.cb-top-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #eaf2fb;
}
.cb-top-sub {
  font-size: 11px;
  color: #7e93ad;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: #062d54;
  background: linear-gradient(135deg, #8fd8ea, #ffffff);
  text-decoration: none;
  white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease;
}
.cb-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(143, 216, 234, .3); }
@media (max-width: 639px) {
  .cb-top { padding: 8px 11px; gap: 8px; }
  .cb-top-title { font-size: 12.5px; }
  .cb-top-sub { display: none; }
  .cb-cta { height: 31px; padding: 0 11px; font-size: 11.5px; }
}

/* ---------- 翻页可视区 ---------- */
.cb-viewport {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
}
.cb-viewport::-webkit-scrollbar { width: 9px; height: 9px; }
.cb-viewport::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .2);
  border-radius: 9px;
}
.cb-viewport::-webkit-scrollbar-track { background: transparent; }

.cb-book {
  position: relative;
  margin: auto;
  flex: 0 0 auto;
  perspective: 2100px;
  perspective-origin: 50% 50%;
}
@media (max-width: 767px) {
  .cb-viewport { padding: 9px; }
  .cb-book { perspective: 1400px; }
}

.cb-page {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 3px;
  overflow: hidden;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-origin: 0% 50%;
  transform: rotateY(0deg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
  will-change: transform;
}
.cb-page.is-turning {
  transition: transform .66s cubic-bezier(.42, .02, .26, 1);
}
.cb-page.cb-flip-out { transform: rotateY(-180deg); }
.cb-page.cb-flip-in { transform: rotateY(0deg); }

.cb-page img {
  display: block;
  width: 100%;
  height: 100%;
  /* 关键：tailwind 的 preflight 给 img 加了 max-width:100%，
     移动端拆半页要靠 width:200% 把跨页放大后再横向裁切，
     不显式放开 max-width 会被压回 100%，右半页就会整屏空白 */
  max-width: none;
  object-fit: contain;
  background: #fff;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
}

/* 翻转时的阴影扫过 */
.cb-page::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity .33s ease;
  background: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .12) 34%, rgba(0, 0, 0, 0) 62%);
}
.cb-page.cb-flip-out::after,
.cb-page.cb-flip-in::after,
.cb-page.is-turning::after { opacity: 1; }

/* 遮罩层：右键/长按落在这一层，避免直接命中图片 */
.cb-shield {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  touch-action: pan-y pinch-zoom;
}
.cb-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #94a3b8;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: opacity .16s ease;
}
.cb-loading.is-off { opacity: 0; pointer-events: none; }

/* ---------- 桌面点击翻页的左右箭头提示 ---------- */
.cb-side {
  position: absolute;
  top: 50%;
  z-index: 6;
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(9, 18, 30, .55);
  color: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
  opacity: 0;
  transform: translateY(-50%) scale(.9);
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
}
.cb-side svg { width: 18px; height: 18px; }
.cb-side-l { left: 10px; }
.cb-side-r { right: 10px; }

/* 只在真正的鼠标设备上启用「点左半/右半翻页」的提示与手型光标；
   触摸设备走滑动翻页，不需要这些。 */
@media (hover: hover) and (pointer: fine) {
  .cb-side { display: flex; }
  .cb-side.is-on { opacity: 1; transform: translateY(-50%) scale(1); }
  .cb-viewport:not(.is-zoomed) { cursor: pointer; }
}

/* ---------- 底部工具条 ---------- */
.cb-bar {
  flex: 0 0 auto;
  height: var(--cb-bar-h);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-top: 1px solid rgba(255, 255, 255, .09);
  background: rgba(7, 12, 20, .9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.cb-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .075);
  color: #fff;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, opacity .16s ease;
}
.cb-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .17); border-color: rgba(255, 255, 255, .26); }
.cb-btn:active:not(:disabled) { transform: scale(.95); }
.cb-btn:disabled { opacity: .28; cursor: not-allowed; }
.cb-btn svg { width: 19px; height: 19px; }

.cb-pager {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: #9fb2c9;
  font-variant-numeric: tabular-nums;
}
.cb-pager input {
  width: 44px;
  height: 34px;
  text-align: center;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .07);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
}
.cb-pager input::-webkit-outer-spin-button,
.cb-pager input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cb-pager input:focus { border-color: #8fd8ea; }

.cb-spacer { flex: 1 1 auto; }

.cb-zoomval {
  flex: 0 0 auto;
  min-width: 46px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #9fb2c9;
  font-variant-numeric: tabular-nums;
}

/* 进度条 */
.cb-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, #4ea8d8, #8fd8ea);
  transition: width .3s ease;
  pointer-events: none;
  z-index: 5;
}

@media (max-width: 767px) {
  /* 工具条从 5 个按钮加到 7 个（缩略图 / 全屏），
     38px 会顶到 390px 溢出，实测收到 36px 后总宽约 372px 有富余 */
  .cb-bar { padding: 0 8px; gap: 5px; }
  .cb-btn { width: 36px; height: 36px; border-radius: 10px; }
  .cb-btn svg { width: 17px; height: 17px; }
  .cb-zoomval { display: none; }
  .cb-pager input { width: 34px; height: 31px; }
  .cb-pager-range { display: none; }
}

/* 缩放比例角标：手机端工具条放不下百分比，改为浮在右上角；放大时才出现，点击回 100% */
.cb-zoom-badge {
  position: absolute;
  /* 62px：躲开顶部信息条（桌面 58px / 手机 48px）里的 “Get the PDF” 按钮 */
  top: 62px;
  right: 10px;
  z-index: 6;
  display: none;
  align-items: center;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(7, 12, 20, .74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #dfeaf6;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.cb-zoom-badge.is-on { display: inline-flex; }
.cb-zoom-badge:hover { background: rgba(7, 12, 20, .92); }

/* 无图册时的空态 */
.cb-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 24px;
  text-align: center;
}
/* ============================================================
   书脊中缝 + 纸张内缘
   只在「跨页整体显示」时出现（桌面）；手机端每屏只有半张 A4，
   加中缝会变成纸张中间凭空多一道阴影，所以靠 .is-split 关掉。
   ============================================================ */
.cb-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 54px;
  margin-left: -27px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s ease;
  background: linear-gradient(to right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, .05) 30%,
    rgba(0, 0, 0, .12) 46%,
    rgba(0, 0, 0, .16) 49.5%,
    rgba(0, 0, 0, .16) 50.5%,
    rgba(0, 0, 0, .12) 54%,
    rgba(0, 0, 0, .05) 70%,
    rgba(0, 0, 0, 0) 100%);
}
.cb-spine::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -.5px;
  background: rgba(0, 0, 0, .15);
}
/* 用「肯定类」is-book 而不是 :not(.is-split)：
   图册数据加载完才知道是不是跨页，若默认就显示，
   手机冷启动会先亮出中缝再淡出（实测约 0.2s 闪烁）。
   封面 / 封底单独一屏时另一侧是空的，中缝没有意义，用 is-lone 关掉。 */
.cb-book.is-book .cb-spine { opacity: 1; }
.cb-book.is-book.is-lone .cb-spine { opacity: 0; }

/* 纸张左右内缘压暗：否则跨页看起来像两张网图硬拼在一起 */
.cb-page::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s ease;
  background: linear-gradient(to right,
    rgba(0, 0, 0, .12) 0%,
    rgba(0, 0, 0, 0) 3.2%,
    rgba(0, 0, 0, 0) 96.8%,
    rgba(0, 0, 0, .12) 100%);
}
.cb-book.is-flat .cb-page::before { opacity: 1; }

/* ============================================================
   缩略图导航（右侧抽屉 / 手机全宽）
   ============================================================ */
.cb-scrim {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: none;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: rgba(4, 8, 14, .5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.cb-thumbs {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  width: 322px;
  max-width: 86vw;
  display: flex;
  flex-direction: column;
  background: rgba(9, 15, 24, .975);
  border-left: 1px solid rgba(255, 255, 255, .1);
  transform: translateX(102%);
  transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
.cb-reader.is-thumbs .cb-scrim { display: block; }
.cb-reader.is-thumbs .cb-thumbs { transform: translateX(0); }

.cb-thumbs-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #9fb2c9;
}
.cb-thumbs-x {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #dbe7f4;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.cb-thumbs-x:hover { background: rgba(255, 255, 255, .16); }

/* 用 flex wrap 而不是 grid：grid 的行高按项目的内容贡献算，
   而缩略图内容全是绝对定位，行会被算成 ~33px，卡片互相重叠。 */
.cb-thumbs-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
.cb-thumbs-grid::-webkit-scrollbar { width: 8px; }
.cb-thumbs-grid::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 8px; }

/* 高度由按钮自身的 aspect-ratio 决定（JS 里按图册比例写入），
   不能靠子元素撑高：<button> 在 grid 里不会跟着子盒长高，
   实测子盒 94px 而按钮只有 41.6px，图被裁成横条。
   align-self:start 是必须的，否则 grid 的 stretch 会覆盖宽高比。 */
.cb-thumb {
  position: relative;
  display: block;
  /* 一行两张，gap 10px：2w + 10 = 100% */
  flex: 0 0 auto;
  /* 封面 / 封底缩略图是半页（更窄更高），必须 top 对齐，
     否则同一行里的跨页缩略图会被拉高，宽高比就失真了 */
  align-self: flex-start;
  width: calc(50% - 5px);
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  line-height: 0;
  transition: border-color .15s ease, transform .15s ease;
}
.cb-thumb:hover { transform: translateY(-1px); }
.cb-thumb.is-cur { border-color: #8fd8ea; box-shadow: 0 0 0 2px rgba(143, 216, 234, .28); }
.cb-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  /* 同 .cb-page img：preflight 的 max-width:100% 会把半页缩略图的
     width:200% 夹回 100%，右半页就取不出来了 */
  max-width: none;
}
/* 手机端缩略图是半页：同一张跨页图放大 200% 后裁出对应那一半。
   200% 宽 + 100% 高正好等于半页的原始比例，不会拉伸。 */
.cb-thumb.is-half img { width: 200%; }
.cb-thumb.is-half.is-r img { left: -100%; }
.cb-thumb span {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(7, 12, 20, .74);
  color: #eaf2fb;
  font-size: 10px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 767px) {
  .cb-thumbs { width: 100%; max-width: none; border-left: 0; }
  .cb-thumbs-grid { gap: 8px; padding: 10px; }
  /* 一行三张，gap 8px：3w + 16 = 100% */
  .cb-thumb { width: calc(33.3333% - 5.3334px); }
}

/* 360px 这类窄屏：工具条 7 个 36px 按钮会溢出约 12px，再收一档 */
@media (max-width: 380px) {
  .cb-btn { width: 32px; height: 32px; border-radius: 9px; }
  .cb-btn svg { width: 16px; height: 16px; }
  .cb-bar { padding: 0 6px; gap: 4px; }
  .cb-pager { font-size: 11.5px; gap: 4px; }
  .cb-pager input { width: 31px; height: 29px; font-size: 12px; }
}

/* ============================================================
   全屏
   阅读器高度本来是 calc(100dvh - 顶部导航高)，全屏后没有站点导航，
   必须直接占满，否则底部会留一条 --cbtop 高的空隙。
   ============================================================ */
.cb-reader:fullscreen,
.cb-reader:-webkit-full-screen {
  height: 100dvh;
  width: 100vw;
  background: #070c14;
}
/* 全屏没有顶部信息条遮挡，缩放角标回到顶部 */
.cb-reader:fullscreen .cb-zoom-badge,
.cb-reader:-webkit-full-screen .cb-zoom-badge { top: 10px; }

/* 跨页物理页码（例：3–4 / 60）。手机端每屏就是一页，不需要 */
.cb-pager-range {
  margin-left: 5px;
  font-size: 11px;
  color: #6d829b;
  letter-spacing: .01em;
  white-space: nowrap;
}
.cb-pager-range:empty { display: none; }

.cb-empty h2 { font-size: 19px; font-weight: 700; color: #eaf2fb; }
.cb-empty p { font-size: 13.5px; line-height: 1.7; color: #7e93ad; max-width: 420px; }
.cb-empty a {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  background: #0a4d8c;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.cb-empty a:hover { background: #2f7bc2; }

/* ============================================================
   桌面书册：半页翻
   原来是「一屏 = 一整张跨页」，翻的时候整张图一起转，看着像换图。
   现在拆成三块：左静态页 + 右静态页 + 中间一张会翻的纸（正面/背面各一页），
   顺序是 封面单独一页 → 内页两页 → 封底单独一页，从右往左翻。
   只在 is-book 时启用；手机拆半页（is-split）和竖版单页仍走 .cb-page。
   ============================================================ */
.cb-face,
.cb-leaf,
.cb-book > .cb-spine { display: none; }

.cb-book.is-book .cb-face,
.cb-book.is-book .cb-leaf,
.cb-book.is-book > .cb-spine { display: block; }
.cb-book.is-book .cb-page { display: none; }

.cb-face {
  position: absolute;
  top: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.cb-face img {
  display: block;
  width: 100%;
  height: 100%;
  /* 同 .cb-page img：preflight 的 max-width:100% 会把半页的
     width:200% 夹回 100%，右半页就整块空白 */
  max-width: none;
  object-fit: contain;
  background: #fff;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
}

.cb-face-l {
  left: 0;
  width: 50%;
  border-radius: 4px 0 0 4px;
  box-shadow: -9px 12px 32px rgba(0, 0, 0, .5);
}
.cb-face-r {
  left: 50%;
  width: 50%;
  border-radius: 0 4px 4px 0;
  box-shadow: 9px 12px 32px rgba(0, 0, 0, .5);
}

/* 纸张内侧（贴书脊那一侧）压暗 */
.cb-face-l::before,
.cb-face-r::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s ease;
}
.cb-face-l::before { background: linear-gradient(to right, rgba(0, 0, 0, 0) 87%, rgba(0, 0, 0, .15) 100%); }
.cb-face-r::before { background: linear-gradient(to left, rgba(0, 0, 0, 0) 87%, rgba(0, 0, 0, .15) 100%); }
.cb-book.is-book:not(.is-lone) .cb-face-static::before { opacity: 1; }

/* 空着的那一面（封面单页时左边 / 封底单页时右边） */
.cb-face.is-empty { background: transparent; box-shadow: none; }
.cb-face.is-empty img,
.cb-face.is-empty .cb-shield,
.cb-face.is-empty .cb-loading { display: none; }

/* 会翻的那张纸：以左边缘（书脊）为轴，从右往左转 */
.cb-leaf {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  z-index: 4;
  transform-origin: 0% 50%;
  transform: rotateY(0deg);
  transform-style: preserve-3d;
  /* 用 visibility 而不是 opacity 隐藏：opacity < 1 会强制 preserve-3d 扁平化，
     翻到背面时背面那页就看不见了 */
  visibility: hidden;
  pointer-events: none;
  will-change: transform;
}
.cb-leaf.is-live { visibility: visible; }
.cb-leaf.is-turning { transition: transform .72s cubic-bezier(.42, .02, .26, 1); }

.cb-leaf-f,
.cb-leaf-b {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.cb-leaf-f {
  border-radius: 0 4px 4px 0;
  box-shadow: 8px 0 26px rgba(0, 0, 0, .28);
}
.cb-leaf-b {
  transform: rotateY(180deg);
  border-radius: 4px 0 0 4px;
}
