/* ===================== 整站 H5 手机模板 =====================
   桌面端不启用抽屉/底栏；≤920px 进入手机站体验。 */

.h5-mask,
.h5-drawer,
.h5-tabbar { display: none; }

@media (max-width: 920px) {
    :root { --header-h: 56px; --h5-tab: 56px; }

    html, body { max-width: 100%; overflow-x: hidden; }
    .frontend-body {
        padding-bottom: calc(var(--h5-tab) + env(safe-area-inset-bottom, 0px));
        -webkit-tap-highlight-color: rgba(8, 49, 203, .12);
    }
    .frontend-body.h5-nav-open { overflow: hidden; }

    .container { padding-left: 16px; padding-right: 16px; }
    .page-wrap { padding: 16px 16px 28px; }

    /* --- 顶栏 / 头部 --- */
    .site-topbar { display: none; }
    .site-header { background: var(--bg-card); }
    .header-inner { height: var(--header-h); gap: 10px; }
    .site-logo { gap: 8px; min-width: 0; }
    .header-inner .site-logo:has(.logo-img) .logo-copy { display: none; }
    .site-logo .logo-img { height: 32px; max-width: 120px; }
    .site-logo .logo-mark { width: 32px; height: 32px; border-radius: 8px; font-size: 11px; }
    .logo-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42vw; }
    .logo-sub { display: none; }
    .site-nav, .site-search, .header-cta { display: none !important; }
    .theme-toggle { width: 36px; height: 36px; font-size: 14px; }
    .nav-toggle { display: flex; width: 40px; height: 40px; align-items: center; justify-content: center; }
    .nav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .nav-toggle.is-open span:nth-child(2) { opacity: 0; }
    .nav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
    .nav-toggle span { transition: .2s; }

    /* --- 抽屉 --- */
    .h5-mask {
        display: block;
        position: fixed; inset: 0; z-index: 200;
        background: rgba(6, 16, 44, .46);
        opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    .h5-nav-open .h5-mask { opacity: 1; pointer-events: auto; }
    .h5-drawer {
        display: flex; flex-direction: column;
        position: fixed; top: 0; right: 0; bottom: 0; z-index: 210;
        width: min(86vw, 360px);
        background: var(--bg-card); color: var(--text);
        transform: translateX(104%);
        transition: transform .28s ease;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
        box-shadow: -12px 0 40px rgba(6, 16, 44, .18);
    }
    .h5-drawer.is-open { transform: none; }
    .h5-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
    .h5-drawer-close {
        width: 36px; height: 36px; border: 0; border-radius: 50%;
        background: var(--bg-subtle); color: var(--text); font-size: 22px; cursor: pointer;
    }
    .h5-search { display: flex; gap: 8px; margin-bottom: 14px; }
    .h5-search input {
        flex: 1; height: 40px; border: 1px solid var(--border); border-radius: 999px;
        padding: 0 14px; background: var(--bg); color: var(--text); font-size: 16px;
    }
    .h5-search button {
        height: 40px; padding: 0 14px; border: 0; border-radius: 999px;
        background: var(--primary-grad); color: #fff; font-weight: 700; font-size: 13px;
    }
    .h5-menu { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding-bottom: 12px; }
    .h5-menu > a, .h5-acc > summary {
        display: flex; align-items: center; justify-content: space-between;
        min-height: 44px; padding: 10px 12px; border-radius: 12px;
        color: var(--text); font-size: 15px; font-weight: 650;
    }
    .h5-menu > a.is-active, .h5-acc-list a.is-active { color: var(--primary); background: var(--primary-soft); }
    .h5-menu > a em {
        min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
        background: var(--primary); color: #fff; font-size: 11px; font-style: normal;
        display: inline-flex; align-items: center; justify-content: center;
    }
    .h5-acc { margin: 2px 0; }
    .h5-acc summary { list-style: none; cursor: pointer; }
    .h5-acc summary::-webkit-details-marker { display: none; }
    .h5-acc summary::after { content: '›'; font-size: 18px; color: var(--text-muted); transform: rotate(90deg); }
    .h5-acc[open] summary::after { transform: rotate(-90deg); }
    .h5-acc-list { display: flex; flex-direction: column; padding: 0 0 8px 10px; }
    .h5-acc-list a {
        min-height: 40px; padding: 8px 12px; border-radius: 10px;
        color: var(--text-2); font-size: 14px;
    }
    .h5-drawer-foot { padding-top: 12px; border-top: 1px solid var(--border); }
    .h5-tel { display: block; margin-bottom: 10px; font-size: 13px; color: var(--text-2); text-align: center; }

    /* --- 底部 Tab --- */
    .h5-tabbar {
        display: grid; grid-template-columns: repeat(4, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
        height: calc(var(--h5-tab) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: color-mix(in srgb, var(--bg-card) 92%, transparent);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
    }
    .h5-tab {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 2px; color: var(--text-muted) !important; font-size: 11px; font-weight: 600;
        position: relative;
    }
    .h5-tab i { font-size: 18px; font-style: normal; line-height: 1; }
    .h5-tab.is-active { color: var(--primary) !important; }
    .h5-tab em {
        position: absolute; top: 4px; right: 22%;
        min-width: 14px; height: 14px; padding: 0 3px; border-radius: 99px;
        background: #e4393c; color: #fff; font-size: 10px; font-style: normal;
        display: inline-flex; align-items: center; justify-content: center;
    }

    /* --- 首页 --- */
    .home-hero { height: auto; min-height: 0; max-height: none; }
    .home-hero-slide { position: relative; inset: auto; min-height: 320px; display: none; }
    .home-hero-slide.is-active { display: flex; }
    .home-hero-copy { padding: 32px 16px 20px; }
    .home-hero-copy h1 { font-size: 24px; }
    .home-hero-desc { font-size: 14px; -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
    .home-hero-actions { gap: 8px; }
    .home-hero-actions .btn-primary,
    .home-hero-actions .btn-ghost { padding: 10px 14px; font-size: 13px; }
    .hero-metrics { position: relative; background: rgba(6, 16, 44, .94); }
    .hero-metrics-inner { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px 16px 16px; }
    .hero-metrics-inner b { font-size: 20px; }
    .hero-scroll { display: none; }
    .home-hero-dots {
        position: absolute; left: 0; right: 0; bottom: 12px;
        flex-direction: row; transform: none; justify-content: center; gap: 6px;
        z-index: 3;
    }
    .home-sec { padding: 48px 0; }
    .sec-head h2 { font-size: 24px; }
    .svc-card, .sol-card, .case-card { border-radius: 16px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-card img { height: 132px; }
    .product-card .title { font-size: 13px; height: auto; max-height: 40px; }
    .product-card .price { font-size: 15px; }

    /* --- 内页头 --- */
    .page-hero { padding: 36px 0 28px; }
    .page-hero--slim { padding: 28px 0 22px; }
    .page-hero h1, .page-hero-cat { font-size: 22px; }
    .page-hero-desc { font-size: 13px; }
    .breadcrumb { font-size: 12px; }
    .article-detail, .page-detail, .panel-card { padding: 18px; border-radius: 16px; }
    .article-detail .detail-title { font-size: 22px; }
    .article-content { font-size: 16px; }
    .article-pager { flex-direction: column; }

    /* --- 商城详情 --- */
    .mall-pd { padding: 12px; border-radius: 16px; }
    .mall-pd__stage { aspect-ratio: 1 / 1; border-radius: 12px; }
    .mall-pd__title { font-size: 20px; }
    .mall-pd__num { font-size: 28px; }
    .mall-pd__actions {
        position: fixed; left: 0; right: 0; z-index: 90;
        bottom: calc(var(--h5-tab) + env(safe-area-inset-bottom, 0px));
        display: grid; grid-template-columns: 1fr 1fr;
        gap: 8px; padding: 10px 12px;
        background: var(--bg-card); border-top: 1px solid var(--border);
        box-shadow: 0 -8px 24px rgba(15, 30, 60, .08);
    }
    .mall-pd__actions .btn-demo { grid-column: 1 / -1; }
    .mall-pd__actions .btn-cart, .mall-pd__actions .btn-buy,
    .mall-pd__actions .btn-primary, .mall-pd__actions .btn-default {
        width: 100%; min-height: 44px; justify-content: center;
    }
    .is-shop .page-wrap { padding-bottom: 88px; }
    .mall-pd__inquiry { display: block; margin: 8px 0 12px; }

    /* --- 会员 --- */
    .member-layout {
        display: flex; flex-direction: column;
        gap: 12px; margin: 12px auto 24px;
    }
    .member-side {
        display: flex; flex-wrap: nowrap; overflow-x: auto;
        -webkit-overflow-scrolling: touch; gap: 6px;
        padding: 10px; position: sticky; top: var(--header-h); z-index: 40;
        scrollbar-width: none;
    }
    .member-side::-webkit-scrollbar { display: none; }
    .member-side-head, .member-side-group { display: none; }
    .member-side a {
        flex: 0 0 auto; margin: 0; white-space: nowrap;
        padding: 8px 14px; font-size: 13px;
    }
    .member-main h1 { font-size: 20px; }
    .member-page-head { flex-direction: column; align-items: stretch; gap: 12px; }
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .member-shortcuts { grid-template-columns: repeat(2, 1fr) !important; }
    .member-table-wrap { margin: 0 -6px; padding-bottom: 4px; }
    .member-table { min-width: 640px; }

    /* --- 表格卡片化：购物车 --- */
    .cart-table thead { display: none; }
    .cart-table, .cart-table tbody { display: block; width: 100%; }
    .cart-table tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 6px 10px;
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
    }
    .cart-table td { border: 0; padding: 0; }
    .cart-table td:nth-child(1) { grid-column: 1 / -1; }
    .cart-foot {
        position: sticky; bottom: calc(var(--h5-tab) + env(safe-area-inset-bottom, 0px));
        background: var(--bg-card); padding: 12px 0 8px; z-index: 30;
    }

    /* --- 订单 / 支付 / 地址 --- */
    .order-detail-wrap { padding: 16px; }
    .order-card-head, .order-preview { flex-wrap: wrap; gap: 8px; }
    .order-line { flex-wrap: wrap; }
    .pay-methods { flex-direction: column; }
    .pay-methods a { width: 100%; min-height: 44px; }
    .address-item { padding: 12px; }

    /* --- 登录注册 --- */
    .auth-page { padding: 12px 12px 24px; }
    .auth-shell { border-radius: 18px; }
    .auth-brand { padding: 22px 20px 24px; }
    .auth-brand h1 { font-size: 24px; }
    .auth-panel { padding: 22px 18px 28px; }
    .auth-form input, .form-control, .qty-input, textarea.form-control {
        font-size: 16px; min-height: 44px;
    }
    .btn-primary, .btn-default, .btn-danger { min-height: 44px; }

    /* --- 论坛 --- */
    .forum-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .forum-board { padding: 14px; }
    .inquiry-grid, .contact-grid, .contact-page { grid-template-columns: 1fr; }

    /* --- 页脚 --- */
    .site-footer { margin-bottom: 0; }
    .footer-cta { padding: 0; }
    .footer-cta-inner { padding: 24px 0; }
    .footer-cta h2 { font-size: 18px; }
    .footer-main { padding-bottom: 8px; }
    .footer-cols { gap: 22px; padding-top: 28px; }
    .is-index .footer-cta { display: none; }

    /* --- 客服 / Toast / 弹窗 --- */
    .kf-widget {
        right: 12px;
        bottom: calc(var(--h5-tab) + 12px + env(safe-area-inset-bottom, 0px));
    }
    .kf-fab-txt { display: none; }
    .kf-fab { width: 48px; height: 48px; padding: 0; justify-content: center; }
    .kf-panel {
        width: min(360px, calc(100vw - 24px));
        right: 0; max-height: min(70vh, 520px); overflow: auto;
    }
    .app-toast { bottom: calc(var(--h5-tab) + 18px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); }
    .site-dialog-card { width: calc(100vw - 28px); max-height: 80vh; overflow: auto; }
    .contact-dialog-grid { grid-template-columns: 1fr; }

    /* 搜索 / 分页 */
    .search-box-wrap { flex-direction: column; }
    .search-box-wrap input { font-size: 16px; min-height: 44px; }
    .pagination a, .pagination span { min-width: 34px; height: 34px; }
}

@media (max-width: 560px) {
    .product-grid { grid-template-columns: 1fr 1fr; }
    .article-grid { grid-template-columns: 1fr; }
    .hero-metrics-inner div { padding-left: 12px; }
}

@media print {
    .h5-tabbar, .h5-drawer, .h5-mask, .nav-toggle { display: none !important; }
    .frontend-body { padding-bottom: 0 !important; }
}
