/* ==========================================================================
   M31 · 首页 Hero 收口修复（移动 390 / 平板 768–1023；桌面 >=1024 零改动）
   --------------------------------------------------------------------------
   解决的问题：
   ① 第 2 屏「RAW MOULD & DIELINE」对比图在 <=767 塌成 0 高 → 看起来像裂图。
      根因：M28 锁高规则把 .fy3-hero__media 强制 height:100%（在内容盒里解析为 0），
      而 .fy3-compare 的两个 plate 都是 position:absolute（无 in-flow 内容），
      height:auto 也解析为 0 → 整个对比块不可见。这里用 aspect-ratio 给回高度。
   ② 手机端 Hero 被长文案语种（fr/it/de）顶到 890+，01/02/03 页签掉到首屏外，
      用户看不到也点不到 → 表现为「首帧 Tab 点击没反应」。这里收敛高度 + 页签坞 sticky。
   ③ 768–1023 平板断点缺少过渡排版（原本直接套移动单列/桌面绝对定位），补一档。
   ④ 第 3 屏手机端机位胶囊：触控高度、选中态反馈、右缘渐隐提示。
   ========================================================================== */

/* ---- ① 第 2 屏对比块：恢复高度（<=767） ---------------------------------- */
@media (max-width: 767px) {
  html body .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__media {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    position: relative !important;
    overflow: hidden !important;
  }

  /* G-M30-18（heroSpread<=2）：三屏 hero 高度必须严格一致。
     旧写法 min/max-height + aspect-ratio 让第 2 屏比第 1/3 屏矮 25px。
     现改为「轨道等分」：hero 固定 100svh → stage 占满 → 每屏 flex:1 等高 →
     媒体盒 flex:1 吸收剩余，对比块 height:100% 吃满同一轨道（内容不同也等高）。 */
  html body .fy3-hero__slide .fy3-hero__media .fy3-compare {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
    background: #FAF8F5 !important;
  }

  html body .fy3-hero__slide .fy3-hero__media .fy3-compare > .fy3-compare__plate {
    position: absolute !important;
    inset: 0 !important;
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  html body .fy3-hero__slide .fy3-hero__media .fy3-compare .fy3-compare__img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    padding: 5% !important;
  }

  html body .fy3-hero__slide .fy3-hero__media .fy3-compare .fy3-compare__range,
  html body .fy3-hero__slide .fy3-hero__media .fy3-compare .fy3-compare__handle,
  html body .fy3-hero__slide .fy3-hero__media .fy3-compare .fy3-compare__tag {
    position: absolute !important;
  }
}

/* ---- ② 手机端 Hero 高度收敛 + 页签坞 sticky（<=767） ---------------------- */
@media (max-width: 767px) {
  html body .fy3-hero {
    padding-block: 84px 8px !important;
    min-height: 0 !important;
  }
  html body .fy3-hero__slide.is-active .fy3-hero__copy { padding-block: 0 !important; }

  /* 文案与媒体之间原本被弹性行距撑出 ~170px 空隙 → 改成紧贴的纵向流（仅非 bleed 屏） */
  html body .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 18px !important;
    align-items: stretch !important;
  }
  html body .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__media {
    margin-top: 0 !important;
    order: 2 !important;
  }
  html body .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__copy {
    order: 1 !important;
  }

  /* 长文案语种第 2 屏的三列参数在 390 会换行到 490px 高，压缩次级字号与行距 */
  html body .fy3-hero__slide .fy3-hero__line {
    font-size: 13px !important;
    line-height: 1.45 !important;
  }
  html body .fy3-hero__slide .fy3-hero__stages {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-top: 14px !important;
  }
  html body .fy3-hero__slide .fy3-hero__stage-item,
  html body .fy3-hero__slide .fy3-hero__stages > * {
    font-size: 11px !important;
    line-height: 1.35 !important;
    min-width: 0 !important;
    overflow-wrap: break-word !important;
  }
  html body .fy3-hero__slide .fy3-hero__stages .fy3-mono,
  html body .fy3-hero__slide .fy3-hero__stages b,
  html body .fy3-hero__slide .fy3-hero__stages strong {
    font-size: 11px !important;
  }

  /* 页签坞钉在视口底部：任何语种都在首屏可点 */
  html body .fy3-hero .fy3-hero__bar {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 6 !important;
    background: linear-gradient(180deg, rgba(247, 245, 240, 0) 0%, #F7F5F0 38%, #F7F5F0 100%) !important;
    padding-top: 10px !important;
    padding-bottom: 4px !important;
  }

  /* 第 3 屏视频：固定 16/10 可视高度，避免自然高度把 hero 顶高 */
  html body .fy3-hero__slide > .fy3-hero__media--bleed .fy3-hero__video {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 10 !important;
    max-height: 240px !important;
    object-fit: cover !important;
  }
}

