/**
 * 区域 7：工厂实力 品质溯源 (Factory Strength / Quality Traceability)
 * 纯正效果图对齐 - 顶部实景 Banner + 左侧浅灰/深青绿切换 List + 右侧内嵌 1:1 等高轮播
 */

.factory-section {
  position: relative;
  width: 100%;
  background-color: #ffffff;
  padding-bottom: 88px;
}

/* ==========================================================================
   1. 顶部 Header Banner (.factory-header)
   ========================================================================== */
.factory-header {
  position: relative;
  width: 100%;
  height: 360px;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #343536;
  background-image: url("../images/slices/区域7-工厂实力/region7-header-bg-clean.webp");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.factory-header__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.08) 100%);
}

.factory-header__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 60px 24px;
}

.factory-eyebrow {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #ffffff;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.factory-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ffffff;
  margin-bottom: 16px;
  text-shadow: none;
}

.factory-subtitle {
  font-size: 15px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 24px;
}

.factory-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.factory-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.5);
}

.factory-dots .dot.active {
  width: 24px;
  border-radius: 4px;
  background-color: #ffffff;
}

/* ==========================================================================
   2. 两栏主体 (左侧 List + 右侧 Stage 等高 1:1)
   ========================================================================== */
.factory-inner {
  max-width: var(--site-max-width);
  margin: 0 auto;
  padding: 0 40px;
}

/* 左栏留出适度下限，避免描述文字在窄屏折行过多导致 tab 过高；
   真正的重叠根因是竖直方向的 flex-shrink 压缩，已在 .factory-tab 修正。 */
.factory-layout {
  display: grid;
  grid-template-columns: minmax(440px, 44%) 1fr;
  gap: 28px;
  align-items: start;
  margin-top: 28px;
  position: relative;
  z-index: 3;
}

/* ---- 左侧选项卡列表 (.factory-list / .factory-tab) ---- */
.factory-list {
  display: flex;
  flex-direction: column;
  background-color: #F4F5F7;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* flex-shrink 必须为 0：.factory-list 原被 align-items:stretch 拉到与右侧图片
   等高，若允许收缩，图片变矮时五个 tab 会被压到 min-height 以下 —— 文字上下被裁、
   加号只剩半个圆弧、下一个 tab 的不透明底色盖住上一个（竖直方向重叠）。
   改为 1 0 auto：可增高填满，但绝不压缩，高度始终由内容与 min-height 兜底。 */
.factory-tab {
  position: relative;
  flex: 1 0 auto;
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background-color: #F4F5F7;
  background-image: none;
  border: none;
  border-bottom: 1px solid #E0E0E0;
  text-align: left;
  cursor: pointer;
  /* 交互反馈收到 0.12s：0.3s 的变色让高亮明显慢于鼠标 */
  transition: background-color 0.12s ease;
  box-sizing: border-box;
}

.factory-tab:last-child {
  border-bottom: none;
}

/* 悬停已直接驱动 .is-active，不再保留独立 :hover 底色，避免移出瞬间双高亮 */

.factory-tab__name {
  flex-shrink: 0;
  font-size: 23px;
  font-weight: 700;
  color: #1A1A1A;
  transition: color 0.12s ease;
}

.factory-tab__dash {
  flex-shrink: 0;
  width: 22px;
  height: 2px;
  background-color: #666666;
  transition: background-color 0.12s ease;
}

.factory-tab__desc {
  flex: 1 1 auto;
  font-size: 16px;
  line-height: 1.45;
  color: #555555;
  transition: color 0.12s ease;
}

.factory-tab__plus {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #888888;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: #1A1A1A;
  /* 只列举参与反馈的属性：原 all 会把 width/height/border-radius 一起带进过渡，
     响应式断点改尺寸时会额外播出一段无意义的动画 */
  transition: border-color 0.12s ease, color 0.12s ease;
}

/* 激活（选中）状态样式：品牌青绿背景 (#00705B)，内部全白 */
.factory-tab.is-active {
  background-color: #00705B !important;
  background-image: none !important;
}

.factory-tab.is-active .factory-tab__name,
.factory-tab.is-active .factory-tab__desc {
  color: #FFFFFF !important;
}

.factory-tab.is-active .factory-tab__dash {
  background-color: #FFFFFF !important;
}

.factory-tab.is-active .factory-tab__plus {
  border-color: #FFFFFF !important;
  color: #FFFFFF !important;
}

/* ==========================================================================
   3. 右侧大图展示区 (.factory-stage)
   ========================================================================== */
.factory-stage {
  position: relative;
  padding: 0;
  /* 中性灰占位：切换分类时 track 有一帧为空，纯白会刺眼地闪一下 */
  background-color: #E8EAED;
  border-radius: 12px;
  overflow: hidden;
  /* 父级改 align-items:start 后 height:100% 失去拉伸参照，
     改用等比 aspect-ratio 自适应：宽度由 1fr 决定，高度按比例随之缩放。 */
  aspect-ratio: 4 / 3;
  cursor: default;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.factory-stage__viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  position: relative;
}

/* 交互提示词一·8：案例图淡入淡出，非横向滑动；grid 叠放避免容器塌陷 */
.factory-stage__track {
  display: grid;
  width: 100%;
  height: 100%;
}

/* 切换分类时由 JS 临时挂上：把 transform 归零（上一组可能停在第 5 张）
   变成瞬时落位，否则这次归零会被当成滑动动画播出，新图横向扫过一遍。
   下一帧即由 JS 摘掉，用户操作的滑动动画不受影响。 */
.factory-stage__track.is-resetting {
  transition: none;
}

.factory-stage__slide {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
}

/* 用 !important 压过后置规则，确保激活项始终可见 */
.factory-stage__slide.is-active {
  opacity: 1 !important;
  visibility: visible !important;
}

.factory-stage__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

/* 箭头：竖直居中、半透明背景 */
.factory-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  border: none;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.factory-arrow:hover {
  background-color: rgba(0, 0, 0, 0.75);
}

.factory-arrow--prev {
  left: 20px;
}

.factory-arrow--next {
  right: 20px;
}

.factory-arrow[hidden] {
  display: none !important;
}

/* 圆点：贴底部居中 */
.factory-stage .factory-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.factory-stage .factory-dots[hidden] {
  display: none !important;
}

.factory-stage .factory-dots .carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.5);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.factory-stage .factory-dots .carousel-dot:hover {
  background-color: rgba(255, 255, 255, 0.8);
}

