/*
 * 移动端适配覆盖样式
 * 仅在 max-width 媒体查询内生效，不影响 PC 端展示
 * 配合 header.html 的汉堡菜单(.nav-toggle)与触屏交互(.nav-open/.submenu-open/.popup-open)
 */

/* ============ 全局基础 ============ */
@media (max-width: 768px) {
    html {
        /* 避免 iOS 横竖屏切换时文本被自动放大 */
        -webkit-text-size-adjust: 100%;
    }

    /* 媒体元素不超出屏幕，防止横向滚动 */
    img, video {
        max-width: 100%;
        height: auto;
    }

    /* 长单词/URL 折行 */
    body {
        word-break: break-word;
    }
}

/* ============ 顶部导航：汉堡菜单 + 抽屉 ============ */
@media (max-width: 768px) {
    /* 移动端改为固定定位，替代 PC 的 absolute+3vh（不遮挡内容且滚动时可见） */
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0;
        background: #b03a30 url("../images/nav-bg.png") no-repeat;
        background-size: cover;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    }

    .header-container {
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        height: 56px;
        padding: 0 12px !important;
    }

    .nav-wrapper {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        flex-wrap: nowrap;
    }

    .logo img {
        height: 44px;
        margin-top: 6px;
    }

    /* 汉堡按钮：仅移动端显示（基础样式在 header.html，PC 端 display:none）
       !important 确保覆盖 header.html body 内联样式中源顺序更靠后的默认隐藏规则 */
    .nav-toggle {
        display: flex !important;
    }

    /* 导航抽屉：默认收起 */
    .nav-wrapper > nav {
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        display: none;
        max-height: calc(100vh - 56px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: rgba(150, 36, 27, .98);
        box-shadow: 0 8px 16px rgba(0, 0, 0, .3);
    }

    .nav-wrapper > nav.nav-open {
        display: block;
    }

    .nav {
        display: block;
        margin-top: 0 !important;
        padding: 8px 0;
    }

    .nav-item {
        margin: 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, .12);
    }

    .nav-link {
        display: block;
        height: 48px;
        line-height: 48px;
        padding: 0 20px;
        font-size: 16px;
    }

    /* 二级菜单：手风琴（覆盖 common.css 中移动端 submenu 常显的规则） */
    .submenu {
        display: none;
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: rgba(0, 0, 0, .18);
        min-width: 0;
        padding: 0;
        margin-top: 0 !important;
        border-bottom: none;
        box-shadow: none;
    }

    .nav-item.submenu-open > .submenu {
        display: block;
    }

    .submenu li a {
        display: block;
        padding: 12px 20px 12px 34px !important;
        font-size: 14px !important;
        color: #fff;
    }

    /* 为固定头部留出空间 */
    body {
        padding-top: 56px;
    }
}

/* PC 端始终隐藏汉堡按钮 */
@media (min-width: 769px) {
    .nav-toggle {
        display: none !important;
    }
}

/* ============ 底部与悬浮模块 ============ */
@media (max-width: 768px) {
    .footer {
        background-size: cover;
        padding-top: 25px;
    }

    .footer-section h3 {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .footer-link,
    .footer-contact {
        font-size: 15px;
    }

    .footer-contact p span {
        font-size: 18px;
    }

    .footer-contact p:last-child::before {
        /* PC 端左侧大图二维码在窄屏隐藏，避免溢出 */
        display: none;
    }

    .footer-bottom {
        display: block;
        padding: 15px 10px;
        font-size: 12px;
    }

    /* 悬浮客服模块：缩小并支持点按弹出（.popup-open 由 JS 切换） */
    .floating-module {
        right: 8px;
        gap: 8px;
    }

    .floating-item {
        padding: 8px;
        min-width: 52px;
    }

    .floating-icon img {
        width: 20px;
        height: 20px;
    }

    .floating-text {
        font-size: 11px;
    }

    .phone-popup,
    .wechat-popup {
        position: fixed;
        right: 70px;
        left: auto;
        top: auto;
        bottom: 90px;
        transform: none;
        margin-right: 0;
        opacity: 0;
        visibility: hidden;
    }

    .phone-popup::after,
    .wechat-popup::after {
        display: none;
    }

    .floating-item.popup-open .phone-popup,
    .floating-item.popup-open .wechat-popup,
    .phone-item.popup-open .phone-popup,
    .wechat-item.popup-open .wechat-popup {
        opacity: 1;
        visibility: visible;
        transform: none;
    }
}

/* ============ 首页(index.css 相关)移动端修正 ============ */
@media (max-width: 768px) {
    /* 内容屏高度自适应（PC 保留 100vh 满屏效果） */
    section:not(.hero-section) {
        height: auto !important;
        min-height: auto;
        padding: 24px 0;
    }

    .brand-content,
    .source-container,
    .responsibility-section,
    .system-section,
    .about-section {
        height: auto !important;
    }

    /* 图文板块：1200px 固定宽改为流式，左右分栏改上下堆叠 */
    .i-about-box {
        width: auto !important;
        max-width: 94%;
        height: auto !important;
        flex-direction: column;
        margin: 20px auto;
    }

    .i-about-l,
    .i-about-r {
        width: 100% !important;
    }

    .i-about-l img,
    .i-about-r img {
        width: 100%;
        height: auto;
        min-height: 0;
    }

    .i-about-r {
        padding: 15px !important;
        min-height: 180px;
    }

    .i-about-r h3 {
        font-size: 1.4em;
        margin: 10px 0 !important;
    }

    .i-about-r p {
        font-size: 1em;
        text-indent: 0 !important;
        padding-left: 0 !important;
        text-align: left;
    }

    /* 水源标注板块：固定 1200px/680px 改为流式 */
    .water-bz {
        width: auto !important;
        max-width: 94%;
        height: auto !important;
        flex-direction: column;
        margin: 20px auto;
    }

    .water-bz-l,
    .water-bz-r,
    .cld-w-l,
    .cld-w-r {
        width: 100% !important;
        height: auto !important;
    }

    /* 首屏视频文案定位 */
    .video-content {
        left: 20px !important;
        right: 20px;
        bottom: 70px !important;
        max-width: none;
        padding: 0;
        height: auto !important;
    }

    .video-title,
    .video-subtitle {
        font-size: 22px;
    }

    .source-content {
        margin-left: 0 !important;
        max-width: 100%;
        padding-bottom: 30px;
    }

    .source-title {
        font-size: 24px;
    }

    /* 视频弹窗全屏化 */
    .video-modal video {
        width: 100%;
        max-width: 100%;
    }

    .modal-close {
        top: 10px;
        right: 15px;
        font-size: 32px;
        /* 扩大点按热区 */
        padding: 5px 10px;
    }

    /* 分页按钮触屏热区 */
    .pages a,
    .pages span,
    .pages strong {
        display: inline-block;
        min-width: 36px;
        padding: 6px 9px;
        margin: 3px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .video-title,
    .video-subtitle {
        font-size: 18px;
    }

    .i-about-r h3 {
        font-size: 1.2em;
    }
}
