/**
 * 言宸洁净 — 共享响应式样式
 * 统一断点: sm=640px, md=768px, lg=1024px, xl=1280px
 * 移动优先：基础样式 = 手机端，通过 min-width 逐级增强
 */

/* ============================================================
   1. 基础防溢出
   ============================================================ */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* 防止表格溢出 */
table {
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

/* ============================================================
   2. 触摸目标增强 (平板及以下)
   ============================================================ */
@media (max-width: 1023px) {
  a, button, [role="button"],
  .hamburger {
    min-height: 44px;
    min-width: 44px;
  }
  /* 但不要撑大内联链接 */
  p a, span a, li a, .inline-link {
    min-height: auto;
    min-width: auto;
  }
}

/* ============================================================
   3. 移动端字号底线 (手机)
   ============================================================ */
@media (max-width: 639px) {
  body {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
  }

  /* 强制提升过小的字号 */
  .text-\[9px\], .text-\[10px\] {
    font-size: 11px !important;
  }
  .text-\[11px\] {
    font-size: 12px !important;
  }

  /* 移动端段落行高提升可读性 */
  p, li {
    line-height: 1.6;
  }
}

/* ============================================================
   4. 移动端菜单动画 (统一，页面内可移除重复定义)
   ============================================================ */
.mobile-menu {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}
.hamburger-line {
  transition: all 0.3s ease;
}
.hamburger.open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
}
.hamburger.open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   5. 平板端通用网格辅助 (640-1023px)
   Tailwind 缺少 md 断点的自定义列数，这里补充
   ============================================================ */
@media (min-width: 640px) and (max-width: 1023px) {
  /* 用于 about.html 的 team-grid / certs / 资质 */
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  /* 用于 contact.html 的 summary-grid / reference-grid */
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ============================================================
   6. 平板端导航适配 (640-1023px)
   修复 industry-solutions.html 等页面 hamburger 被隐藏的问题
   ============================================================ */
@media (min-width: 640px) and (max-width: 1023px) {
  /* 确保汉堡菜单可见（覆盖 about.html 中 .brandbar .hamburger{display:none}） */
  .hamburger {
    display: flex !important;
  }

  /* 桌面导航链接在平板端隐藏，用汉堡菜单代替 */
  .nav-links {
    display: none !important;
  }

  /* CTA 按钮平板端隐藏 */
  .brandbar .cta {
    display: none !important;
  }

  /* 平板品牌栏高度 */
  .brandbar {
    height: auto !important;
    min-height: 64px !important;
    padding: 12px 0 !important;
  }
}

/* ============================================================
   7. Hero / Banner 区域响应式修复
   ============================================================ */
/* 移动端 hero 图片不遮盖文字 */
@media (max-width: 639px) {
  .hero {
    min-height: auto !important;
  }

  .hero-image {
    position: relative !important;
    inset: auto !important;
    height: 200px !important;
    width: 100% !important;
    opacity: 0.85 !important;
  }

  .hero-copy {
    width: 100% !important;
    padding-top: 24px !important;
    padding-bottom: 24px !important;
    min-height: auto !important;
  }

  .hero h1 {
    font-size: 28px !important;
    line-height: 1.3 !important;
  }

  .hero-fade {
    background: linear-gradient(180deg, #f5f5f3 0%, rgba(245, 245, 243, 0.3) 100%) !important;
  }

  /* 面包屑 */
  .hero-copy .text-\[11px\] {
    font-size: 12px !important;
  }
}

/* 平板端 hero 调整 */
@media (min-width: 640px) and (max-width: 1023px) {
  .hero h1 {
    font-size: 34px !important;
  }

  .hero-copy {
    width: 50% !important;
  }

  .hero-image {
    width: 55% !important;
  }
}

/* ============================================================
   8. 首页 Banner 移动端修复
   ============================================================ */
@media (max-width: 639px) {
  /* 首页 banner swiper 区给明确高度 */
  .banner-swiper {
    min-height: 200px;
  }

  /* banner 文字改善可读性 */
  #bannerTitle {
    font-size: 22px !important;
  }

  #bannerSubtitle {
    font-size: 13px !important;
  }

}

/* ============================================================
   9. 关于我们页面专项修复
   ============================================================ */
/* 时间线 5 项在 2 列时最后一项居中 */
@media (max-width: 639px) {
  .timeline {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 18px !important;
  }
  .timeline .line {
    display: none !important;
  }
}

/* 简介区图片移动端给高度 */
@media (max-width: 639px) {
  .about-grid > div.min-h-\[178px\] {
    min-height: 180px !important;
  }
}

/* 经营理念 3 列 → 平板 2 列 → 移动端 1 列 */
@media (max-width: 639px) {
  .values {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   10. 核心业务页专项修复
   ============================================================ */
/* 业务行移动端：文字在上、图片在下（紧凑） */
@media (max-width: 639px) {
  .business-row {
    grid-template-columns: 1fr !important;
  }
  .business-row > div:not(.photo) {
    order: -1 !important;
  }
}

/* 数据指标移动端 2 列 */
@media (max-width: 639px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
}

/* ============================================================
   11. 联系页专项修复
   ============================================================ */
/* 表单输入响应式 */
@media (max-width: 639px) {
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* 固定宽度的搜索/输入框 */
  input[style*="width"],
  .search {
    width: 100% !important;
  }
}

/* 步骤指示器 */
@media (max-width: 639px) {
  .step-line {
    display: none !important;
  }
}

/* 底部信任栏 */
@media (max-width: 639px) {
  .trust-bar {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   12. Footer 统一响应式
   覆盖各页面自定义 .footer-grid 的不一致问题
   ============================================================ */
@media (max-width: 639px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .footer-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
  }
}

/* ============================================================
   13. 通用内边距/间距优化
   ============================================================ */
@media (max-width: 639px) {
  /* shell 容器移动端内边距 */
  .shell {
    margin-left: 16px !important;
    margin-right: 16px !important;
  }

  /* section 间距收紧 */
  section {
    padding-top: 24px !important;
    padding-bottom: 24px !important;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .shell {
    margin-left: 24px !important;
    margin-right: 24px !important;
  }
}

/* ============================================================
   14. 分页溢出处理
   ============================================================ */
@media (max-width: 639px) {
  .pagination {
    justify-content: flex-start !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
}

/* ============================================================
   15. 行业方案页修复
   ============================================================ */
/* industry-solutions 的特征列表平板端 2 列 */
@media (min-width: 640px) and (max-width: 1023px) {
  .feature-list {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ============================================================
   16. 知识库页侧边栏替代方案
   移动端侧边栏隐藏后，添加一个简单的分类下拉（如页面有）
   ============================================================ */
@media (max-width: 639px) {
  .sidebar {
    display: none !important;
  }
}
