/* ========================================================================
 * 阿里淘科技 — 响应式 (媒体查询 / 断点 / 移动端降级)
 * ====================================================================== */

/* ========== 平板 (≤1024px) ========== */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .hero-canvas-wrap {
    max-width: 480px;
    order: -1;
  }

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

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

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

  .ai-panel-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
  }

  .nav-menu {
    gap: 0;
  }

  .nav-link {
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-xs);
  }

  .nav-link span {
    display: none;
  }
}

/* ========== 手机 (≤768px) ========== */
@media (max-width: 768px) {
  :root {
    --fs-3xl: 36px;
    --fs-4xl: 48px;
    --fs-5xl: 64px;
  }

  .container {
    padding: 0 var(--space-4);
  }

  .section {
    padding: clamp(48px, 8vh, 80px) 0;
  }

  /* 导航 — 切换为汉堡菜单 */
  .nav-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(5, 6, 15, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    padding: var(--space-5);
    gap: var(--space-2);
    border-bottom: 1px solid var(--glass-border);
    transform: translateY(-150%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--duration-base) var(--ease-out),
                opacity var(--duration-base);
  }

  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-menu .nav-link {
    padding: var(--space-3);
    font-size: var(--fs-md);
    width: 100%;
    justify-content: flex-start;
  }

  .nav-menu .nav-link span {
    display: inline;
  }

  .nav-cta {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  /* Hero */
  .hero {
    padding-top: 100px;
    text-align: center;
  }

  .hero-eyebrow {
    align-self: center;
  }

  .hero-title {
    justify-content: center;
  }

  .hero-cta {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  .hero-canvas-wrap {
    max-width: 360px;
  }

  /* Metrics */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .metric-card {
    padding: var(--space-4);
  }

  .metric-num {
    font-size: var(--fs-2xl);
  }

  /* AI */
  .ai-tabs-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .ai-tabs-nav::-webkit-scrollbar { display: none; }

  .ai-tab span {
    display: none;
  }

  .ai-tab {
    padding: var(--space-2);
  }

  .ai-chat-wrap {
    height: 380px;
  }

  /* Game */
  .game-stats {
    gap: var(--space-3);
    width: 100%;
    justify-content: space-between;
  }

  .game-header {
    flex-direction: column;
    align-items: stretch;
  }

  .game-controls {
    width: 100%;
    justify-content: center;
  }

  /* Music */
  .music-info {
    flex-direction: column;
    text-align: center;
    gap: var(--space-3);
  }

  .music-art-disc {
    margin: 0 auto;
  }

  .music-controls {
    flex-direction: column;
  }

  .music-mode-switch {
    width: 100%;
    justify-content: space-between;
  }

  .music-mode {
    flex: 1;
    justify-content: center;
  }

  /* Metaverse */
  .meta-stage {
    aspect-ratio: 4/3;
  }

  .meta-tip {
    flex-wrap: wrap;
    justify-content: center;
    width: calc(100% - 24px);
    bottom: 12px;
  }

  /* Products */
  .products-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }

  /* Form */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* 隐藏移动端不适用的元素 */
  .hero-scroll {
    display: none;
  }

  /* 3D 性能降级：隐藏远景特效 */
  .bg-gradient-3 {
    display: none;
  }
}

/* ========== 小屏 (≤480px) ========== */
@media (max-width: 480px) {
  .hero-title {
    font-size: clamp(36px, 12vw, 64px);
  }

  .hero-stats {
    flex-direction: column;
    gap: var(--space-3);
  }

  .hero-stat-divider {
    width: 60%;
    height: 1px;
  }

  .hero-canvas-wrap {
    max-width: 280px;
  }

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

  .music-mode-switch {
    flex-direction: column;
  }

  .music-mode {
    width: 100%;
  }

  .ai-train-overlay {
    flex-direction: column;
    gap: 4px;
  }
}

/* ========== 大屏 (≥1600px) ========== */
@media (min-width: 1600px) {
  .container {
    max-width: 1440px;
  }

  :root {
    --fs-3xl: 56px;
    --fs-4xl: 72px;
    --fs-5xl: 120px;
  }
}

/* ========== 减少动效偏好 ========== */
@media (prefers-reduced-motion: reduce) {
  .hero-title .char,
  .team-avatar,
  .metric-bar-fill,
  .loader-logo,
  .music-art-disc {
    animation: none !important;
  }

  .cursor {
    display: none !important;
  }
}

/* ========== 横屏手机 ========== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 100px 0 40px;
  }
}