/* 移动端整体缩放方案 */

/* 桌面端隐藏移动端菜单 */
@media (min-width: 769px) {
    .mobile-menu-toggle,
    .mobile-menu,
    .mobile-overlay {
        display: none !important;
    }
}

/* 基础缩放设置（已改为只做基础优化，不再整体缩放页面，避免移动端各种显示问题） */
@media (max-width: 768px) {
    /* 不再对 html/body 做整体缩放，只保留基础触摸/滚动优化 */
    html {
        transform: none;
        width: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    body {
        width: 100%;
        height: auto;
        overflow-x: hidden;
    }
    
    /* 确保所有内容盒模型正常 */
    * {
        box-sizing: border-box;
    }
    
    /* 调整viewport以适应缩放 */
    /* 优化触摸体验 */
    .mobile-menu-toggle,
    .mobile-menu,
    .mobile-overlay {
        transform: none;
        transform-origin: top right;
    }
    
    /* 确保移动端菜单在正确位置 */
    .mobile-menu-toggle {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1001;
    }
    
    .mobile-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        height: 100vh;
        z-index: 1000;
    }
    
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 999;
    }
}

/* 小屏幕设备优化（不再额外缩放，只做必要调整） */
@media (max-width: 480px) {
    html {
        transform: none;
        width: 100%;
        height: auto;
    }
    
    body {
        width: 100%;
        height: auto;
    }
    
    /* 移动端菜单进一步调整 */
    .mobile-menu-toggle,
    .mobile-menu,
    .mobile-overlay {
        transform: none;
    }
}

/* 超小屏幕设备优化 */
@media (max-width: 360px) {
    html {
        transform: none;
        width: 100%;
        height: auto;
    }
    
    body {
        width: 100%;
        height: auto;
    }
    
    /* 移动端菜单调整 */
    .mobile-menu-toggle,
    .mobile-menu,
    .mobile-overlay {
        transform: none;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    html {
        transform: none;
        width: 100%;
        height: auto;
    }
    
    body {
        width: 100%;
        height: auto;
    }
    
    .mobile-menu-toggle,
    .mobile-menu,
    .mobile-overlay {
        transform: none;
    }
}

/* 确保滚动条可见 */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    ::-webkit-scrollbar-track {
        background: rgba(0,0,0,0.1);
    }
    
    ::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.3);
        border-radius: 4px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: rgba(0,0,0,0.5);
    }
}

/* 防止双击缩放 */
@media (max-width: 768px) {
    * {
        touch-action: manipulation;
    }
    
    html {
        -webkit-text-size-adjust: none;
        -ms-text-size-adjust: none;
        text-size-adjust: none;
    }
}

/* 优化触摸目标 */
@media (max-width: 768px) {
    a, button, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 确保链接和按钮足够大 */
    .menu a,
    .dropdown a,
    .quick-link a {
        padding: 12px 16px;
        display: inline-block;
        min-height: 44px;
        line-height: 20px;
    }
}

/* 确保全屏页面正确显示 */
@media (max-width: 768px) {
    .page-cover {
        height: 100vh;
        width: 100vw;
    }
    
    .page-main {
        width: 100%;
    }
    
    .section {
        width: 100%;
        min-height: 100vh;
    }
    
    /* 优化主页内容显示 */
    .page-home .content {
        padding: 20px;
        text-align: center;
    }
    
    .page-home .header {
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .page-home .header h2 {
        font-size: 18px;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .page-home .header h3 {
        font-size: 16px;
        line-height: 1.4;
    }
    
    .page-home .header h4 {
        font-size: 14px;
        line-height: 1.4;
    }
    
    /* 优化时钟显示 */
    .clock .elem-bottom {
        font-size: 14px;
        line-height: 1.5;
        word-wrap: break-word;
        white-space: normal;
    }
}

/* 修复可能的布局问题 */
@media (max-width: 768px) {
    /* 确保固定定位元素正确显示 */
    .header-top {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }
    
    /* 确保内容不被头部遮挡 */
    .page-main {
        margin-top: 56px;
    }
    
    /* 优化快速导航 */
    .quick-link {
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 50;
    }
}
