/**
 * Aiiiss 全站移动端 / 窄屏补强（在 style-common.css 之后加载）
 * 断点与 Bootstrap 4 对齐：lg 992 / md 768 / sm 576
 */

@media (max-width: 1199.98px) {
    html {
        -webkit-text-size-adjust: 100%;
    }

    /* 装饰条在窄屏易产生横向溢出 */
    .header:before {
        display: none !important;
    }

    /* 申请演示 / 联系区块内固定宽度图 */
    .section--request-demo .bs-common-image figure,
    .section--contact-details .bs-common-image figure {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto;
        margin-right: auto;
    }

    .section--request-demo .bs-common-image figure img,
    .section--contact-details .bs-common-image figure img {
        width: 100%;
        height: auto;
    }
}

/* 媒体与嵌入：防止撑破视口 */
@media (max-width: 991.98px) {
    main img,
    main video,
    main iframe,
    main embed,
    main .img-fluid {
        max-width: 100%;
        height: auto;
    }

    main .figure,
    main figure {
        max-width: 100%;
    }

    /* 大屏专用列在平板及以下占满（仅 main，勿动 header 侧栏 .header-right.col-xl-*） */
    main .row > [class*="col-lg"],
    main .row > [class*="col-xl"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* flex 子项最小宽度，缓解部分横向溢出 */
    main .row {
        margin-left: -8px;
        margin-right: -8px;
    }

    main .row > [class*="col-"] {
        padding-left: 8px;
        padding-right: 8px;
        min-width: 0;
    }
}

@media (max-width: 767.98px) {
    html {
        overflow-x: hidden;
    }

    body {
        overflow-x: hidden;
    }

    .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    /* md 列在手机上占满（仅 main） */
    main .row > [class*="col-md"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* 内页大标题折行 */
    main h1 {
        font-size: clamp(1.35rem, 5vw, 1.75rem);
        word-break: break-word;
    }

    main h2,
    main h3 {
        word-break: break-word;
    }

    /* 长链接、英文不换行溢出 */
    main a {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* 表格横向滚动阅读 */
    main table {
        display: block;
        width: 100% !important;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* HubSpot：避免 iOS 聚焦输入框自动缩放页面 */
    .bs-column--form-contact .hbspt-form input.hs-input,
    .bs-column--form-contact .hbspt-form textarea.hs-input,
    .bs-column--form-contact .hbspt-form select.hs-input {
        font-size: 16px !important;
    }

    .bs-column--form-contact .hbspt-form .hs_submit input[type="submit"],
    .bs-column--form-contact .hbspt-form .hs-button.primary {
        min-height: 44px;
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    /* 轮播常见溢出 */
    .slick-list,
    .slick-track,
    .slick-slide {
        min-width: 0;
    }
}

@media (max-width: 575.98px) {
    .header-logo img {
        max-height: 44px;
        width: auto;
    }

    /* 页脚备案等窄屏堆叠（与现有规则互补） */
    .footer .row {
        margin-left: -6px;
        margin-right: -6px;
    }
}

/* 申请演示提交结果弹层 */
@media (max-width: 575.98px) {
    #aiiiss-product-service-dialog > div > div {
        max-width: calc(100vw - 24px) !important;
        padding: 16px 18px !important;
    }
}

/* ---------- 第二轮：首页 Banner、内页横幅、Gridder、代码块、安全区 ---------- */

@media (max-width: 767.98px) {
    /* 刘海屏左右安全区 */
    body {
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }

    main .container,
    main .container-fluid {
        max-width: 100%;
    }

    /* 首页主轮播文案区：原 max-width:286px 在超窄机易显得两侧空 uneven，改为视口比例 */
    .section-main-banner .slide-content {
        max-width: min(100%, 92vw) !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box;
    }

    /* 内页顶部横幅背景：保证覆盖且不横向拉伸出缝 */
    .section--inner-banner-with-heading.section--contact,
    .section.section--inner-banner-with-heading {
        background-size: cover !important;
        background-position: center center !important;
    }

    /* Gridder 等内容块 */
    .section--gridder .gridder-wrapper,
    .section--gridder .bs-gridder,
    .gridder-list {
        max-width: 100% !important;
    }

    .section--gridder .gridder-wrapper .bs-gridder .gridder-list {
        min-width: 0 !important;
    }

    pre,
    code {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        word-break: break-word;
    }

    /* 侧栏抽屉内语言/链接更易点 */
    .header-right .navbar-nav > .menu-item > a,
    .header-right .sub-menu .menu-item > a {
        min-height: 44px;
        display: flex !important;
        align-items: center;
    }
}

@media (max-width: 575.98px) {
    /* 视频 / 背景区块内的 iframe */
    main iframe {
        max-width: 100% !important;
    }
}

@media (max-width: 991.98px) {
    /* 语言下拉在侧栏内占满宽度，避免文字截断 */
    .header-language-switcher .aiiiss-ls-legacy-dropdown {
        width: 100% !important;
        max-width: 100%;
    }

    .header-language-switcher .aiiiss-ls-legacy-dropdown .aiiiss-ls-sub-menu {
        max-width: 100%;
    }
}