.factory-stage .factory-dots .carousel-dot.is-active {
  width: 24px;
  border-radius: 4px;
  background-color: #ffffff;
}

/* ==========================================================================
   4. 响应式 (Responsive Adaptation)
   ========================================================================== */
/* 与导航/团队/产品等区的 1200px 断点对齐，避免同一屏内各区切换不同步 */
@media (max-width: 1199px) {
  /* 此断点起字号回落，左栏下限同步收窄 */
  .factory-layout {
    grid-template-columns: minmax(380px, 48%) 1fr;
  }
  .factory-tab {
    padding: 13px 15px;
    gap: 9px;
  }
  .factory-tab__name {
    font-size: 20px;
  }
  .factory-tab__desc {
    font-size: 14px;
  }
  .factory-tab__plus {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }
}

@media (max-width: 1023px) {
  .factory-header {
    min-height: 340px;
  }
  .factory-title {
    font-size: 32px;
  }
  .factory-inner {
    padding: 0 24px;
  }
  .factory-layout {
    grid-template-columns: 1fr;
    margin-top: 20px;
    gap: 20px;
  }
  .factory-stage {
    /* 单列全宽下 4:3 会算出过高的高度，改回由 viewport 的 min-height 驱动 */
    aspect-ratio: auto;
  }
  .factory-stage__viewport,
  .factory-stage__slide img {
    min-height: 360px;
  }
}

@media (max-width: 768px) {
  .factory-section {
    padding-bottom: 56px;
  }
  .factory-title {
    font-size: 26px;
    letter-spacing: 2px;
  }
  .factory-subtitle {
    font-size: 14px;
  }
  .factory-tab {
    flex-wrap: wrap;
    min-height: 0;
    padding: 13px 14px;
  }
  /* 小屏回落字号，防止换行后行高堆叠过高 */
  .factory-tab__name {
    font-size: 18px;
  }
  .factory-tab__dash {
    display: none;
  }
  .factory-tab__desc {
    flex: 1 1 100%;
    order: 3;
    margin-top: 4px;
    font-size: 13px;
  }
  .factory-tab__plus {
    width: 28px;
    height: 28px;
    font-size: 16px;
    margin-left: auto;
  }
  .factory-stage__viewport,
  .factory-stage__slide img {
    min-height: 260px;
  }
}



/* ==========================================================================
   滚动入场动画（Scroll Reveal）

   与关于我们页各区域同一套观感（600ms / easeOutQuint / 32px 位移）。
   分两个独立观察单元：
     1. .factory-header  标题区 —— eyebrow → 主标题 → 副标题 → 圆点
     2. .factory-inner   内容区 —— 五个 Tab 依次错峰 + 右侧展示图

   刻意避开的元素（重要）：
   - .factory-stage__track：轮播轨道靠 JS 写 transform: translateX() 换页，
     will-change: transform 已在用。入场动画作用在外层 .factory-stage 上，
     绝不碰 track 与 slide。
   - .factory-stage .factory-dots / .factory-arrow：靠 transform 做居中定位
     （translateX(-50%) / translateY(-50%)），入场动画若覆盖会让它们错位。
     两者都在 .factory-stage 内部，随外层容器一起淡入，无需单独处理。
   - .factory-header__content .factory-dots：与轮播圆点同名类。这里必须
     从 .factory-header__content 往下选，不能写 .factory-reveal .factory-header
     ——.factory-header 自身就是挂 .factory-reveal 的元素，那样写要求它成为
     自己的后代，选择器永不匹配。作用域限定在 __content 内，同时也天然
     排除了 .factory-stage 里的轮播圆点。
   ========================================================================== */
