/* ==========================================================================
   KHJ 补充样式 (2026-11-18)
   由 inc/khj-optimize.php 通过 wp_enqueue_scripts 加载，版本号 20261118。
   目的：在不改动主题原有 CSS 的前提下，修掉移动端可用性问题。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. WhatsApp 悬浮按钮
   原样式：position:fixed; right:0; top:50% —— 桌面端贴在视口右边缘垂直居中。
   2026-11-18 改为：右下角固定。
   2026-11-24 大帅要求改回：PC 端放在【左侧垂直居中】，面板/提示气泡镜像到
   按钮右侧弹出。移动端仍保持右下角不变。
   -------------------------------------------------------------------------- */
@media (min-width: 601px) {
    .khj-wa { top: 50% !important; bottom: auto !important; right: auto !important; left: 18px !important; transform: translateY(-50%) !important; }
    .khj-wa__btn { margin-right: 0 !important; }
    /* 面板改到按钮右侧弹出（原始 right:86px 是弹在按钮左侧，镜像后用 left:86px） */
    .khj-wa__panel { left: 86px !important; right: auto !important; bottom: 0 !important; }
    /* 悬停提示气泡同样镜像到按钮右侧，小箭头改指回左侧按钮 */
    .khj-wa__tip { right: auto !important; left: 72px !important; }
    .khj-wa__tip::after { right: auto !important; left: -5px !important; border-left-color: transparent !important; border-right-color: #16233b !important; }
}

/* 移动端：footer.php 里的内联样式把它放在 bottom:88px、54px 见方，
   实测正好压住正文段落右侧文字。缩小到 48px 并移到右下角。
   必须用 !important：内联 <style> 在 body 里，晚于 head 中的本文件加载。 */
@media (max-width: 600px) {
    .khj-wa { right: 12px !important; bottom: 16px !important; }
    .khj-wa__btn { width: 48px !important; height: 48px !important; }
    .khj-wa__btn svg { width: 26px !important; height: 26px !important; }
    .khj-wa__panel { right: 0 !important; bottom: 62px !important; }
}

/* --------------------------------------------------------------------------
   2. 移动端表单可读性
   iOS Safari 在输入框字号小于 16px 时会自动放大页面，导致表单错位。
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    #fluentform_5 input[type="text"],
    #fluentform_5 input[type="email"],
    #fluentform_5 input[type="tel"],
    #fluentform_5 input[type="url"],
    #fluentform_5 input[type="number"],
    #fluentform_5 select.ff-el-form-control,
    #fluentform_5 textarea.ff-el-form-control,
    #fluentform_5 .ff-el-form-control { font-size: 16px !important; }

    /* 提交按钮：从 45px 提到 50px，符合触屏最小点击区 */
    #fluentform_5 .ff-btn-submit { min-height: 50px; font-size: 16px; }
}

/* --------------------------------------------------------------------------
   3. 移动端正文与页脚字号下限
   线上实测存在 11.5px 的营业时间文字与 18px 高的电话/邮箱链接。
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .khj-wa__tel,
    .footer_main p,
    .footer_main li,
    .footer_main__nav__ul a { font-size: 13px; }

    .footer_main a[href^="tel:"],
    .footer_main a[href^="mailto:"] { display: inline-block; padding: 6px 0; }
}

/* --------------------------------------------------------------------------
   4. 清掉首页旧轮播遗留的分页条（hero 已改为静态区块）
   -------------------------------------------------------------------------- */
.index_banner__pagination { display: none !important; }

/* --------------------------------------------------------------------------
   5. 首页博客轮播：恢复 overflow 裁剪
   主题里有一条 `main.web_index .index_blog__container{overflow:visible}`
   覆盖了 swiper 自带的 overflow:hidden。loop 模式克隆出 12 个 slide，
   wrapper 实际宽 3846px，全部计入 body 溢出（实测 body.scrollWidth 2603~3851）。
   副作用：手机窄屏下左右各露出 19px 的邻卡碎片，且这两条碎片可点击，
   会跳到别的文章（点击区域错位）。
   这里只恢复裁剪，不动 padding-bottom:50px（分页器在这段留白里）。
   -------------------------------------------------------------------------- */
/* 只裁容器本身，不裁外层 __wrap。
   注意：分页圆点比容器底边低 7px（桌面 8px），单纯 overflow:hidden 会把它们压成 1px 细线，
   所以用 overflow:clip + overflow-clip-margin 把裁剪边界往下放 14px ——
   横向超出的 3846px 依然被裁，底部分页条保持完整。
   不支持 clip 的旧浏览器会退回 overflow:hidden（分页条变细，但不影响功能）。 */
main.web_index .index_blog__container {
    overflow: hidden;
    overflow: clip;
    overflow-clip-margin: 14px;
}

/* --------------------------------------------------------------------------
   6. 产品区 360° 精灵图容器超出视口 83px
   实测 #mySpriteSpin 宽 1140px、右边缘 1522.5px，而视口 1440px，
   导致 documentElement.scrollWidth 1523 ≠ clientWidth 1440（桌面端隐藏的横向溢出）。
   在区块层裁掉，不动精灵图自身的盒模型，避免把 360° 图裁坏。
   -------------------------------------------------------------------------- */
main.web_index .index_product__wrap { overflow: hidden; }

/* --------------------------------------------------------------------------
   5. 中文/长英文单词在极窄屏不撑破容器
   -------------------------------------------------------------------------- */
.khj-hero__title,
.product-list_main__desc__title h1,
.article_main__title h1 { overflow-wrap: break-word; word-break: normal; }

/* --------------------------------------------------------------------------
   7. 产品列表页：网格被横向裁切
   模板里 .about_desc__img__container_111111111（宽度 1276px、overflow:hidden）
   里塞了一个被 JS 冻结成固定宽度的 .swiper-wrapper（1560~1600px），
   视口不足 1600px 时右侧列被裁掉，看起来像"卡片被切"。
   模板已去掉内联宽度，这里再做一层保护，防止 swiper 重新写回内联样式。
   用 :has() 限定"wrapper 里直接是 ul.row"的情况，不影响 About 页真正的轮播。
   -------------------------------------------------------------------------- */
.about_desc__img__container_111111111 .swiper-wrapper:has(> ul.row) {
    width: auto !important;
    transform: none !important;
}
.about_desc__img__container_111111111:has(> .swiper-wrapper > ul.row) {
    overflow: visible !important;
}

/* 缩略图容器兜底：图片没加载出来时不要塌成 24px 的细条 */
.c-blog__item__img { min-height: 1px; }
.c-blog__item__img .ta-pageimg-right img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}
/* --------------------------------------------------------------------------
   8. About 页移动端背景图 404
   index.min_002.css 里写了 background: url(/lib/img/about/img_loap_bg.png)，
   主题里没有 lib 目录，这张图在服务器上也不存在 —— 移动端每次都 404。
   该规则本来就加载不到图（等于没背景），所以这里直接关掉，不会再请求。
   日后补到图的话，把下面这条删掉即可。
   -------------------------------------------------------------------------- */
main.web_about .about_develop__thumbs__container {
    background-image: none !important;
}