/* ============================================================
   汇捷机械 · 移动端适配
   只在 ≤900px 生效；桌面端（>900px）完全不受影响。
   由 archive/inject_mobile.py 注入，勿手工改页面里的这段引用。
   ============================================================ */

/* ---------- 菜单里的拨号按钮：桌面端不显示（由 JS 插入） ---------- */
nav.main .nav-tel { display: none; }

/* ---------- 汉堡按钮（桌面端不显示） ---------- */
.burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  flex-shrink: 0;
  color: var(--main, #123A32);
  background: #fff;
  border: 1px solid #DDE6EE;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.burger svg { display: block; }
.burger .ic-close { display: none; }
body.nav-open .burger .ic-open { display: none; }
body.nav-open .burger .ic-close { display: block; }

@media (max-width: 900px) {

  /* ============ 一、顶部信息栏 ============ */
  .topbar .wrap {
    height: auto;
    min-height: 58px;
    padding-top: 9px;
    padding-bottom: 9px;
    gap: 10px;
  }
  .brand { gap: 9px; min-width: 0; }
  .logo { width: 38px; height: 38px; flex-shrink: 0; font-size: 15px; }
  .brand-name { font-size: 17px; line-height: 1.2; white-space: nowrap; }
  .brand-tag { display: none; }
  .hotline { flex-shrink: 0; }
  .hotline a { font-size: 13px !important; white-space: nowrap; }

  /* ============ 二、主导航改抽屉 ============ */
  .burger { display: flex; }
  nav.main { display: none; }

  body.nav-open { overflow: hidden; }

  body.nav-open nav.main {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: var(--tb-h, 58px);
    z-index: 900;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-top: 2px solid var(--teal, #12A5A0);
    animation: hjNavIn .18s ease-out;
  }
  @keyframes hjNavIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: none; }
  }

  nav.main .wrap {
    display: block;
    max-width: none;
    padding: 4px 18px 40px;
  }

  /* 菜单底部的电话，方便手机用户直接拨号 */
  nav.main .nav-tel {
    display: block;
    margin: 22px 0 0;
    padding: 15px 0;
    text-align: center;
    background: var(--amber, #E8712E);
    color: #262B33;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
  }

  nav.main > .wrap > a,
  .nav-item > a {
    display: block;
    padding: 15px 2px !important;
    border-bottom: 1px solid #EDF2F6;
    color: var(--main, #123A32) !important;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
  }
  nav.main > .wrap > a.active { color: var(--teal, #12A5A0) !important; }

  .nav-item { display: block; position: static; }

  /* 产品中心：点击展开的手风琴，纯文字，去掉图片 */
  .mega {
    display: none !important;
    position: static !important;
    width: auto !important;
    margin: 6px 0 6px;
    padding: 4px 6px 8px !important;
    background: #F7FAFA !important;
    border: 1px solid #EDF2F6 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  .mega::before { display: none !important; }
  .nav-item.open .mega { display: block !important; }
  .nav-item.open > a { color: var(--teal, #12A5A0) !important; }

  .mega .mgroup { display: block; min-width: 0; margin: 0; }
  .mega .mgroup h5 {
    display: block;
    margin: 8px 0 2px;
    padding: 3px 8px;
    border: 0;
    font-size: 11px;
    letter-spacing: .06em;
    color: #8A97A6;
  }
  .mega .mgroup .mgrid { display: block; }
  .mega a.mcard {
    display: block;
    flex: none;
    padding: 9px 8px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    box-shadow: none !important;
    transform: none !important;
    overflow: visible;
    text-align: left !important;
  }
  .mega a.mcard:active { background: #EAF2F2; }
  .mega a.mcard .mimg { display: none; }
  .mega a.mcard .mtx { display: block; padding: 0; text-align: left; }
  .mega a.mcard .mtx b {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--main, #123A32);
  }
  .mega a.mcard .mtx i { display: none; }

  /* ============ 三、布局：多列改单列 / 两列 ============ */
  .wrap { padding: 0 16px; }

  /* 左右分栏 → 上下堆叠 */
  .pd,
  .spec-grid,
  .intro,
  .intro-grid,
  .ask-grid,
  .two-col,
  .c-two,
  .brand-grid,
  .case,
  .sol,
  .cklist,
  .news-layout,
  .f-grid {
    grid-template-columns: 1fr !important;
  }
  .f-grid { gap: 26px; }
  .spec-grid, .pd { gap: 22px; }
  .pd { padding-bottom: 24px; }

  /* 多列卡片 → 两列 */
  .related,
  .certs,
  .c-grid,
  .gallery,
  .cats,
  .honor-grid,
  .q4,
  .apps,
  .numbers .wrap,
  .caseband .wrap,
  .steps,
  .models,
  .grid,
  .gal,
  .flow {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .numbers .wrap,
  .caseband .wrap { gap: 18px 10px; }

  /* 缩略图保持一行四张，只是变小 */
  .thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 7px; }

  /* ============ 四、溢出与内容 ============ */
  img { max-width: 100%; height: auto; }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    font-size: 13px;
  }

  /* 长英文/型号不撑破 */
  .pd, .spec-grid, .models, .intro, .c-two, .related { min-width: 0; }
  .pd > *, .spec-grid > *, .intro > *, .c-two > * { min-width: 0; }

  /* ============ 五、字号与间距 ============ */
  section { padding: 30px 0; }
  .sec-head h2, h2 { font-size: 21px; line-height: 1.4; }
  .sec-head p { font-size: 13.5px; }

  .phero { padding: 34px 0 28px; }
  .phero h1 { font-size: 24px !important; line-height: 1.35; }
  .phero p { font-size: 13.5px; }
  .cat-hero h1 { font-size: 21px !important; }
  .pd h1 { font-size: 22px !important; }

  /* 分类总览卡：描述长，横向排两列太挤，改单列 */
  .grid { grid-template-columns: 1fr !important; }

  /* 联系页信息卡：18px 放不下 11 位号码，缩到 16px 保证一行 */
  .c-card .big { font-size: 16px !important; }
  .c-card { padding: 20px 14px; }

  .cta-row { gap: 10px; }
  .cta-row .btn { width: 100%; text-align: center; }
  .cta-row span { font-size: 13px; }

  /* 右下角悬浮咨询按钮：小屏收小一点，少挡内容 */
  .float-contact { right: 10px !important; bottom: 68px !important; }
  .float-contact > label {
    width: 46px !important;
    height: 46px !important;
    font-size: 11.5px !important;
  }
  .float-contact .qr-pop { right: 0; bottom: 0; width: 158px; }
}

/* ============ 六、平板区间（620–900px）用回多列，别浪费宽度 ============ */
@media (min-width: 620px) and (max-width: 900px) {
  .numbers .wrap,
  .caseband .wrap,
  .certs,
  .related,
  .c-grid,
  .gallery,
  .cats,
  .honor-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
  .models,
  .sol,
  .gal,
  .steps,
  .flow,
  .q4,
  .apps,
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .f-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .phero h1 { font-size: 28px !important; }
}

/* ============ 七、超小屏（≤420px）============ */
@media (max-width: 420px) {
  .brand-name { font-size: 15.5px; }
  .logo { width: 34px; height: 34px; font-size: 13px; }
  .hotline a { font-size: 12px !important; }
  .wrap { padding: 0 14px; }
  .thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .hero h1, h1 { font-size: 24px; }
}

@media print {
  .burger, nav.main, .float-contact { display: none !important; }
}
