/* ---------- 移动端优化层（设备检测后自动生效） ----------
   规则：
   1) 本文件只针对 html.is-mobile 生效 —— 由 <head> 里的设备检测脚本在首屏渲染前打上类名，
      移动端访问自动套用这层「移动前端」样式，电脑端完全不受影响；
   2) 宽度媒体查询解决不了的移动端体验（触摸、吸附、安全区、输入框缩放、悬停残留）都在这里；
   3) 与 site.css 的关系：site.css 负责通用版式，这里负责「像手机一样好用」。
*/

/* ① 基础：禁掉 iOS 字体自动放大；滚动更顺滑；底部安全区 */
html.is-mobile {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(26, 54, 93, .08);
}
html.is-mobile body {
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  /* 给底部固定栏留出空间，避免遮住页脚内容 */
  padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
}

/* ② 触摸目标：所有可点元素至少 44px 高 */
html.is-mobile .btn,
html.is-mobile .nav-link,
html.is-mobile .btn-icon,
html.is-mobile .mb-item,
html.is-mobile .sd-sub,
html.is-mobile .sd-nav-all,
html.is-mobile .doc-toc a,
html.is-mobile .cc-arrow,
html.is-mobile .cc-dot {
  min-height: 44px;
  box-sizing: border-box;
}
html.is-mobile .btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 20px; }
html.is-mobile .btn-sm { padding: 9px 16px; }

/* ③ 悬停残留：触摸设备上 :hover 会「粘住」，统一关掉位移类效果 */
html.is-mobile .promise-item:hover,
html.is-mobile .product-card:hover,
html.is-mobile .cat-item:hover,
html.is-mobile .se-cat:hover,
html.is-mobile .btn:hover,
html.is-mobile .ai-cand:hover {
  transform: none;
}
/* 触摸态用 :active 给出反馈 */
html.is-mobile .btn:active,
html.is-mobile .nav-link:active,
html.is-mobile .sd-sub:active { opacity: .82; }

/* ④ 页头：更矮、更紧凑，通话按钮改为图标 */
html.is-mobile .site-header { position: sticky; top: 0; z-index: 60; }
html.is-mobile .header-inner { min-height: 52px; gap: 10px; }
html.is-mobile .brand-text em { display: none; }
html.is-mobile .brand-text strong { font-size: 16px; }
html.is-mobile .site-nav {
  max-height: calc(100vh - 52px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ⑤ 首屏：矮一点，标题行可读 */
html.is-mobile .hero { height: auto; min-height: 0; padding-bottom: 0; }
html.is-mobile .hero .slides { height: 46vh; min-height: 240px; max-height: 380px; }
html.is-mobile .hero-caption { font-size: 13px; padding: 10px 0 12px; }
html.is-mobile .hero-caption b { font-size: 15px; }
html.is-mobile .hero-scroll { display: none; }

/* ⑥ 栅格：手机一律双列（详情页单列），卡片间距收紧 */
html.is-mobile .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
html.is-mobile .product-card .pc-img { height: 150px; }
html.is-mobile .product-card h3 { font-size: 14px; line-height: 1.5; }
html.is-mobile .product-card .pc-price { font-size: 14px; }
html.is-mobile .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
html.is-mobile .promise-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
html.is-mobile .promise-item { padding: 16px 12px; }
html.is-mobile .promise-item h3 { font-size: 15px; }
html.is-mobile .promise-item p { font-size: 12.5px; }
html.is-mobile .stats-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* ⑦ 列表页：筛选条吸顶、导航默认收起 */
html.is-mobile .sd-toolbar { position: sticky; top: 52px; z-index: 40; background: #fff; }
html.is-mobile .sd-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
html.is-mobile .sd-filters input[type="search"] { grid-column: 1 / -1; }
/* 输入框字号 ≥16px，避免 iOS 聚焦时页面被放大 */
html.is-mobile input[type="text"],
html.is-mobile input[type="search"],
html.is-mobile input[type="tel"],
html.is-mobile input[type="number"],
html.is-mobile textarea,
html.is-mobile select {
  font-size: 16px !important;
  min-height: 42px;
}
html.is-mobile .sd-nav { position: static; }
html.is-mobile .sd-group-body { max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ⑧ 详情页：参数表转卡片；底部固定询价条 */
html.is-mobile .sd-params table,
html.is-mobile .detail-params table { font-size: 13px; }
html.is-mobile .detail-gallery .thumb { width: 62px; height: 62px; }
html.is-mobile .lightbox .lb-stage { width: 96vw; height: 78vh; }

/* ⑨ 图片：预留比例，避免加载时页面跳动 */
html.is-mobile img { max-width: 100%; }
html.is-mobile .product-card img,
html.is-mobile .about-gallery-item img,
html.is-mobile .careers-gallery-item img,
html.is-mobile .news-item img { background: #eef2f7; }

/* ⑩ 底部固定栏：适配 iPhone Home Indicator */
html.is-mobile .mobile-bar {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(16,26,38,.10);
}
html.is-mobile .mobile-bar .mb-item { min-height: 52px; }
html.is-mobile .mobile-bar .mb-item em { font-size: 11px; }

/* ⑪ 表单与按钮：输入区不缩放，提交按钮更大 */
html.is-mobile .inquiry-form input,
html.is-mobile .inquiry-form textarea,
html.is-mobile .inquiry-form select { font-size: 16px; }
html.is-mobile .inquiry-form .btn { width: 100%; padding: 13px 18px; font-size: 16px; }

/* ⑫ 长文：行高与留白更适合小屏阅读 */
html.is-mobile .rich-p { font-size: 15px; line-height: 1.85; }
html.is-mobile .rich-h3 { font-size: 15.5px; margin: 18px 0 8px; }
html.is-mobile .rich-list li { font-size: 14.5px; line-height: 1.8; }
html.is-mobile .detail-desc p { font-size: 15px; line-height: 1.85; }

/* ⑬ 横向滚动区域：加惯性滚动与隐藏滚动条 */
html.is-mobile .sd-tabs,
html.is-mobile .filter-chips,
html.is-mobile .top-cats {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
html.is-mobile .sd-tabs::-webkit-scrollbar,
html.is-mobile .filter-chips::-webkit-scrollbar { display: none; }

/* ⑭ 减少动效：移动端默认尊重系统的「减弱动态效果」 */
@media (prefers-reduced-motion: reduce) {
  html.is-mobile * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
