/* ==========================================================================
   xm-mobile-nav.css  v2  ·  2026-11-12
   huancheer.com 手机端导航补全（≤900px 生效，桌面零影响）
   v2：新增无 JS 兜底——JS 未就绪时导航竖排展开，绝不整块消失
   ========================================================================== */

/* 桌面端完全隐藏新增元素 */
#xm_nav_toggle,
.xm-nav-backdrop,
.xm-nav-close,
.xm-caret { display: none; }

/* ---------- 桌面端页头防溢出（2026-11-12 补）----------
   法/西/葡等长语言导航总宽超过容器 → 出现横向滚动条
   只收窄间距与字号，不改结构、不改颜色 */
@media (min-width: 1181px) and (max-width: 1600px) {
  .full-header-nav { margin-left: 14px; margin-right: 10px; }
  .full-header-nav > ul > li > a { padding: 20px 9px; font-size: 15px; }
  .full-header-search-input { width: 130px; }
}
@media (min-width: 1181px) and (max-width: 1380px) {
  .full-header-nav > ul > li > a { padding: 18px 6px; font-size: 14px; }
  .full-header-search-input { width: 110px; }
  .full-header-logo img { max-height: 34px; }
  /* 轮播左右箭头原本 -20px 外探，小桌面下会撑出 10px 横滚动 */
  .category-card-carousel-prev { left: 0; }
  .category-card-carousel-next { right: 0; }
}

