/* ============================================================
   移动端 / 平板 响应式适配  —  Coaxwave SMA 专题
   说明：桌面端（>1024px）沿用原 1440px 设计稿，本文件仅在
   平板（≤1024px）与手机（≤640px）断点生效，不会改动桌面布局。
   核心修复：解除 .tq-wrapper 的 transform:scale() 整页缩放，
   改为真正的流式重排，让手机上字号、栅格、导航都正常可读。
   ============================================================ */

/* ---------- 汉堡按钮基础样式（默认隐藏，仅手机显示） ---------- */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* =====================================================
   平板及以下（≤1024px）：解除整页缩放，改为流式布局
   ===================================================== */
@media (max-width: 1024px) {
  :root { --page-padding: 32px; }

  body { min-width: 0; }

  /* 关键：取消缩放，画布改为 100% 宽 */
  .tq-wrapper {
    width: 100% !important;
    transform: none !important;
    padding-top: 64px;
  }

  .header {
    width: 100% !important;
    left: 0 !important;
    transform: none !important;
    padding: 0 24px;
  }

  /* Hero 上下堆叠 */
  .hero {
    flex-direction: column;
    gap: 32px;
    padding: 40px var(--page-padding) 56px;
    min-height: 0;
  }
  .hero h1 { font-size: 44px; }
  .hero .lead { max-width: 100%; }
  .hero-visual { flex: none; width: 100%; height: 260px; object-fit: cover; }
  .hero-actions { flex-wrap: wrap; }

  /* 规格区：图文上下排 */
  .spec-grid { flex-direction: column; gap: 24px; }
  .spec-visual { flex: none; width: 100%; height: 300px; object-fit: cover; }

  /* 对比卡片 1 列 */
  .card-grid { grid-template-columns: 1fr; gap: 24px; }

  /* 产品 / 应用 / 选型 / 文章：2 列 */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .app-grid     { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .guide-grid   { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .article-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }

  /* 宽表横向滚动，避免溢出 */
  .polarity-table,
  .spec-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 页脚堆叠 */
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 24px; }

  /* ---------- 文章页：平板/手机改为单列，移动端隐藏侧栏目录 ---------- */
  .layout { grid-template-columns: 1fr; gap: 30px; padding-top: 90px; }
  .toc { display: none; }   /* 平板/手机不显示侧栏目录，正文单列全宽 */
  .article-body { max-width: 100%; }
  .article-body h1 { font-size: 32px; }
}

/* =====================================================
   手机（≤640px）：单列 + 汉堡抽屉菜单
   ===================================================== */
@media (max-width: 640px) {
  :root { --page-padding: 18px; }

  .tq-wrapper { padding-top: 56px; }
  .header {
    height: 56px;
    min-height: 56px;
    padding: 0 16px;
    justify-content: flex-start;
    gap: 12px;
  }
  .logo svg { width: 44px; }
  .logo span { display: none; }   /* 收起 “· SMA 专题” 副标题，节省空间 */

  h2 { font-size: 22px; margin-bottom: 20px; }
  h3 { font-size: 17px; }
  section { padding: 44px var(--page-padding); }

  .hero { padding: 28px var(--page-padding) 44px; gap: 24px; }
  .hero h1 { font-size: 32px; }
  .hero .lead { font-size: 15px; }
  .hero-visual { height: 200px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }

  .overview p,
  .product-intro,
  .drawing-section p { max-width: 100%; }

  /* 所有卡片网格单列 */
  .product-grid,
  .app-grid,
  .guide-grid,
  .article-grid { grid-template-columns: 1fr; }

  .product-img { height: 200px; object-fit: cover; }
  .card { padding: 22px; }
  .card-visual { height: 180px; }

  /* 规格键值列收窄，避免挤压 */
  .spec-row { grid-template-columns: 110px 1fr; padding: 14px 16px; }

  /* 浮窗按钮靠下、间距收紧 */
  .float-bar { right: 14px; bottom: 76px; gap: 10px; }
  .float-btn { width: 44px; height: 44px; }
  .float-tooltip { right: 52px; }

  footer { padding: 40px var(--page-padding); }
  .footer-motto { font-size: 18px; }

  /* ---------- 文章页：手机端（侧栏目录已隐藏） ---------- */
  .layout { gap: 18px; padding: 76px var(--page-padding) 40px; }
  .article-body h1 { font-size: 26px; line-height: 1.35; margin-bottom: 12px; word-break: normal; overflow-wrap: break-word; }
  .article-body h2 { font-size: 20px; margin: 28px 0 14px; }
  .article-body h3 { font-size: 17px; }
  .article-body p { font-size: 15px; line-height: 1.75; }
  .article-body .meta { font-size: 12px; margin-bottom: 18px; }

  /* 图片统一限宽，杜绝横向溢出 */
  img { max-width: 100%; height: auto; }

  /* 微信联系弹窗在小屏不溢出 */
  .wechat-modal { width: 90vw; max-width: 340px; padding: 22px; }
  .wechat-modal img { width: 170px; }

  /* ---------- 汉堡菜单 ---------- */
  .nav-toggle { display: flex; margin-left: auto; }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px 16px;
    max-height: 82vh;
    overflow-y: auto;
    box-shadow: 0 16px 32px rgba(0,0,0,.5);
  }
  .header.nav-open .nav { display: flex; }

  .nav a {
    padding: 13px 4px;
    font-size: 15px;
    line-height: 1.4;
    border-bottom: 1px solid var(--border);
    white-space: normal;
  }
  .nav a:last-child { border-bottom: none; }

  /* 若某些页面导航含下拉，手机上改为常驻展开的子列表 */
  .nav-dropdown { position: static; }
  .nav-trigger { padding: 13px 4px; border-bottom: 1px solid var(--border); }
  .nav-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    margin: 0;
    padding: 0 0 10px 10px;
    min-width: 0;
    max-height: none;
  }
  .nav-menu a { white-space: normal; padding: 9px 4px; border-bottom: 1px solid var(--border); }
  .nav-menu a:last-child { border-bottom: none; }
}
