/* 移动端响应式样式 */

/* 基础移动端适配 */
@media screen and (max-width: 768px) {
    /* 导航栏移动端适配 */
    .site-header {
        padding: var(--space-md) var(--space-sm);
    }
    
    .header-container {
        flex-wrap: wrap;
        position: relative;
    }
    
    .header-nav {
        width: 100% !important;
        max-height: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.3s ease, opacity 0.3s ease !important;
        opacity: 0 !important;
        visibility: hidden !important;
        order: 3;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--bg-primary) !important;
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-md);
        z-index: 1000;
    }
    
    .header-nav.active {
        max-height: 600px !important;
        overflow: visible !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .nav-list {
        flex-direction: column;
        width: 100%;
        padding: var(--space-md) 0;
    }
    
    .nav-list li {
        width: 100%;
        margin: 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-link {
        display: block;
        padding: var(--space-md);
        width: 100%;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
        padding: var(--space-xs);
        z-index: 1001;
        position: relative;
        pointer-events: auto !important;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-menu-toggle:active {
        opacity: 0.7;
    }
    
    .mobile-menu-toggle span {
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        transition: all 0.3s ease;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Hero区域移动端适配 */
    .hero-section {
        padding: var(--space-xl) var(--space-md);
    }
    
    .hero-container {
        flex-direction: column;
        gap: var(--space-lg);
    }
    
    .hero-content {
        width: 100%;
        text-align: center;
    }
    
    .hero-code-preview {
        width: 100%;
    }
    
    .code-window {
        font-size: 0.75rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    /* 功能区域移动端适配 */
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .feature-card {
        padding: var(--space-md);
    }
    
    /* 下载区域移动端适配 */
    .download-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    /* 文档区域移动端适配 */
    .docs-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    /* 演示页面移动端适配 */
    .demo-layout {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .demo-panel {
        min-height: 300px;
    }
    
    .code-editor {
        min-height: 300px;
    }
    
    .output-panel {
        min-height: 300px;
        font-size: 0.75rem;
    }
    
    .example-tabs {
        flex-wrap: wrap;
    }
    
    .example-tab {
        font-size: 0.75rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    /* 按钮移动端适配 */
    .btn {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.875rem;
    }
    
    .btn-large {
        padding: var(--space-md) var(--space-lg);
        font-size: 1rem;
    }
    
    /* Footer移动端适配 */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
        text-align: center;
    }
    
    .footer-bottom {
        text-align: center;
        font-size: 0.875rem;
    }
    
    /* 通用移动端优化 */
    .section-container {
        padding: var(--space-lg) var(--space-md);
    }
    
    .section-title {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }
    
    h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }
    
    h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }
    
    h3 {
        font-size: clamp(1.25rem, 4vw, 1.5rem);
    }
    
    /* 表格移动端适配 */
    table {
        font-size: 0.875rem;
        display: block;
        overflow-x: auto;
    }
    
    /* 代码块移动端适配 */
    pre, code {
        font-size: 0.75rem;
        overflow-x: auto;
    }
    
    /* 触摸优化 */
    button, a, .btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
}

/* 小屏幕手机适配 */
@media screen and (max-width: 480px) {
    .hero-title {
        font-size: clamp(1.5rem, 8vw, 2rem);
    }
    
    .demo-title {
        font-size: clamp(1.5rem, 8vw, 2rem);
    }
    
    .code-editor {
        min-height: 250px;
    }
    
    .output-panel {
        min-height: 250px;
        font-size: 0.7rem;
    }
    
    .demo-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .demo-btn {
        width: 100%;
    }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-actions .btn {
        width: 100%;
    }
}

/* 横屏适配 */
@media screen and (max-width: 1024px) and (orientation: landscape) {
    .demo-layout {
        grid-template-columns: 1fr 1fr;
    }
    
    .code-editor {
        min-height: 400px;
    }
    
    .output-panel {
        min-height: 400px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增大触摸目标 */
    .nav-link, .btn, button {
        padding: var(--space-md);
    }
    
    /* 禁用hover效果 */
    .btn:hover, .nav-link:hover {
        transform: none;
    }
    
    /* 优化滚动 */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .brand-logo, .doc-icon, .download-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