/* ---- ②c G-M30-18：三屏 hero 严格等高（轨道等分，<=767） ------------------- */
/* 判据：390 下每屏 hero 高度差 <= 2px。
   做法：hero 固定为 100svh，stage 吃满剩余高度，三个 slide 各自 flex:1 铺满同一轨道；
   slide 内部 copy 固定、media flex:1 吸收剩余高度 → 内容多寡不影响总高。 */
@media (max-width: 767px) {
  /* 注意：M29M 在 01-mobile-master-overhaul.css 里用 `html body .fy3-hero`（同为 !important）
     且该文件在本文件之后加载 —— 同特异性时后加载者胜。这里提高特异性（.fy3-section）确保生效。 */
  html body .fy3-hero.fy3-section {
    height: 100svh !important;
    max-height: 100svh !important;
    min-height: 0 !important;
    padding: 76px 0 6px !important;
    overflow: hidden !important;
  }
  /* stage 保持「三屏叠在同一轨道」（grid-area 1/1），并让该轨道吃满剩余高度：
     叠放 + 单轨道 minmax(0,1fr) → 三个 slide 被 stretch 成完全相同高度。 */
  html body .fy3-hero .fy3-hero__stage {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    align-items: stretch !important;
  }
  html body .fy3-hero .fy3-hero__stage > .fy3-hero__slide {
    grid-area: 1 / 1 !important;
    min-height: 0 !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 14px !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  /* 第 1/2 屏：copy 固定高，media 吸收剩余 */
  html body .fy3-hero .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__copy {
    order: 1 !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
  }
  html body .fy3-hero .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__media {
    order: 2 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    overflow: hidden !important;
  }
  /* 第 3 屏：video 吸收剩余，机位条固定高 */
  html body .fy3-hero .fy3-hero__slide:has(> .fy3-hero__media--bleed) {
    gap: 12px !important;
  }
  html body .fy3-hero .fy3-hero__stage > .fy3-hero__slide > .fy3-hero__media--bleed {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  html body .fy3-hero .fy3-hero__stage > .fy3-hero__slide > .fy3-hero__media--bleed .fy3-hero__video {
    order: 1 !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
  }
  html body .fy3-hero .fy3-hero__stage > .fy3-hero__slide > .fy3-hero__media--bleed .fy3-hero__cam-bar {
    order: 2 !important;
    flex: 0 0 auto !important;
  }
  /* 缩短一点文案区，给媒体留更多可用高度（长文案语种不至于把媒体挤到 0） */
  html body .fy3-hero .fy3-hero__slide .fy3-hero__slogan { font-size: 32px !important; line-height: 1.06 !important; }
  html body .fy3-hero .fy3-hero__slide .fy3-hero__stages { margin-top: 10px !important; }
  html body .fy3-hero .fy3-hero__slide .fy3-hero__actions { margin-top: 14px !important; }
}

/* ---- ③ 第 3 屏手机端机位条可用性（<=767） -------------------------------- */
@media (max-width: 767px) {
  html body .fy3-hero__slide > .fy3-hero__media--bleed .fy3-hero__cam-bar {
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 20px), transparent 100%);
  }
  html body .fy3-hero__slide > .fy3-hero__media--bleed .fy3-hero__cam-bar .fy3-hero__cam-btn {
    min-height: 34px !important;
    touch-action: manipulation !important;
  }
  html body .fy3-hero__slide > .fy3-hero__media--bleed .fy3-hero__cam-bar .fy3-hero__cam-btn.is-active {
    background: #1B4D3E !important;
    border-color: #1B4D3E !important;
    color: #FFFFFF !important;
  }
}

