/* ============================================================
   商品详情页 · 图片轮播（与「发布商品」最多 6 张图对应）
   独立样式文件，无需重新打包前端；配合 index-gallery-v1.js 使用
   ============================================================ */

/* 主图容器需要相对定位，箭头 / 计数徽标才能贴边悬浮 */
.product-gallery-main {
  position: relative;
}

.product-gallery-main img {
  -webkit-user-drag: none;
  user-select: none;
}

/* 左右切换箭头 */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(38, 33, 29, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--c-ink-soft);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 2px 10px rgba(38, 33, 29, 0.16);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.gallery-nav:hover {
  background: var(--c-primary);
  color: #fff;
}

.gallery-nav:active {
  transform: translateY(-50%) scale(0.94);
}

.gallery-nav-prev {
  left: 12px;
}

.gallery-nav-next {
  right: 12px;
}

/* 右下角 "2 / 6" 计数徽标 */
.gallery-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(38, 33, 29, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* 缩略图条：横向滚动更顺手 */
.product-gallery-thumbs {
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.product-gallery-thumbs::-webkit-scrollbar {
  height: 6px;
}

.product-gallery-thumbs::-webkit-scrollbar-thumb {
  background: var(--c-line-2);
  border-radius: 999px;
}

.product-gallery-thumbs button {
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.product-gallery-thumbs button:hover {
  border-color: var(--c-line-2);
}

.product-gallery-thumbs button.active {
  border-color: var(--c-primary);
}

@media (max-width: 640px) {
  .gallery-nav {
    width: 34px;
    height: 34px;
    font-size: 19px;
  }

  .gallery-nav-prev {
    left: 8px;
  }

  .gallery-nav-next {
    right: 8px;
  }

  .gallery-counter {
    right: 8px;
    bottom: 8px;
    font-size: 11px;
  }
}

/* ============================================================
   v2 · 主图改「正方形 + 完整展示」
   ------------------------------------------------------------
   旧样式（打包产物 .product-gallery-main{height:420px}）把主图做成
   857×420 的横向长条，而 <img> 元素实际被撑到 857×590，
   被容器的 overflow:hidden 从上下各裁掉 85px —— 图片显示不完整。
   现在改为 aspect-ratio:1/1 的正方形，img 用 absolute inset:0 填满，
   object-fit:contain 保证任意长宽比的图都能完整看到（空余处留底色）。
   ============================================================ */
.product-gallery-card {
  --gal-max: 560px;
}

.product-gallery-main {
  position: relative;
  display: block !important;
  height: auto !important;
  width: 100%;
  max-width: min(100%, var(--gal-max));
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  border-radius: 11px;
  overflow: hidden;
  background: #f4f0eb;
}

.product-gallery-main img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
}

/* 无图占位（📦）居中，不要贴左上角 */
.product-gallery-main > .product-gallery-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  line-height: 1;
}

/* 缩略图条 / 说明文字与主图同宽、同轴对齐 */
.product-gallery-card > .product-gallery-thumbs,
.product-gallery-card > .gallery-note {
  max-width: min(100%, var(--gal-max));
  margin-inline: auto;
}

/* 桌面端正方形高度较大时，缩略图条允许换行滚动 */
.product-gallery-thumbs {
  scrollbar-width: thin;
}

