/* ===== 响应式：移动优先，逐步增强 ===== */

/* 平板及以上 (≥768px) */
@media (min-width: 768px) {
  :root {
    --space-section: 60px;
  }
}

/* 小桌面 (≥992px) */
@media (min-width: 992px) {
  :root {
    --space-section: 80px;
    --fs-h1: 48px;
  }
}

/* 大桌面 (≥1200px) */
@media (min-width: 1200px) {
  .container { max-width: var(--container-max); }
}

/* ===== 移动端 (<992px) ===== */
@media (max-width: 991px) {
  :root {
    --fs-h1: 32px;
    --fs-h2: 26px;
    --fs-h3: 20px;
    --space-section: 48px;
    --header-height: var(--header-height-mobile);
  }

  /* 汉堡菜单显示 */
  .hamburger { display: flex; }

  /* 导航菜单变抽屉 */
  .nav-menu {
    position: fixed;
    top: var(--header-height-mobile);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #fff;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
    box-shadow: var(--shadow-md);
    z-index: var(--z-header);
  }

  .nav-menu.open { max-height: 400px; }

  .nav-menu a {
    width: 100%;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
  }

  .nav-menu a::after { display: none; }

  /* header actions 简化 */
  .header-actions .btn-primary { display: none; }

  /* Hero */
  .hero-carousel { height: 420px; }
  .hero-content h1 { font-size: 28px; }
  .hero-content p { font-size: 16px; margin-bottom: 24px; }
  .carousel-arrow { width: 40px; height: 40px; font-size: 24px; }

  /* 简介两栏变一栏 */
  .intro-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 32px 16px; }

  /* 网格变两列 */
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }

  /* 页脚变两列 */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-brand { grid-column: 1 / -1; }
}

/* ===== 手机 (<576px) ===== */
@media (max-width: 575px) {
  :root {
    --fs-h1: 26px;
    --fs-h2: 22px;
    --container-padding: 16px;
  }

  .hero-carousel { height: 380px; }
  .hero-content { text-align: center; margin: 0 auto; }

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

  .product-grid,
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .product-card-actions {
    flex-direction: column;
    gap: 8px;
  }

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

  .section-header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .carousel-arrow { display: none; }
  .cta-section { padding: 56px 0; }
  .cta-content .btn { width: 100%; }

  .lang-switch button { padding: 4px 6px; }
  .header-actions { gap: 8px; }
}

/* ===== 表单响应式 ===== */
@media (max-width: 991px) {
  .form-row { grid-template-columns: 1fr !important; }
}

/* ===== 内页响应式 ===== */
@media (max-width: 991px) {
  .product-detail-main { grid-template-columns: 1fr !important; }
  .contact-layout { grid-template-columns: 1fr !important; }
  .about-story { grid-template-columns: 1fr !important; }
}

/* 底部联系条：仅移动端显示，桌面端隐藏 */
.mobile-cta-bar { display: none; }

/* ===== 移动端增强 (<992px) ===== */
@media (max-width: 991px) {
  /* 防止水平溢出 */
  html, body { overflow-x: hidden; }
  img, table, video { max-width: 100%; }

  /* 汉堡菜单遮罩 */
  .nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 90;
  }
  .nav-overlay.show {
    opacity: 1;
    visibility: visible;
  }

  /* 底部固定联系条 */
  .mobile-cta-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 95;
  }
  .mobile-cta-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    min-height: 52px;
    font-size: 11px;
    color: var(--color-text);
    text-decoration: none;
    border-top: 1px solid var(--color-border);
  }
  .mobile-cta-item + .mobile-cta-item {
    border-left: 1px solid var(--color-border);
  }
  .mobile-cta-item svg {
    width: 20px;
    height: 20px;
  }
  .mobile-cta-inquiry {
    background: var(--color-primary);
    color: #fff;
    border-top: none;
  }
  .mobile-cta-inquiry + .mobile-cta-item,
  .mobile-cta-item + .mobile-cta-inquiry {
    border-left: none;
  }

  /* body 留出底部联系条空间 */
  body { padding-bottom: 60px; }
  .site-footer { padding-bottom: 16px; }

  /* 缩略图横向滑动 */
  .product-thumbs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .product-thumbs::-webkit-scrollbar { display: none; }
  .product-thumb { flex-shrink: 0; }

  /* 按钮触摸目标 ≥44px */
  .btn { min-height: 44px; }
  .lang-switch button { min-width: 36px; min-height: 36px; }

  /* 长文本防溢出 */
  .product-card-desc, .footer-contact li {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
}

/* iOS 安全区域适配（全面屏底部） */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-cta-bar { padding-bottom: env(safe-area-inset-bottom); }
}