/* ---- ④ 平板断点 768–1023：过渡排版 -------------------------------------- */
/* 策略：不重排成双列（base hero 是「绝对定位媒体 + 单列文案」结构，改列会压窄媒体），
   保持单列但放大字号、限宽居中、媒体给 16/10 固定可视高度。 */
@media (min-width: 768px) and (max-width: 1023px) {
  html body .fy3-hero {
    min-height: 0 !important;
    padding-block: 84px 56px !important;
    overflow-x: clip !important;
  }

  html body .fy3-hero .fy3-hero__stage {
    display: block !important;
    max-width: 720px !important;
    margin-inline: auto !important;
    padding-inline: 24px !important;
    box-sizing: border-box !important;
    min-height: 0 !important;
  }
  html body .fy3-hero .fy3-hero__slide {
    display: block !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  html body .fy3-hero .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__copy {
    position: static !important;
    padding-block: 0 !important;
    margin-bottom: 20px !important;
  }
  html body .fy3-hero .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__media {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 16 / 10;
    min-height: 300px !important;
    order: 0 !important;
    overflow: hidden !important;
    border-radius: 14px !important;
    background: #FAF8F5 !important;
  }
  html body .fy3-hero .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__media .fy3-hero__photo,
  html body .fy3-hero .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__media img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
  }
  html body .fy3-hero .fy3-hero__slide:not(:has(> .fy3-hero__media--bleed)) > .fy3-hero__media .fy3-compare {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
  }

  html body .fy3-hero .fy3-hero__slide:has(> .fy3-hero__media--bleed) > .fy3-hero__copy {
    position: static !important;
    padding-block: 0 !important;
    margin-bottom: 20px !important;
  }
  html body .fy3-hero .fy3-hero__slide:has(> .fy3-hero__media--bleed) > .fy3-hero__media--bleed {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  html body .fy3-hero .fy3-hero__slide:has(> .fy3-hero__media--bleed) > .fy3-hero__media--bleed .fy3-hero__video {
    width: 100% !important;
    height: clamp(320px, 44vh, 400px) !important;
    object-fit: cover !important;
    transform: none !important;
    border-radius: 14px !important;
  }

  html body .fy3-hero .fy3-hero__slogan { font-size: 48px !important; line-height: 1.05 !important; max-width: 100% !important; }
  html body .fy3-hero .fy3-hero__slogan--tight { font-size: 44px !important; }
  html body .fy3-hero .fy3-hero__line { font-size: 15px !important; max-width: 36em !important; }
  html body .fy3-hero .fy3-hero__stages { max-width: none !important; margin-top: 22px !important; }
  html body .fy3-hero .fy3-hero__actions { margin-top: 24px !important; gap: 12px !important; }
  html body .fy3-hero .fy3-hero__actions .fy3-btn { min-height: 48px !important; }

  html body .fy3-hero .fy3-hero__cam-bar {
    position: static !important;
    inset: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 8px !important;
    scrollbar-width: none !important;
  }
  html body .fy3-hero .fy3-hero__cam-bar::-webkit-scrollbar { display: none !important; }
  html body .fy3-hero .fy3-hero__cam-bar .fy3-hero__cam-btn {
    flex: 0 0 auto !important;
    min-height: 36px !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    background: #FFFFFF !important;
    border: 1px solid rgba(20, 19, 17, .16) !important;
    color: #141311 !important;
  }
  html body .fy3-hero .fy3-hero__cam-bar .fy3-hero__cam-btn.is-active {
    background: #1B4D3E !important;
    border-color: #1B4D3E !important;
    color: #FFFFFF !important;
  }
  html body .fy3-hero .fy3-hero__cam-bar .fy3-hero__cam-btn .fy3-mono { font-size: 11px !important; }
}

/* ---- ⑤ 降低动效偏好下对比块仍可见 ---------------------------------------- */
@media (prefers-reduced-motion: reduce) and (max-width: 1023px) {
  html body .fy3-hero__slide .fy3-hero__media .fy3-compare { min-height: 240px !important; }
}
