/* 移动端适配 - 全站公共样式，覆盖各页面内联样式 */

/* ========== 全局防溢出 ========== */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* ========== 汉堡按钮（默认隐藏） ========== */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #333;
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ========== 平板 / 手机 (≤768px) ========== */
@media (max-width: 768px) {
  header {
    position: sticky !important;
    top: 0;
  }

  /* 头部：Logo + 汉堡按钮 + 折叠导航 */
  .header-inner {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-areas: "logo toggle" "nav nav";
    height: auto !important;
    padding: 10px 0 !important;
    gap: 0 !important;
    align-items: center;
    flex-direction: unset !important;
  }

  .logo {
    grid-area: logo;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
  }

  .logo img {
    height: 40px;
  }

  .logo-slogan {
    white-space: normal !important;
    font-size: 12px;
    border-left: none !important;
    padding-left: 0 !important;
    line-height: 1.35;
    flex: 1 1 auto;
    min-width: 0;
  }

  .nav-toggle {
    grid-area: toggle;
    display: flex;
  }

  header nav {
    grid-area: nav;
    display: none;
    width: 100%;
  }

  header nav.is-open {
    display: block;
    border-top: 1px solid #eee;
    margin-top: 12px;
    padding-top: 8px;
  }

  nav ul {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100%;
  }

  nav ul li {
    margin: 0 !important;
    border-bottom: 1px solid #f0f0f0;
  }

  nav ul li:last-child {
    border-bottom: none;
  }

  nav ul li > a {
    padding: 12px 8px !important;
    font-size: 15px;
  }

  nav ul li .submenu {
    position: static !important;
    width: 100% !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin-top: 0 !important;
    padding: 0 0 8px !important;
    background: #f8f9fa !important;
  }

  nav ul li .submenu li a {
    padding: 10px 16px !important;
    font-size: 14px;
  }

  /* 取消桌面 hover 展开子菜单 */
  nav ul li:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  /* ========== 消除 min-width 导致的横向滚动 ========== */
  .overview-text,
  .overview-img,
  .deployment-text,
  .deployment-img,
  .farm-text,
  .farm-video {
    min-width: 0 !important;
    width: 100%;
    max-width: 100%;
  }

  /* Grid 单列化 */
  .features-grid,
  .cases-grid,
  .news-list,
  .charts-container,
  .dashboard-grid,
  .product-list,
  .indicators-grid,
  .scenarios-grid,
  .stats-grid,
  .values-grid,
  .mission-wrapper,
  .culture-mission .mission-wrapper {
    grid-template-columns: 1fr !important;
  }

  .farm-features {
    grid-template-columns: 1fr !important;
  }

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

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

  .overview-content,
  .deployment-content,
  .farm-content,
  .about-inner,
  .contact-inner {
    flex-direction: column !important;
  }

  /* 表格横向滚动 */
  .specs-table,
  .advantage-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* 区块间距与字号 */
  .section {
    padding: 50px 0;
  }

  .section-title {
    font-size: 26px;
    margin-bottom: 40px;
  }

  .banner h1 {
    font-size: 28px;
  }

  .banner p {
    font-size: 16px;
  }

  .product-title,
  .cases-title,
  .achievements-title,
  .history-title {
    font-size: 28px;
  }

  .product-subtitle,
  .cases-subtitle,
  .achievements-subtitle {
    font-size: 15px;
  }

  /* 底部 */
  footer {
    padding: 40px 0 20px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 30px !important;
  }

  .footer-nav {
    gap: 24px !important;
    flex-wrap: wrap;
  }

  .footer-contact {
    text-align: left;
  }

  .footer-hotline {
    justify-content: flex-start;
  }

  /* 企业文化 Banner - 修复 iOS fixed 背景问题 */
  .culture-banner {
    background-attachment: scroll !important;
    margin-top: 0 !important;
    height: auto !important;
    min-height: 260px;
    padding: 50px 16px;
  }

  .culture-banner h1 {
    font-size: 32px;
  }

  .culture-banner p {
    font-size: 16px;
  }

  /* 发展历程时间轴 */
  .history-section {
    padding-top: 40px;
  }

  /* 监测页图表高度 */
  .chart-box {
    height: 250px;
  }

  /* 定制流程 */
  .process-steps::before {
    display: none;
  }

  .process-step {
    max-width: 100%;
    min-width: 0 !important;
    flex: 1 1 100%;
    margin-bottom: 20px;
  }

  /* 案例筛选标签 */
  .filter-tags {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ========== 小屏手机 (≤480px) ========== */
@media (max-width: 480px) {
  .container {
    width: 92%;
  }

  .section {
    padding: 40px 0;
  }

  .section-title {
    font-size: 22px;
    margin-bottom: 30px;
  }

  .banner {
    height: auto;
    min-height: 70vh;
    padding: 80px 0 60px;
  }

  .banner h1 {
    font-size: 24px;
  }

  .logo-slogan {
    font-size: 11px;
  }

  .advantage-grid,
  .idea-grid {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .stats-number,
  .data-number {
    font-size: 32px;
  }

  .culture-banner h1 {
    font-size: 26px;
  }

  .cases-title {
    font-size: 28px;
  }

  .modal-header {
    height: 180px;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-title {
    font-size: 20px;
  }
}