.factory-reveal .factory-eyebrow,
.factory-reveal .factory-title,
.factory-reveal .factory-subtitle,
.factory-reveal .factory-header__content .factory-dots,
.factory-reveal .factory-tab,
.factory-reveal .factory-stage {
  opacity: 0;
  transform: translateY(32px);
  transition-property: opacity, transform;
  transition-duration: 600ms;
  /* easeOutQuint：末端缓慢"弹出"减速，无回弹过冲 */
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

/* ---- 标题区：四级错峰 ---- */
.factory-reveal .factory-eyebrow {
  transition-delay: 0ms;
}

.factory-reveal .factory-title {
  transition-delay: 100ms;
}

.factory-reveal .factory-subtitle {
  transition-delay: 180ms;
}

.factory-reveal .factory-header__content .factory-dots {
  transition-delay: 260ms;
}

/* ---- 内容区：五个 Tab 自上而下依次，展示图稍后跟上 ---- */
.factory-reveal .factory-tab:nth-child(1) { transition-delay: 0ms; }
.factory-reveal .factory-tab:nth-child(2) { transition-delay: 70ms; }
.factory-reveal .factory-tab:nth-child(3) { transition-delay: 140ms; }
.factory-reveal .factory-tab:nth-child(4) { transition-delay: 210ms; }
.factory-reveal .factory-tab:nth-child(5) { transition-delay: 280ms; }

.factory-reveal .factory-stage {
  transform: translateY(32px) scale(0.96);
  transition-delay: 160ms;
}

/* 小屏收敛动效：大位移在窄视口显得笨重 */
@media (max-width: 768px) {
  .factory-reveal .factory-eyebrow,
  .factory-reveal .factory-title,
  .factory-reveal .factory-subtitle,
  .factory-reveal .factory-header__content .factory-dots,
  .factory-reveal .factory-tab,
  .factory-reveal .factory-stage {
    transform: translateY(20px);
    transition-duration: 480ms;
  }

  .factory-reveal .factory-stage {
    transform: translateY(20px) scale(0.97);
  }

  /* 单列堆叠后 Tab 与展示图纵向排开，间隔收紧 */
  .factory-reveal .factory-tab:nth-child(2) { transition-delay: 50ms; }
  .factory-reveal .factory-tab:nth-child(3) { transition-delay: 100ms; }
  .factory-reveal .factory-tab:nth-child(4) { transition-delay: 150ms; }
  .factory-reveal .factory-tab:nth-child(5) { transition-delay: 200ms; }
}

/* 无障碍降级：尊重系统"减少动态效果"偏好，直接呈现最终态 */
@media (prefers-reduced-motion: reduce) {
  .factory-reveal .factory-eyebrow,
  .factory-reveal .factory-title,
  .factory-reveal .factory-subtitle,
  .factory-reveal .factory-header__content .factory-dots,
  .factory-reveal .factory-tab,
  .factory-reveal .factory-stage {
    opacity: 1;
    transform: none;
    transition: none;
    will-change: auto;
  }
}

/* --------------------------------------------------------------------------
   激活态：必须置于全部初始态与响应式覆盖之后。与初始态特异性相同，
   靠后者胜出；若写在 @media 之前，768px 断点内的 translateY(20px) 会
   压掉 transform: none，小屏元素将淡入后停在偏移位置、永不归位。
   -------------------------------------------------------------------------- */
.factory-reveal--in .factory-eyebrow,
.factory-reveal--in .factory-title,
.factory-reveal--in .factory-subtitle,
.factory-reveal--in .factory-header__content .factory-dots,
.factory-reveal--in .factory-tab,
.factory-reveal--in .factory-stage {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   瞬时归位：完全滚出视口后，JS 借这个类临时关掉过渡再抹去激活态，
   让元素立刻回到初始偏移，而不是在视口外反向播放。
   -------------------------------------------------------------------------- */
.factory-reveal--noanim .factory-eyebrow,
.factory-reveal--noanim .factory-title,
.factory-reveal--noanim .factory-subtitle,
.factory-reveal--noanim .factory-header__content .factory-dots,
.factory-reveal--noanim .factory-tab,
.factory-reveal--noanim .factory-stage {
  transition: none;
}
