/* ============================================================================
 * mobile.css — 手机端（H5）深度适配层
 * ----------------------------------------------------------------------------
 * 加载顺序：必须在 base / layout / components / pages/*.css 之后（见各 HTML 的 <link>），
 * 全部规则包在 @media (max-width: 768px) 内，桌面端完全不受影响。
 *
 * 设计口径（对齐国内主流 H5 后台/营销站习惯）：
 *   标题：H1 26 / H2 21 / H3 17.5 / 正文 15 / 辅助 13.5
 *   行高：正文 1.75（中文密排可读性优先），标题 1.35
 *   点击区：主按钮与标签 ≥ 44px（iOS HIG / Material 共同建议 44–48）
 *   表单：输入框字号 ≥ 16px —— 低于 16px 时 iOS Safari 聚焦会自动放大页面
 *   安全区：iPhone 刘海/底部小黑条用 env(safe-area-inset-*) 留白
 * ==========================================================================*/

@media (max-width: 768px) {

    /* ── 0. 基础排版 ─────────────────────────────────────────────── */
    :root {
        /* 顶栏总高：手机端 50 内容 + 1 边框（桌面为 73） */
        --site-header-h: 51px;
        --h5-gutter: 18px;
    }

    html {
        -webkit-text-size-adjust: 100%;   /* 横屏/字号设置不放大正文 */
        text-size-adjust: 100%;
        /* 锚点跳转时给「顶栏 + 吸顶分类条」留位，标题不被遮住 */
        scroll-padding-top: calc(var(--site-header-h) + 70px);
    }

    body {
        font-size: 15px;
        line-height: 1.75;
        letter-spacing: .01em;
        -webkit-tap-highlight-color: transparent;
        -webkit-font-smoothing: antialiased;
        /* 中文手机字体栈：iOS 苹方 → 华为 HarmonyOS / 小米 MiSans → 安卓思源黑体 */
        font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
                     "MiSans", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
    }

    /* 中文标题：字号收敛 + 字重稳一点，避免大字重压 */
    h1 { font-size: 26px; line-height: 1.35; letter-spacing: 0; text-wrap: balance; }
    h2 { font-size: 21px; line-height: 1.4; letter-spacing: 0; text-wrap: balance; }
    h3 { font-size: 17.5px; line-height: 1.45; }
    h4 { font-size: 16px; line-height: 1.5; }
    p  { font-size: 15px; line-height: 1.75; }

    /* 小字统一抬到 13px 以上（12px 在手机上偏细） */
    .section-header p,
    .card-highlight,
    .footer-column p { font-size: 13.5px; line-height: 1.7; }

    .container { padding: 0 var(--h5-gutter); }
    section { padding: 44px 0; }
    .section-header { margin-bottom: 26px; }
    .section-header h2 { font-size: 21px; }

    /* 触控体验：可点元素统一去双击缩放延迟 */
    a, button, .btn, .doc-tab, .tab-btn, .category-tab, .menu-toggle {
        touch-action: manipulation;
    }

    /* 手机上不保留 hover 位移/阴影（触屏没有 hover，残留会造成"闪一下"） */
    .btn:active { transform: none; }

    /* ── 1. 顶栏：压到 51px，按钮做足 44px 触控区 ─────────────────── */
    .site-header {
        height: var(--site-header-h);
        min-height: var(--site-header-h);
        max-height: var(--site-header-h);
        /* 手机端降低毛玻璃强度：低端机滚动更顺，观感几乎不变 */
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .site-header .container {
        height: 50px;
        min-height: 50px;
        max-height: 50px;
        padding: 0 var(--h5-gutter);
    }

    /* ① 顶栏中央：当前页面标题（桌面端不显示；手机上解决"只看得到 logo 不知道在哪一页"）
       绝对居中：左右两侧 logo / 汉堡宽度不等也不会让标题偏向一边 */
    .site-header .container { position: relative; }
    .site-header .container > .logo { flex: none; }
    .hdr-page-title {
        display: block;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        max-width: 58%;
        text-align: center;
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
        letter-spacing: .02em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        pointer-events: none;   /* 标题只是标识，不挡点击 */
    }

    .logo { height: 32px; }
    .logo img { height: 32px; }
    /* logo 本身也是「回首页」的点击目标，补足 44px 触控高度（视觉不变） */
    .logo a {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding-right: 4px;
    }

    /* 汉堡按钮视觉 24px，但可点区域 44×44 居中展开 */
    .menu-toggle {
        width: 44px;
        height: 44px;
        margin-right: -10px;
        align-items: flex-end;
        justify-content: center;
        gap: 5px;
        padding: 10px;
        border-radius: 10px;
    }
    .menu-toggle span { width: 22px; }
    .menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    /* 移动端菜单面板：贴合顶栏新高度（原来写死 50px，改跟变量走） */
    .main-nav {
        top: var(--site-header-h);
        max-height: calc(100dvh - var(--site-header-h));
        padding: 8px var(--h5-gutter) calc(20px + env(safe-area-inset-bottom));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transition: opacity .22s ease, transform .28s cubic-bezier(.34, 1.2, .64, 1);
        transform: translateY(-6px);
    }
    .main-nav ul { gap: 2px; }
    .main-nav a {
        display: flex;
        align-items: center;
        min-height: 52px;                 /* 拇指可点 */
        padding: 0 4px;
        font-size: 16px;
        border-bottom: 1px solid var(--border);
    }
    .main-nav li:last-child a { border-bottom: none; }
    .main-nav a.nav-btn {
        margin-top: 14px;
        min-height: 48px;
        border-radius: 12px;
        justify-content: center;
        border-bottom: none;
    }

    /* ── 2. 页面吸顶分类条：常驻吸顶 + 横向滑动 ────────────────────
       原页面 CSS 在 ≤768 把 .page-nav 改成 position:fixed + opacity:0，
       只在 .visible（滚动触发）时才滑出——手机上首屏看不到分类、滚动时又突然盖住内容。
       这里改回 sticky 常驻，并把高度压到「只有一排标签」（页面标题交给内容区 h2）。 */
    /* ③ 绿色分类条：手机端常驻吸顶（贴在顶栏下方），高度压到 51px
       —— 两层合计 102px，切分类不用回到顶部 */
    .page-nav,
    .page-nav.visible {
        position: sticky !important;
        top: var(--site-header-h) !important;
        left: auto; right: auto;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        z-index: 100;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .10);
        transition: none;
    }
    /* 高度钉死 52px：下方分类标题的吸顶偏移要依赖它，不能随内容浮动。
       去掉 1px 下边框（改用阴影分隔）——边框计入高度会让 38px 按钮只剩 51px 居中空间，
       上下差出 1px，视觉上就是"偏上" */
    .page-nav { height: 52px; border-bottom: none; box-shadow: 0 2px 10px rgba(0, 0, 0, .10); }
    .page-nav-inner {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 0;
        height: 100%;
        min-height: 0;
    }
    /* 分类条里重复的大标题：手机上省掉（内容区已有标题），把纵向空间让给内容 */
    .page-nav .page-title { display: none; }

    /* 胶囊标签组：一行横向滚动 + 边缘渐隐提示「右边还有」 */
    .docs-tabs,
    .tabs-nav,
    .category-tabs,
    .page-nav .tabs {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding: 2px 0;   /* 上下对称：否则整排按钮会被推得偏上 1~2px */
        mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 18px), transparent 100%);
        -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 18px), transparent 100%);
    }
    .docs-tabs::-webkit-scrollbar,
    .tabs-nav::-webkit-scrollbar,
    .category-tabs::-webkit-scrollbar { display: none; }

    .doc-tab,
    .tab-btn,
    .category-tab {
        flex: 0 0 auto;
        scroll-snap-align: start;
        /* 尺寸统一交给 typography.css（高 38 / 左右 20）——三页必须一致 */
        height: 38px;
        min-height: 38px;
        padding: 0 20px;
        font-size: 14px;
        border-radius: 999px;
    }

    /* ── 3. 首页 ────────────────────────────────────────────────── */
    .hero { padding: 34px 0 40px; }
    .hero .container { gap: 24px; }
    .hero h1 {
        font-size: clamp(26px, 7.6vw, 31px);
        line-height: 1.28;
        text-wrap: balance;
    }
    .hero .tagline {
        font-size: 15px;
        line-height: 1.7;
        margin-top: 12px;
    }
    .hero-actions { gap: 10px; margin-top: 20px; }
    .hero-actions .btn { min-height: 48px; font-size: 15px; }
    .hero-stats { gap: 18px; }
    .hero-stat .stat-num { font-size: 19px; }
    .hero-stat .stat-text { font-size: 12.5px; }

    .trust-bar { padding: 24px 0; }
    /* 三个短数字横排一列一行太浪费纵向空间（旧样式 ≤480 会塌成一列），手机保持三栏 */
    .trust-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .trust-item { padding: 14px 10px; }
    .trust-number { font-size: 24px; }
    .trust-label { font-size: 12.5px; }

    .services-grid { gap: 12px; }
    .service-item { padding: 16px; }
    .service-item h3 { font-size: 16.5px; }
    .service-item p { font-size: 13.5px; }

    .advantage-item { padding: 16px; }
    .advantage-item h3 { font-size: 16.5px; }
    .advantage-item p { font-size: 13.5px; }

    /* CTA 区在手机上留安全区 */
    .cta-section { padding: 40px 0 calc(44px + env(safe-area-inset-bottom)); }
    .cta-section h2 { font-size: 22px; text-wrap: balance; }
    .cta-section p { font-size: 14px; }

    /* ── 4. 关于页 ──────────────────────────────────────────────── */
    /* ② 第二栏：绿色介绍条压矮（关于/预约页），并保持吸顶 */
    .page-header {
        position: sticky !important;
        top: var(--site-header-h) !important;
        padding: 10px 0;
        min-height: 0;
        z-index: 100;
    }
    .page-header h1 { font-size: 19px; line-height: 1.4; margin: 0; }
    .page-header p,
    .page-header .tagline {
        font-size: 13.5px;
        line-height: 1.5;
        margin: 2px 0 0;
        padding: 0 !important;   /* 原样式给标语加了 16px 上下内边距，手机上白占 32px */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .about-title { font-size: 21px !important; line-height: 1.4 !important; }
    .story-lead {
        font-size: 16px;
        line-height: 1.75;
        margin-bottom: 14px;
    }
    .story-text p { font-size: 15px; line-height: 1.8; }
    .story-text p + p { margin-top: 12px; }
    .story-image { border-radius: 14px; overflow: hidden; }
    .story-image img { width: 100%; height: auto; display: block; }

    .mission-card { padding: 18px; border-radius: 14px; }
    .mission-card h3 { font-size: 16px; }
    .mission-card p { font-size: 14px; line-height: 1.7; }

    /* ── 5. 服务页 ──────────────────────────────────────────────── */
    /* 分类大标题：在本板块范围内吸顶，滚到下一类时自然切换，始终知道所属类别。
       .category-section 没有 background，这里显式给服务区底色（--bg-light）以保证遮住下方内容 */
    /* 关闭板块入场动画：fadeInUp 会临时给 .category-section 加 transform，
       吸顶元素在 transform 祖先内定位会抖一下；手机端直接省掉这段动画 */
    .category-section { animation: none !important; }

    .category-header {
        position: sticky;
        top: calc(var(--site-header-h) + 52px);
        z-index: 60;
        background: var(--bg-light);
        padding: 8px 0 10px;
        margin-bottom: 6px;
    }
    .category-header h2 {
        margin: 0;
        line-height: 1.35;
        padding-bottom: 10px;   /* 给绿色短下划线留位（不再加全宽细线，避免双线） */
    }
    .category-header h2::after {
        bottom: 2px;
    }
    /* 分区导语：手机端 16px 偏大，收到 14px 与正文拉开层级 */
    .category-desc { font-size: 14px; line-height: 1.85; color: #5B6672; }
    .category-header h2 { font-size: 21px; }
    .service-card { border-radius: 14px; }
    .card-image img,
    .service-card > img {
        width: 100%;
        aspect-ratio: 16 / 10;
        object-fit: cover;
        display: block;
    }
    .card-main { padding: 14px 16px; }
    .card-main h3 { font-size: 17px; line-height: 1.4; }
    .card-highlight { font-size: 13.5px; line-height: 1.6; }
    .card-meta { gap: 8px; flex-wrap: wrap; }
    .card-meta .price { font-size: 16px; }
    .card-meta .tags { font-size: 12.5px; }
    .card-actions { gap: 8px; margin-top: 12px; }
    .card-actions .btn,
    .card-actions .btn-detail { min-height: 42px; font-size: 14px; }
    .card-detail .detail-content { padding: 14px 16px; }
    .card-detail h4 { font-size: 15px; }
    .card-detail li,
    .card-detail .detail-note { font-size: 14px; line-height: 1.7; }

    /* ── 6. 社区页 ──────────────────────────────────────────────── */
    .search-bar { padding: 6px; padding-left: 14px; border-radius: 14px; gap: 8px; }
    .search-bar input,
    .search-input-wrapper input { font-size: 16px; }  /* ≥16px：iOS 聚焦不放大页面 */
    .search-btn,
    .search-bar button { min-height: 44px; min-width: 72px; border-radius: 12px; font-size: 15px; }
    .search-tags { gap: 8px; font-size: 13px; align-items: center; flex-wrap: wrap; }
    .search-tag {
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        padding: 0 12px;
        font-size: 13px;
        border-radius: 999px;
    }

    .qa-item { padding: 16px; border-radius: 14px; }
    .q-text { font-size: 15.5px; line-height: 1.65; }
    .answer-content p { font-size: 14.5px; line-height: 1.8; }

    .article-card,
    .news-card { border-radius: 14px; overflow: hidden; }
    .article-img,
    .news-img { aspect-ratio: 16 / 9; }
    .article-img img,
    .news-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .article-info,
    .news-info { padding: 14px 16px; }
    .article-info h3,
    .news-info h3 { font-size: 16.5px; line-height: 1.45; }
    .article-info p,
    .news-info p { font-size: 13.5px; line-height: 1.7; }
    .article-tag,
    .news-tag { font-size: 12.5px; }

    /* 提问表单 */
    .ask-form-card { padding: 18px; border-radius: 16px; }
    .ask-form-title { font-size: 16.5px; }
    .ask-form-desc { font-size: 13.5px; }
    /* 原页面用 .ask-form-card .form-group textarea 指定了 15px，优先级更高，这里同步抬到 16px */
    .ask-form-card .form-group textarea { font-size: 16px; min-height: 110px; border-radius: 12px; }
    .ask-form-card textarea { font-size: 16px; min-height: 110px; }
    .ask-form-card .btn { min-height: 48px; font-size: 15.5px; }

    /* ── 7. 文档页 ──────────────────────────────────────────────── */
    .docs-content { padding: 0; }
    .doc-panel h2 { font-size: 21px; margin-bottom: 16px; }
    .doc-block { margin-bottom: 22px; }
    .doc-block h3 { font-size: 16.5px; }
    .doc-block p { font-size: 14.5px; line-height: 1.8; }
    .check-list li {
        font-size: 14.5px;
        line-height: 1.7;
        padding-left: 22px;
        margin-bottom: 8px;
    }
    .process-steps { gap: 10px; }
    .step { padding: 12px 14px; border-radius: 12px; }
    .step-num { width: 28px; height: 28px; font-size: 13px; }
    .step-info h4 { font-size: 15px; }
    .step-info p { font-size: 13.5px; }
    .tools-grid { gap: 10px; }
    .tool-item { padding: 14px; border-radius: 12px; }
    .tool-item strong { font-size: 14.5px; }

    /* 下载卡：单列 + 44px 触控 */
    .downloads-grid { grid-template-columns: 1fr; gap: 10px; }
    .download-card { min-height: 72px; padding: 14px; border-radius: 12px; }
    .download-info h4 { font-size: 14.5px; }
    .download-info p { font-size: 12.5px; }

    /* ── 8. 预约页（转化关键页：表单最好点） ─────────────────────── */
    .appointment-layout,
    .appointment-grid { grid-template-columns: 1fr !important; }
    .appointment-form,
    .form-card { padding: 18px; border-radius: 16px; }

    .form-group { margin-bottom: 16px; }
    .form-group label,
    .form-label { font-size: 14px; margin-bottom: 6px; display: block; }

    /* 16px 以下 input 会让 iOS Safari 聚焦时整页放大，这里钉死 16px */
    .form-group input,
    .form-group select,
    .form-group textarea,
    .appointment-form input,
    .appointment-form select,
    .appointment-form textarea,
    input[type="text"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px;
        min-height: 48px;
        padding: 12px 14px;
        border-radius: 12px;
        width: 100%;
    }
    textarea { min-height: 96px; }
    .appointment-form .btn,
    .form-card .btn,
    .appointment-form button[type="submit"] {
        min-height: 50px;
        font-size: 16px;
        border-radius: 14px;
        margin-top: 6px;
    }

    /* 保障卡 / 提示块 */
    .trust-cards,
    .features-grid,
    .community-grid { grid-template-columns: 1fr; gap: 10px; }

    /* ── 9. 页脚：两列信息 + 安全区 ─────────────────────────────── */
    .site-footer { padding: 32px 0 calc(24px + env(safe-area-inset-bottom)); }
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 20px 16px;
    }
    .footer-brand { grid-column: 1 / -1; }
    .footer-brand h3 { font-size: 17px; }
    .footer-brand p { font-size: 13.5px; }
    .footer-column h4 { font-size: 14px; margin-bottom: 8px; }
    .footer-column a,
    .footer-column p {
        font-size: 13.5px;
        line-height: 1.8;
        display: inline-flex;
        align-items: center;
        min-height: 40px;         /* 拇指可点，不再是 30px 的细条 */
    }

    /* 「查看更多 →」等文字链：给足可点高度 */
    .btn-link {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
        font-size: 14px;
    }
    .footer-bottom { padding-top: 18px; margin-top: 18px; font-size: 12.5px; }

    /* ── 10. 通用收尾 ───────────────────────────────────────────── */
    img { max-width: 100%; height: auto; }
    /* 长英文/链接不撑破容器 */
    p, li, td { overflow-wrap: anywhere; }
    /* 横向表格（如有）可滑动 */
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* 小屏（iPhone SE / 旧安卓 375 及以下）再收一档 */
@media (max-width: 380px) {
    :root { --h5-gutter: 15px; }
    body { font-size: 14.5px; }
    h1 { font-size: 24px; }
    h2 { font-size: 19.5px; }
    .hero h1 { font-size: clamp(25px, 7.8vw, 30px); }
    .hero .tagline { font-size: 14px; }
    .footer-content { grid-template-columns: 1fr; }
    .trust-grid { gap: 6px; }
    .trust-number { font-size: 21px; }
}
