/* 响应式设计样式 */

/* 平板设备 */
@media (max-width: 1024px) {
    .hero-container {
        gap: 2rem;
        padding: 0 2rem;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .code-editor {
        max-width: 400px;
    }

    .tech-content {
        gap: 2rem;
    }

    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 移动设备 */
@media (max-width: 768px) {

    /* 导航栏移动端样式 */
    .nav-container {
        padding: 0 1rem;
    }

    .nav-brand {
        font-size: 1.25rem;
    }

    .logo-img {
        width: 32px;
        height: 32px;
    }

    .nav-menu {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background: var(--bg);
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        box-shadow: var(--shadow-lg);
        transform: translateX(-100%);
        transition: var(--transition);
        z-index: 999;
        border-bottom: 1px solid var(--border);
    }

    [data-theme="dark"] .nav-menu {
        background: var(--bg-dark);
        border-bottom-color: var(--border-dark);
    }

    .nav-menu.mobile-open {
        transform: translateX(0);
    }

    .nav-link {
        font-size: 1.125rem;
        padding: 0.75rem 0;
        width: 100%;
        text-align: center;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* 英雄区域移动端样式 */
    .hero {
        min-height: auto;
        padding: 100px 0 60px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
        padding: 0 1.5rem;
    }

    .hero-title {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
        max-width: 100%;
        margin-bottom: 2rem;
    }

    .hero-actions {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .btn-large {
        padding: 1rem 2rem;
        font-size: 1rem;
        width: 100%;
        max-width: 280px;
    }

    .hero-stats {
        justify-content: center;
        gap: 2rem;
        margin-top: 1.5rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    /* 代码编辑器移动端样式 */
    .hero-visual {
        order: -1;
        margin-bottom: 2rem;
    }

    .code-editor {
        max-width: 100%;
        transform: none;
        margin: 0 auto;
    }

    .code-editor:hover {
        transform: scale(1.02);
    }

    .editor-content {
        min-height: 250px;
    }

    .ai-suggestion {
        max-width: 200px;
        padding: 0.75rem;
        font-size: 0.75rem;
    }

    /* 技术部分移动端样式 */
    .tech-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .tech-feature {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .tech-diagram {
        flex-direction: row;
        gap: 0.5rem;
    }

    .diagram-node {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .diagram-arrow {
        font-size: 1.5rem;
    }

    /* 用户评价移动端样式 */
    .testimonials-grid {
        grid-template-columns: 1fr;
    }

    .testimonial-text::before {
        font-size: 3rem;
        top: -1rem;
    }
}

/* 小屏移动设备 */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }

    .stat {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        text-align: left;
    }

    .code-editor {
        font-size: 0.75rem;
    }

    .editor-header {
        padding: 0.75rem 1rem;
    }

    .editor-content {
        min-height: 200px;
    }

    .line-numbers {
        padding: 1rem 0.75rem;
        min-width: 50px;
        font-size: 0.75rem;
    }

    .code-area {
        padding: 1rem;
    }

    .tech-diagram {
        flex-wrap: wrap;
        justify-content: center;
    }

    .diagram-arrow {
        display: none;
    }

    .download-actions {
        grid-template-columns: 1fr;
    }

    .download-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    .testimonial-text::before {
        font-size: 2.5rem;
    }
}

/* 横屏模式 */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 80px 0 40px;
    }

    .hero-container {
        gap: 2rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-actions {
        margin-bottom: 2rem;
    }

    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 0.875rem;
    }

    .code-editor {
        max-width: 350px;
    }
}

/* 触控设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .btn:active {
        transform: scale(0.95);
    }

    .nav-link:hover::after {
        width: 0;
    }

    .nav-link:active::after {
        width: 100%;
    }

    .theme-toggle:hover {
        transform: none;
    }

    .theme-toggle:active {
        transform: scale(0.9);
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    :root {
        --text-muted: #4b5563;
        --border: #9ca3af;
    }

    [data-theme="dark"] {
        --text-muted: #d1d5db;
        --border: #6b7280;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .particles {
        animation: none;
    }

    .particle {
        animation: none !important;
    }
}

/* 打印样式 */
@media print {

    .navbar,
    .hero-actions,
    .theme-toggle,
    .mobile-menu-toggle,
    .back-to-top {
        display: none !important;
    }

    .hero {
        min-height: auto;
        padding: 2rem 0;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .code-editor {
        transform: none;
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* 暗色模式移动端优化 */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .nav-menu {
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(20px);
    }

    .code-editor {
        border-color: var(--border-dark);
    }
}

/* 安全区域适配 (iPhone X 及更新机型) */
@supports (padding-top: env(safe-area-inset-top)) {
    .navbar {
        padding-top: env(safe-area-inset-top);
    }

    .hero {
        padding-top: calc(120px + env(safe-area-inset-top));
    }
}

/* 折叠屏设备适配 */
@media (max-width: 880px) and (min-width: 769px) {
    .hero-container {
        gap: 2rem;
        padding: 0 2rem;
    }

    .hero-title {
        font-size: 2.75rem;
    }

    .code-editor {
        max-width: 450px;
    }
}