/* ===== SOLWE Charging Accessories Product Gallery v1.1 ===== */
/* 命名空间：.ca-gallery / body.ca-detail —— 仅作用于 CA 分类详情页，不依赖也不修改公共 product-gallery.css */
/* 布局：左侧约45% = 上方大主图 + 下方横向排列「最多3张」统一尺寸/间距/比例的缩略图；右侧约55% 产品信息 */
/* v1.1 变更：缩略图上限 2 → 3；缩略图尺寸/间距/比例统一；修复移动端主图被 width:100% 拉伸变形 */

/* --- 页面级防横向溢出（仅本命名空间生效） --- */
body.ca-detail { overflow-x: hidden; }

/* --- Hero 两栏比例：45 / 55（覆盖页面内联的 1fr 1fr） --- */
body.ca-detail .hero .container {
  display: grid;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  gap: 48px;
  align-items: center;
  text-align: left;
}
body.ca-detail .hero .container.is-single { grid-template-columns: minmax(0, 1fr); }
body.ca-detail .hero-content { max-width: none; margin: 0; text-align: left; }
body.ca-detail .hero-image { min-width: 0; }

/* --- 图区容器 --- */
.ca-gallery { display: block; min-width: 0; }
.ca-gallery.is-empty { display: none; }

/* --- 主图（保持原始宽高比，不拉伸） --- */
.ca-gallery__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  min-width: 0;
}
.ca-gallery .ca-gallery__main {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 460px;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.18s ease;
}
.ca-gallery__main.is-fading { opacity: 0.35; }

/* --- 缩略图行：主图下方横排，统一间距 --- */
.ca-gallery__thumbs {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 18px;
  padding: 0;
  min-width: 0;
}
.ca-gallery__thumbs[hidden] { display: none; }

/* 统一尺寸、统一比例（1:1 正方形卡片），三张与两张、一张完全同一规格 */
.ca-gallery__thumb {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 86px;
  height: 86px;
  aspect-ratio: 1 / 1;
  padding: 4px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
/* 缩略图内部图片：等比缩放、不拉伸变形、不裁切产品主体 */
.ca-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.ca-gallery__thumb:hover {
  border-color: rgba(255, 255, 255, 0.55);
  transform: translateY(-2px);
}
/* 选中态：简洁明显边框（border 宽度恒定 2px，仅换色 + 外发光，不产生位移跳动） */
.ca-gallery__thumb.is-active {
  border-color: var(--accent, #e94560);
  background: rgba(233, 69, 96, 0.16);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.45);
}
.ca-gallery__thumb:focus-visible {
  outline: 2px solid var(--accent, #e94560);
  outline-offset: 2px;
}
/* 图片加载失败：整张隐藏，不占位、不留空白 */
.ca-gallery__thumb.is-failed { display: none; }

/* --- 平板/手机：单列，无横向溢出 --- */
@media (max-width: 900px) {
  body.ca-detail .hero .container {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 0 16px;
  }
  .ca-gallery__stage { min-height: 0; }
  /* 关键修复：不用 width:100%，改为等比自适应，避免主图被压扁 / 拉长 */
  .ca-gallery .ca-gallery__main {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 330px;
  }
  .ca-gallery__thumbs { margin-top: 14px; gap: 10px; }
  .ca-gallery__thumb { width: 74px; height: 74px; }
}

@media (max-width: 480px) {
  body.ca-detail .hero .container { padding: 0 14px; }
  .ca-gallery .ca-gallery__main {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 320px;
  }
  .ca-gallery__thumbs { gap: 10px; margin-top: 12px; }
  .ca-gallery__thumb { width: 68px; height: 68px; padding: 3px; }
}
