/* =============================================================================
   商品详情独立页（骨架层）· product-detail.css
   -----------------------------------------------------------------------------
   参考基准：IE起玩电竞 H5 商品详情（390×844@2x 实拍 + computedStyle）
   本文件负责：路由页壳/导航/主图/内容滚动区/商品主卡/footer/图片预览/桌面居中
   数值来源：_qa/verify-1027/ref-h5/notes.md §2.2、§3.3；_qa/pd2/spec.md §2
   加载顺序：必须在 mobile-fix.css 之后（index.html）
   ========================================================================== */

/* ---------- 路由页壳 ---------- */
.pd-page.pd-route {
  position: fixed;
  inset: 0;
  z-index: 1500; /* 高于 #tabbar(900)、客服浮窗(890)，低于 #modalRoot 弹层(见 source 层 5000) */
  display: flex;
  justify-content: center;
  background: #f5f5f5;
  color: rgba(0, 0, 0, .9);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
body.pd-open { overflow: hidden; }
body.pd-open #view { overflow: hidden !important; }

.pd-shell {
  position: relative;
  width: 100%;
  max-width: 430px; /* 桌面端 ≤430 居中卡片 */
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
  overflow: hidden;
}

/* ---------- 导航（44 高 / #f5f5f5 / 标题 18px 400 居中） ---------- */
.pd-nav {
  position: relative;
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  z-index: 2;
}
.pd-nav-title {
  font-size: 18px;
  font-weight: 400;
  line-height: 44px;
  color: rgba(0, 0, 0, .9);
  text-align: center;
}
.pd-back {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, .85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
}

/* ---------- 内容滚动区（底部预留 78px 给 footer） ---------- */
.pd-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: 78px;
  scrollbar-width: none;
}
.pd-scroll::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- 主图（初始 0.8×内容宽=312 兜底，onload 后按图片比例） ---------- */
.pd-gallery {
  position: relative;
  width: 100%;
  height: 312px;
  background: #e9e9e9;
  overflow: hidden;
}
.pd-main-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.pd-gallery-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c0c4cc;
}

/* ---------- 通用卡片（x15 w360 / #fff / r10 / margin-top10） ---------- */
.pd-body { padding: 0 0 1px; }
.pd-page .module-box,
.pd-page .pd-card {
  background: #fff;
  border-radius: 10px;
  margin: 10px 15px 0;
}
.pd-page .pd-card-title {
  padding: 15px 15px 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  color: rgba(0, 0, 0, .9);
}

/* ---------- 商品主卡（130 高：标题 51 + 副标题 20 + 价格行 59） ---------- */
.pd-main-card { overflow: hidden; }
.pd-title {
  padding: 15px;
  font-size: 15px;
  font-weight: 400;
  line-height: 21px;
  color: rgba(0, 0, 0, .9);
  word-break: break-all;
}
.pd-sub {
  padding: 0 15px;
  font-size: 14px;
  line-height: 20px;
  color: #7f7f7f;
  word-break: break-all;
}
.pd-price-row {
  height: 59px;
  box-sizing: border-box;
  padding: 15px;
  display: flex;
  align-items: center;
}
.pd-price-left { display: flex; align-items: baseline; min-width: 0; }
.pd-price {
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  color: #E84359;
}
.pd-market {
  margin-left: 7px;
  font-size: 14px;
  line-height: 20px;
  color: #7f7f7f;
  text-decoration: line-through;
}
.pd-fav {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 18px;
  color: #7f7f7f;
  cursor: pointer;
  user-select: none;
}
.pd-fav svg { display: block; }
.pd-fav.is-on { color: #E84359; }
.pd-fav.is-on svg { fill: #E84359; stroke: #E84359; }

/* ---------- 底部栏（390×62 / #f5f5f5 / pad 0 15 / 三块） ---------- */
.pd-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62px;
  box-sizing: border-box;
  padding: 0 15px;
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-top: 1px solid rgba(0, 0, 0, .08);
  z-index: 3;
}
.pd-fact {
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  color: #333;
}
.pd-fact-ico { display: flex; align-items: center; justify-content: center; height: 18px; }
.pd-fact-txt { font-size: 12px; line-height: 14px; }
.pd-fbuy-wrap { flex: none; margin-left: 10px; display: flex; align-items: center; }
.pd-buy {
  width: 195px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 52px;
  background: #E84359;
  color: #fff;
  font-size: 13px;
  line-height: 36px;
  text-align: center;
  font-family: inherit;
  cursor: pointer;
}
.pd-buy:active { filter: brightness(.96); }

/* ---------- 图片全屏预览 ---------- */
#modalRoot .overlay.pd-preview-overlay {
  z-index: 5000 !important;
  background: rgba(0, 0, 0, .92) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}
#modalRoot .overlay.pd-preview-overlay .modal {
  width: 100%;
  max-width: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.pd-preview {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pd-preview-img {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  cursor: zoom-out;
}
.pd-preview-idx {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  opacity: .85;
}

/* ---------- 桌面端：卡片居中（≤430） ---------- */
@media (min-width: 768px) {
  .pd-page.pd-route { background: #ececec; }
  .pd-shell {
    box-shadow: 0 0 28px rgba(0, 0, 0, .12);
    border-left: 1px solid rgba(0, 0, 0, .06);
    border-right: 1px solid rgba(0, 0, 0, .06);
  }
  .pd-fact:hover, .pd-buy:hover { filter: brightness(1.03); }
}
