/* ============================================================
   实拍画廊 —— 横向滑动 + 点开放大
   三页共用。取代原来那排固定的三张图。

   为什么默认不自动轮播:B2B 买家是在「查证」不是在「欣赏」,
   图自己动会把他正在看的那张推走。改成手动为主 —— 拖、滑、
   箭头、键盘都能走,想要自动播把 gallery.js 里的 AUTO 改成毫秒数即可。
   ============================================================ */

.gal { position: relative; }

.gal-track {
  /* 必须用 flex + flex:0 0。grid 的 minmax(0, X) 允许轨道收缩,
     6 列会被压进可视宽度里 —— 结果 scrollWidth == clientWidth,压根滑不动。
     (实测单图被压到 165px,应为 345px。) */
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 4px;
  /* 滚动条藏起来,靠箭头和拖拽走 —— 但键盘和触控板照常可用 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.gal-track::-webkit-scrollbar { display: none; }
.gal-track.dragging { scroll-behavior: auto; cursor: grabbing; }
.gal-track.dragging .gal-item { pointer-events: none; }

.gal-item {
  flex: 0 0 calc((100% - 32px) / 3);
  scroll-snap-align: start;
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  background: var(--card, #fff);
  border: 1px solid var(--line, rgba(19,35,59,.1));
  cursor: zoom-in;
  display: flex;
  flex-direction: column;
}
.gal-item img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  background: #efeae1;
  transition: transform .5s var(--ease-apple, ease);
}
.gal-item:hover img { transform: scale(1.03); }
.gal-item figcaption {
  padding: 12px 16px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft, #5c6b80);
  line-height: 1.4;
}
/* 断点必须写在 .gal-item 的 flex 简写之后 —— 简写会重置 flex-basis,
   放前面等于断点失效(层叠里同优先级后者胜)。 */
@media (max-width: 940px) { .gal-item { flex-basis: calc((100% - 16px) / 2); } }
@media (max-width: 620px) { .gal-item { flex-basis: 86%; } }
@media (max-width: 620px) { .gal-item img { height: 210px; } }

/* ---------- 箭头 ---------- */
.gal-nav {
  position: absolute; top: 100px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line, rgba(19,35,59,.1));
  background: rgba(255,255,255,.94); color: var(--ink, #13233b);
  font-size: 17px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(19,35,59,.14);
  transition: opacity .3s ease, transform .2s var(--ease-apple, ease);
}
.gal-nav:hover { transform: scale(1.06); }
.gal-prev { left: -14px; }
.gal-next { right: -14px; }
.gal-nav[disabled] { opacity: 0; pointer-events: none; }
@media (max-width: 620px) { .gal-nav { display: none; } }  /* 手机上直接滑,不占地方 */

/* ---------- 进度点 ---------- */
.gal-dots { display: flex; justify-content: center; gap: 7px; margin-top: 16px; }
.gal-dot {
  width: 7px; height: 7px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  background: var(--line, rgba(19,35,59,.18));
  transition: background .3s ease, width .3s var(--ease-apple, ease);
}
.gal-dot.on { background: var(--accent-fn, #b85a1c); width: 20px; border-radius: 4px; }

.gal-hint { margin: 14px 0 0; text-align: center; font-size: .82rem; color: var(--ink-soft, #5c6b80); }

/* ---------- 放大灯箱 ---------- */
.lb {
  position: fixed; inset: 0; z-index: 130; background: rgba(10,18,30,.9);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-apple, ease);
  display: grid; place-items: center; padding: 32px;
}
.lb.on { opacity: 1; pointer-events: auto; }
.lb-img {
  max-width: min(1100px, 92vw); max-height: 82vh; object-fit: contain;
  border-radius: 14px; transform: scale(.97);
  transition: transform .35s var(--ease-apple, cubic-bezier(.28,.11,.32,1));
}
.lb.on .lb-img { transform: scale(1); }
.lb-cap {
  position: absolute; left: 0; right: 0; bottom: 26px; text-align: center;
  color: rgba(255,255,255,.86); font-size: .88rem; padding: 0 32px;
}
.lb-close, .lb-arrow {
  position: absolute; background: rgba(255,255,255,.12); border: none; color: #fff;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 20px;
  display: grid; place-items: center; transition: background .2s ease;
}
.lb-close:hover, .lb-arrow:hover { background: rgba(255,255,255,.24); }
.lb-close { top: 22px; right: 24px; }
.lb-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 24px; top: 50%; transform: translateY(-50%); }
@media (max-width: 620px) { .lb-prev, .lb-next { display: none; } .lb { padding: 16px; } }

@media (prefers-reduced-motion: reduce) {
  .gal-track { scroll-behavior: auto; }
  .gal-item img, .gal-nav, .gal-dot, .lb, .lb-img { transition: none !important; }
  .gal-item:hover img { transform: none; }
}

/* ---------- 分类页签 ---------- */
.gal-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.gal-tab {
  border: 1.5px solid var(--line, rgba(19,35,59,.1)); background: transparent;
  color: var(--ink-soft, #5c6b80); font-family: inherit; font-weight: 600; font-size: .88rem;
  padding: 9px 18px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all .25s var(--ease-apple, ease);
}
.gal-tab:hover { border-color: var(--ink, #13233b); color: var(--ink, #13233b); }
.gal-tab.on { background: var(--ink, #13233b); color: #fff; border-color: var(--ink, #13233b); }
.gal-tab .n {
  font-size: .78rem; font-weight: 700; opacity: .6;
  font-family: ui-monospace, Menlo, monospace;
}

/* 每一类是一个 pane,只显示当前那一个 */
.gal-pane { position: relative; display: none; }
.gal-pane.on { display: block; }

/* 自动轮播时的细进度条 —— 让用户知道它会自己走,不是卡住了 */
.gal-bar { height: 2px; background: var(--line, rgba(19,35,59,.14)); border-radius: 2px; margin-top: 18px; overflow: hidden; }
.gal-bar i { display: block; height: 100%; width: 0; background: var(--accent-fn, #b85a1c); transition: width .25s linear; }
.gal.paused .gal-bar { opacity: .35; }
@media (prefers-reduced-motion: reduce) { .gal-bar { display: none; } }