@media (max-width: 1180px) {

  /* ---------- 0. 兜底：禁止横向溢出 ---------- */
  html, body { overflow-x: hidden !important; max-width: 100% !important; }
  body.xm-nav-open { overflow: hidden !important; }

  /* ---------- 1. 顶栏瘦身 ---------- */
  #header_top_bar { padding: 0 !important; }
  #header_top_left { display: none !important; }
  #header_facebook, #header_youtube, #header_email { display: none !important; }
  #header_tel { display: flex !important; margin-right: 0 !important; }
  #header_tel_num { font-size: 12px !important; letter-spacing: .3px; }
  #header_top_right .full-header-contact-item svg { width: 13px !important; height: 13px !important; margin-right: 5px !important; }
  #header_top_container { justify-content: flex-end !important; min-height: 34px; }

  /* ---------- 2. 主栏 ---------- */
  .full-header-container { padding: 0 14px !important; }
  #header_main_container { position: relative; min-height: 56px; flex-wrap: wrap; }
  #header_logo_img { max-height: 34px !important; }

  /* ---------- 3. 无 JS 兜底：导航竖排，不定位、不溢出 ---------- */
  #header_nav {
    position: static !important;
    width: 100% !important;
    margin: 8px 0 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    transform: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    order: 3;
  }
  #header_nav > ul { display: block !important; padding: 0 !important; margin: 0 !important; }
  #header_nav > ul > li { display: block !important; width: 100% !important; position: relative !important; }
  #header_nav > ul > li > a {
    display: block !important;
    padding: 13px 16px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    white-space: normal !important;
    border-bottom: 1px solid rgba(245, 243, 240, .12);
  }
  #header_nav .full-header-dropdown,
  #header_nav .full-header-sub-dropdown,
  #header_nav .full-header-sub-sub-dropdown,
  #header_nav .full-header-sub-sub-sub-dropdown {
    position: static !important;
    top: auto !important; left: auto !important;
    width: auto !important; min-width: 0 !important;
    display: none !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(0, 0, 0, .25) !important;
    padding: 4px 0 !important;
  }
  #header_nav li.xm-sub-open > .full-header-dropdown,
  #header_nav li.xm-sub-open > .full-header-sub-dropdown,
  #header_nav li.xm-sub-open > .full-header-sub-sub-dropdown,
  #header_nav li.xm-sub-open > .full-header-sub-sub-sub-dropdown { display: block !important; }
  #header_nav .full-header-dropdown > ul { display: block !important; }
  #header_nav .full-header-dropdown > ul > li { display: block !important; width: 100% !important; position: static !important; }
  #header_nav .full-header-dropdown > ul > li > a {
    padding: 11px 16px 11px 28px !important;
    font-size: 14px !important; line-height: 1.4 !important; white-space: normal !important;
  }
  #header_nav .full-header-sub-dropdown li a,
  #header_nav .full-header-sub-sub-dropdown li a,
  #header_nav .full-header-sub-sub-sub-dropdown li a {
    padding: 10px 16px 10px 40px !important;
    font-size: 13px !important; line-height: 1.4 !important; white-space: normal !important;
  }
  #header_right_panel { position: static !important; transform: none !important; box-shadow: none !important; }

  /* ---------- 4. JS 就绪后才启用抽屉（html.xm-ready） ---------- */
  html.xm-ready #xm_nav_toggle {
    display: inline-flex !important;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0 10px;
    background: transparent;
    border: 1px solid rgba(245, 243, 240, .45);
    border-radius: 4px;
    cursor: pointer;
    flex: 0 0 auto;
    -webkit-tap-highlight-color: transparent;
  }
  html.xm-ready #xm_nav_toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-text-light, #f5f3f0);
    border-radius: 1px;
  }
  /* 抽屉打开后隐藏汉堡，避免遮罩上出现多余按钮（关闭走抽屉右上×） */
  html.xm-ready body.xm-nav-open #xm_nav_toggle { visibility: hidden !important; }

  html.xm-ready .xm-nav-backdrop {
    display: block !important;
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
    z-index: 100000;
  }
  html.xm-ready body.xm-nav-open .xm-nav-backdrop { opacity: 1; pointer-events: auto; }

  html.xm-ready #header_main_container { flex-wrap: nowrap; }

  html.xm-ready #header_nav {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(84vw, 340px) !important;
    display: block !important;
    margin: 0 !important;
    padding: 58px 0 150px 0 !important;
    background: var(--color-secondary, #4a3f35) !important;
    transform: translateX(-100%) !important;
    transition: transform .28s ease;
    z-index: 100001;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 2px 0 18px rgba(0, 0, 0, .28);
    order: 0;
  }
  html.xm-ready body.xm-nav-open #header_nav { transform: translateX(0) !important; }

  html.xm-ready .xm-nav-close {
    display: flex !important;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 54px;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
    background: transparent;
    border: 0;
    color: var(--color-text-light, #f5f3f0);
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    -webkit-tap-highlight-color: transparent;
  }

  /* 展开箭头（仅手机端显示） */
  .xm-caret {
    display: inline-block;
    float: right;
    font-size: 11px;
    opacity: .7;
    padding: 0 2px 0 10px;
    transition: transform .2s ease;
  }
  li.xm-sub-open > a > .xm-caret { transform: rotate(180deg); }

  /* 右侧面板（搜索 + 语言）收进抽屉底部 */
  html.xm-ready #header_right_panel {
    position: fixed !important;
    left: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: min(84vw, 340px) !important;
    margin: 0 !important;
    padding: 10px 16px 16px 16px !important;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    background: var(--color-secondary, #4a3f35) !important;
    border-top: 1px solid rgba(245, 243, 240, .15);
    transform: translateX(-100%) !important;
    transition: transform .28s ease;
    z-index: 100002;
    box-shadow: 2px -6px 18px rgba(0, 0, 0, .22);
  }
  html.xm-ready body.xm-nav-open #header_right_panel { transform: translateX(0) !important; }

  #header_search { width: 100% !important; }
  #header_search_form { display: flex !important; width: 100% !important; }
  .full-header-search-input {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 40px !important;
    font-size: 15px !important;
  }
  .full-header-search-button { flex: 0 0 42px !important; width: 42px !important; }

  #lang_switcher { margin: 0 !important; align-self: flex-start; position: relative; }
  html.xm-ready #lang_switcher .full-header-language-dropdown {
    position: absolute !important;
    bottom: 100% !important;
    top: auto !important;
    left: 0 !important;
    right: auto !important;
    margin: 0 0 6px 0 !important;
    max-height: 46vh;
    overflow-y: auto;
  }

  /* ---------- 9. 内容区移动适配（2026-11-12 补 · 原模板无任何响应式） ---------- */
  /* 1. 页脚：5 列横排 → 竖排 */
  #footer_top { flex-direction: column !important; gap: 26px !important; }
  #footer_top > .footer-clean-col,
  .footer-clean-col-about,
  .footer-clean-col-links { width: 100% !important; padding: 0 !important; }
  .footer-clean-bottom-container { flex-wrap: wrap !important; gap: 8px 12px !important; justify-content: center !important; }
  #footer_addr_text, #footer_email_link, #footer_tel_text { word-break: break-word !important; }

  /* 2. 产品列表：侧栏 + 内容 双列 → 单列 */
  .product-list-layout { display: block !important; }
  .product-list-layout > * { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
  .product-list-content { width: 100% !important; }
  .category-products-list { display: grid !important; grid-template-columns: repeat(2, minmax(0,1fr)) !important; gap: 14px !important; }
  .category-products-section { width: 100% !important; }

  /* 3. 搜索结果 / 产品详情 */
  .search-layout-grid { display: block !important; }
  .search-layout-grid > * { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
  .search-main-content, .search-sidebar { width: 100% !important; min-width: 0 !important; }
  .search-results-header { width: 100% !important; }
  h1.keyword { display: block !important; }
  .product-list-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; width: 100% !important; }
  .product-card-vertical-container { width: 100% !important; min-width: 0 !important; }

  /* 4. 关于我们 */
  .company-intro-tabs { flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .company-intro-tab { flex: 0 0 auto !important; }
  .all-company-indicators-row,
  .all-company-indicators-row-first,
  .all-company-indicators-row-second,
  .all-company-indicators-row-third { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }

  /* 5. 首页双列图文（负 margin 撑破视口） */
  .grid-col-2 { grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important; }
  .company-intro-section,
  #company-video-intro {
    transform: none !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 6. 通用防溢出 */
  img, video, iframe, table, pre { max-width: 100% !important; }
  table { display: block; overflow-x: auto; }
}

/* ---------- 10. 桌面窄档 1181–1439：首页图文出血块右溢 10px ----------
   实测 1181/1200/1280/1366/1400 均为 body 宽 = 视口 +10，1440 起自愈。
   病因：#company-video-intro 内联 margin-left:-20px 且被脚本再加 translateX(50px)，
   右边界固定越过视口 10px。把它再左移 10px 即贴合，视觉仍是出血贴边。 */
@media (min-width: 1181px) and (max-width: 1439px) {
  #company-video-intro { margin-left: -30px !important; }
}

/* ---------- 11. 手机 ≤768：contact 页与询盘表单不再挤成 118px ----------
   实测 contactus 390：【.inquiry-form-middle 带着桌面 padding 136px】把表单压到 118 宽，
   提交按钮固定 280px 直接顶出视口 26px（body 宽 416）。contact-info 又是 55/45 双栏。
   这里在手机上改单栏 + 收窄内边距，表单可填、无横溢。 */
@media (max-width: 768px) {
  .inquiry-form-middle { padding: 44px 18px 56px !important; }
  .inquiry-form-middle > * { max-width: 100% !important; }
  .inquiry-form-middle form,
  #contact-page-inquiry-form { width: 100% !important; max-width: 100% !important; }
  .inquiry-form-title, .inquiry-form-desc { width: 100% !important; max-width: 100% !important; }
  .inquiry-form-item { width: 100% !important; max-width: 100% !important; }
  .inquiry-form-button { width: 100% !important; max-width: 340px !important; }

  .contact-info-wrapper { flex-direction: column !important; padding: 0 16px !important; }
  .contact-info-left, .contact-info-right { width: 100% !important; max-width: 100% !important; }
  .contact-info-left { padding: 26px 0 !important; }
  .contact-info-image { width: 100% !important; height: auto !important; max-height: 300px; object-fit: cover; }
}

/* ---------- 12. 手机 ≤768：询盘 4 个输入框排 2x2 ----------
   原样式 4 个输入框挤一行各 77px，"Your Na"/"Phone N" 直接被截断。
   实测改 2x2 后每个 172px，占位文案完整，提交按钮满宽。 */
@media (max-width: 768px) {
  .inquiry-form-item { flex-wrap: wrap !important; gap: 10px !important; }
  .inquiry-form-item > * {
    flex: 1 1 calc(50% - 5px) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: auto !important;
  }
}

/* ---------- 13. 手机 ≤768：产品页询盘容器 1360px 定宽改满宽 ----------
   实测 sale-55731949 页 390 视口：.inquiry-form-middle width:1360px（桌面定宽）
   → body 宽 1360，整页横向溢出 970px。改满宽后 bd=390，表单 2x2 正常。 */
@media (max-width: 768px) {
  .inquiry-form-middle { width: 100% !important; max-width: 100% !important; }
}

/* ---------- 14. 桌面窄档 769–1359：产品页询盘容器 1360 定宽顶出视口 ----------
   实测 1024/1180/1280/1359 四档 bd 恒为 1360（1366 起自愈）。
   改为满宽 + max-width 1360，1360 以上维持原设计。 */
@media (min-width: 769px) and (max-width: 1359px) {
  .inquiry-form-middle { width: 100% !important; max-width: 1360px !important; box-sizing: border-box; }
}

/* ---------- 15. 语义标题中性化（第 15.1 节把 div 换成 h2/h3） ----------
   站内全局 h2 规则带 white-space:nowrap / overflow:hidden / text-overflow:ellipsis
   / text-transform:capitalize；这些类改成 h2/h3 后会被它压出省略号与首字母大写。
   这里按类还原为正常换行，视觉与改造前一致。 */
.section-title,
.section-subtitle,
.internal-page-title-heading,
.all-company-indicators-title,
.contact-info-title,
.quality-certification-title {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  text-transform: none !important;
}
