/* ============================================================
   响应式样式 - 平板 & 手机端适配
   断点：1024 / 768 / 480
   ============================================================ */

/* ---------- 大屏平板 (≤ 1024px) ---------- */
@media (max-width: 1024px) {
    .container { padding: 0 32px; }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 50px;
        text-align: center;
    }
    .hero-text { order: 2; }
    .hero-visual { order: 1; min-height: 360px; }
    .hero-subtitle { margin-left: auto; margin-right: auto; }
    .hero-actions, .hero-stats { justify-content: center; }
    .hero-tag { display: inline-block; }

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

    .demo-panel {
        grid-template-columns: 1fr;
        gap: 36px;
        padding: 36px 28px;
        text-align: center;
    }
    .demo-info { text-align: left; }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 50px;
    }
    .about-text { text-align: center; }
    .about-text h3 { text-align: center; }

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

/* ---------- 平板/小屏 (≤ 768px) ---------- */
@media (max-width: 768px) {
    :root {
        --header-h: 64px;
    }

    .section { padding: 70px 0; }
    .container { padding: 0 20px; }

    /* 导航：切换为汉堡菜单 */
    .nav-menu {
        position: fixed;
        top: var(--header-h);
        left: 0; right: 0;
        flex-direction: column;
        background: #fff;
        padding: 16px 20px 24px;
        gap: 4px;
        box-shadow: var(--shadow-md);
        border-bottom: 1px solid var(--border);
        transform: translateY(-150%);
        transition: transform .35s cubic-bezier(.4,0,.2,1);
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
    }
    .nav-menu.open { transform: translateY(0); }
    .nav-link {
        width: 100%;
        padding: 14px 16px;
        font-size: 16px;
        border-radius: var(--radius-sm);
    }
    .nav-link.active::after { display: none; }
    .nav-link.active { background: rgba(79,124,255,.1); }
    .menu-toggle { display: flex; }

    /* Hero */
    .hero { min-height: auto; padding-top: calc(var(--header-h) + 40px); }
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 15px; }
    .hero-actions .btn {
        padding: 12px 22px;
        font-size: 14px;
    }
    .hero-stats { gap: 28px; }
    .stat-num { font-size: 28px; }
    .stat-suffix { font-size: 18px; }

    /* Hero 浮动卡片隐藏避免遮挡 */
    .floating-card { display: none; }
    .code-window { transform: none; }

    /* Section 标题缩小 */
    .section-header { margin-bottom: 40px; }
    .section-title { font-size: 1.7rem; }

    /* 服务卡片单列 */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .service-card { padding: 28px 22px; }

    /* Demo */
    .demo-tabs { gap: 6px; }
    .demo-tab {
        padding: 10px 16px;
        font-size: 13px;
    }
    .demo-panel {
        padding: 28px 20px;
    }
    .demo-info h3 { font-size: 20px; }
    .demo-stage { min-height: 380px; }

    /* 关于我们 */
    .about-values {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .about-card-stack { gap: 14px; }
    .about-card { padding: 24px 16px; }
    .ac-num { font-size: 32px; }

    /* 技术栈 */
    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .tech-item { padding: 16px 10px; font-size: 13px; }

    /* 联系区 */
    .contact-wrap {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .contact-form { padding: 28px 22px; }

    /* 页脚 */
    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .footer-links { grid-template-columns: 1fr 1fr; }

    .back-top {
        bottom: 20px; right: 20px;
        width: 44px; height: 44px;
        font-size: 20px;
    }
}

/* ---------- 手机 (≤ 480px) ---------- */
@media (max-width: 480px) {
    .container { padding: 0 16px; }

    .hero { padding-top: calc(var(--header-h) + 24px); }
    .hero-title { font-size: 1.75rem; line-height: 1.25; }
    .hero-tag { font-size: 12px; padding: 6px 12px; }
    .hero-stats {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: space-around;
    }
    .stat-item { min-width: 80px; }
    .stat-num { font-size: 24px; }
    .stat-suffix { font-size: 16px; }

    .section { padding: 56px 0; }
    .section-title { font-size: 1.5rem; }
    .section-desc { font-size: 14px; }

    .demo-tab {
        padding: 9px 14px;
        font-size: 12px;
    }
    .demo-tab .icon { font-size: 16px; }
    .demo-info h3 { font-size: 18px; }
    .demo-highlights li { font-size: 14px; }

    /* 手机端聊天窗口略缩小 */
    .chat-window { height: 420px; }
    .phone-frame { width: 230px; height: 440px; }

    /* 网站预览特征改 2 列 */
    .ws-features { grid-template-columns: 1fr 1fr; }

    .contact-form { padding: 22px 18px; }
    .contact-form h3 { font-size: 18px; }
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 11px 14px;
        font-size: 13px;
    }

    .footer-bottom p { font-size: 12px; }
}

/* ---------- 超小屏 (≤ 360px) ---------- */
@media (max-width: 360px) {
    .hero-title { font-size: 1.55rem; }
    .logo-text { font-size: 17px; }
    .logo-icon { width: 32px; height: 32px; font-size: 17px; }
    .demo-tabs { flex-direction: column; align-items: stretch; }
    .demo-tab { justify-content: center; }
}

/* ---------- 横屏手机适配 ---------- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .hero {
        min-height: auto;
        padding: calc(var(--header-h) + 30px) 0 40px;
    }
    .hero-content { gap: 30px; }
    .hero-visual { min-height: 280px; }
    .code-window { max-width: 360px; margin: 0 auto; }
}

/* ---------- 打印样式 ---------- */
@media print {
    .header, .back-top, .menu-toggle, .hero-bg, .floating-card { display: none; }
    .section { padding: 20px 0; }
    body { color: #000; background: #fff; }
}

/* ---------- 暗色模式偏好（可选支持） ---------- */
@media (prefers-color-scheme: dark) {
    /* 此处保持亮色主题以保证品牌一致性，
       如需暗色可在此覆盖 :root 变量 */
}

/* ---------- 减少动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .floating-card { animation: none; }
}
