/**
 * 花更好® 全站手机适配（后加载，优先级高于主题层）
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body.site-page {
  overflow-x: clip;
  max-width: 100vw;
}

img,
video,
iframe,
table {
  max-width: 100%;
  height: auto;
}

/* ═══ ≤992px：平板过渡 ═══ */
@media (max-width: 992px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .dual-city {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  .package-grid,
  .package-grid-compact,
  .feature-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .city-box {
    padding: 20px 18px !important;
  }
}

/* ═══ ≤900px：手机主断点 ═══ */
@media (max-width: 900px) {
  /* —— 首页 / 内页：顶栏高度变量 —— */
  body.page-home,
  body.site-page:has(.site-main.home-page) {
    --home-nav-stack: 96px !important;
  }

  body.site-page:not(.page-home) {
    --page-nav-stack: 96px !important;
    --page-crumb-stack: 28px !important;
  }

  /* 顶栏 */
  .site-topbar {
    font-size: 0.66rem !important;
    padding: 5px 12px !important;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 头部单行 */
  .header-inner {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 8px !important;
    padding: 8px 12px !important;
  }

  .logo {
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    min-width: 0;
    flex-shrink: 1;
  }

  .logo-brand {
    max-width: min(140px, 36vw) !important;
    height: 34px !important;
  }

  .header-cta {
    width: auto !important;
    order: 2;
    margin-left: auto;
    flex-shrink: 0;
  }

  .btn-phone {
    padding: 6px 10px !important;
    font-size: 0.72rem !important;
  }

  .nav-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    order: 3;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    margin-left: 0 !important;
    border-radius: 12px;
    border: 1px solid rgba(212, 168, 67, 0.4) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    font-size: 1.1rem;
    flex-shrink: 0;
  }

  /* 手机端导航改为实色底，避免叠在 Banner 上发虚 */
  body.page-home .site-header,
  .site-header:has(+ .site-main.home-page),
  body.site-page:not(.page-home) .site-header {
    overflow: visible !important;
    background: rgba(6, 26, 18, 0.97) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(212, 168, 67, 0.18) !important;
  }

  .site-header::after {
    display: none !important;
  }

  .nav-wrap {
    display: none;
    order: 4 !important;
    width: 100% !important;
    margin-top: 8px;
    padding: 12px !important;
    border-radius: 16px;
    background: rgba(8, 30, 22, 0.99);
    border: 1px solid rgba(212, 168, 67, 0.25);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
    max-height: min(70vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-wrap.open {
    display: block !important;
  }

  .branch-switch {
    display: flex;
    gap: 8px;
    margin: 0 0 10px;
    padding: 0 0 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .branch-link {
    flex: 1;
    text-align: center;
    padding: 9px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
  }

  .branch-link.branch-cq {
    border-color: rgba(212, 168, 67, 0.35);
    color: var(--gold-light, #ecd9a0);
  }

  .nav-main {
    flex-direction: column !important;
    gap: 2px !important;
    width: 100%;
  }

  .nav-main a {
    display: block;
    padding: 12px 14px !important;
    border-radius: 10px;
    font-size: 0.94rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
  }

  .nav-main a::after {
    display: none !important;
  }

  .nav-main a.active,
  .nav-main a:hover {
    background: rgba(212, 168, 67, 0.14);
    color: var(--gold-light, #ecd9a0) !important;
  }

  /* 面包屑 */
  .breadcrumb,
  .breadcrumb-hero {
    padding: 8px 0 !important;
    font-size: 0.75rem !important;
  }

  .breadcrumb ol {
    gap: 2px 4px;
  }

  /* Hero */
  .hero {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .hero h1 {
    font-size: clamp(1.28rem, 6vw, 1.7rem) !important;
    line-height: 1.35 !important;
  }

  .hero .intro {
    font-size: 0.9rem !important;
    line-height: 1.6;
  }

  .section-title {
    margin-bottom: 24px !important;
  }

  .section-title h2 {
    font-size: clamp(1.2rem, 5vw, 1.5rem) !important;
  }

  .section-title p {
    font-size: 0.86rem !important;
  }

  .section-kicker {
    font-size: 0.68rem !important;
    padding: 4px 10px !important;
  }

  /* 公告：单行横滑 */
  .notice-bar-inner {
    flex-wrap: nowrap !important;
    overflow: hidden;
    gap: 10px !important;
  }

  .notice-list {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 20px !important;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, #000 80%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  }

  .notice-list::-webkit-scrollbar {
    display: none;
  }

  .notice-list li {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Tab 横滑 */
  .advantage-tabs,
  .gallery-tabs {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px !important;
    padding-bottom: 6px;
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
    scrollbar-width: none;
  }

  .advantage-tabs::-webkit-scrollbar,
  .gallery-tabs::-webkit-scrollbar {
    display: none;
  }

  .advantage-tab,
  .gallery-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 14px !important;
    font-size: 0.82rem !important;
  }

  /* 底栏 */
  .contact-bar {
    z-index: 100;
  }

  .contact-bar-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    padding: 8px 2px !important;
    font-size: 0.68rem !important;
    line-height: 1.15;
    min-height: 52px;
  }

  .contact-bar-icon {
    width: 17px !important;
    height: 17px !important;
  }

  .contact-bar-primary {
    font-size: 0.76rem !important;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  /* 客服：缩小，避免挡底栏 */
  .live-chat {
    right: 10px !important;
    bottom: calc(var(--contact-bar-offset) + 10px) !important;
    z-index: 96;
  }

  .live-chat-toggle {
    padding: 10px 12px !important;
    box-shadow: 0 6px 20px rgba(12, 46, 34, 0.35);
  }

  .live-chat-toggle-label {
    display: none !important;
  }

  /* 表单 / 资讯 */
  .news-filter {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    padding: 14px !important;
  }

  .news-filter input[type="text"] {
    grid-column: 1 / -1;
    min-width: 0 !important;
  }

  .news-filter .btn {
    grid-column: 1 / -1;
  }

  .news-list li {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    padding: 14px 0 !important;
  }

  .news-list a {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 18px !important;
  }

  .footer-trust {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .footer-trust-item {
    font-size: 0.78rem;
    text-align: center;
  }

  .pain-grid,
  .advantage-panel,
  .home-intro-grid,
  .process-grid,
  .after-sales-grid,
  .strength-grid {
    grid-template-columns: 1fr !important;
  }

  .advantage-img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }

  .plant-catalog-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .plant-catalog-card h3 {
    font-size: 0.86rem !important;
    padding: 10px 8px !important;
  }

  .plant-catalog-card img {
    height: 140px !important;
  }

  /* 关闭悬停位移，减少误触跳动 */
  .card:hover,
  .home-package-card:hover,
  .feature-hub-card:hover,
  .stat-item:hover,
  .plant-catalog-card:hover,
  .home-quick-item:hover {
    transform: none !important;
  }

  /* 特效降噪 */
  .fx-aurora,
  .fx-grid,
  .fx-scanline,
  #fxParticles {
    opacity: 0.25 !important;
    pointer-events: none !important;
  }
}

/* ═══ ≤600px：小屏 ═══ */
@media (max-width: 600px) {
  :root {
    --contact-bar-h: 58px;
  }

  body.page-home,
  body.site-page:has(.site-main.home-page) {
    --home-nav-stack: 64px !important;
  }

  body.site-page:not(.page-home) {
    --page-nav-stack: 64px !important;
    --page-crumb-stack: 26px !important;
  }

  .site-topbar {
    display: none !important;
  }

  .btn-phone {
    display: none !important;
  }

  .header-cta {
    display: none !important;
  }

  .logo-brand {
    max-width: min(168px, 58vw) !important;
    height: 32px !important;
  }

  .header-inner {
    padding: 8px 12px !important;
  }

  .grid-3,
  .grid-4,
  .package-grid,
  .package-grid-compact,
  .feature-hub-grid,
  .plant-catalog-grid,
  .stats-grid,
  .service-stats-grid,
  .design-team-grid,
  .gallery-panel.grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
  }

  .hero-actions {
    flex-direction: column !important;
    width: 100%;
    gap: 10px !important;
  }

  .hero-actions .btn {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: center;
    text-align: center;
  }

  .section {
    padding-top: 32px !important;
    padding-bottom: calc(32px + var(--contact-bar-h)) !important;
  }

  .page-content {
    padding-top: 28px !important;
    padding-bottom: calc(28px + var(--contact-bar-h)) !important;
  }

  .card-body {
    padding: 12px !important;
  }

  .card-body h3 {
    font-size: 0.92rem;
  }

  .pagination {
    gap: 6px;
  }

  .pagination a,
  .pagination span {
    padding: 7px 11px;
    font-size: 0.78rem;
  }

  .inquiry-form-wrap,
  .contact-form-card {
    padding: 16px 12px !important;
  }

  .geo-summary,
  .geo-facts {
    font-size: 0.86rem;
  }

  .btn {
    min-height: 44px;
  }

  /* 首页专项再压紧 */
  .home-page .home-stats-band .stats-grid {
    gap: 8px !important;
  }

  .home-page .home-stats-band .stat-item {
    padding: 14px 10px !important;
    border-radius: 14px !important;
  }

  .home-page .home-stats-head {
    margin-bottom: 16px !important;
  }

  .home-page .home-package-meta {
    gap: 4px;
  }

  .home-page .home-package-meta span {
    font-size: 0.68rem !important;
  }

  .home-page .home-package-summary {
    font-size: 0.8rem !important;
    min-height: 0 !important;
  }

  .home-page .feature-hub-card {
    min-height: 0;
  }

  .home-page .feature-hub-card span:last-child {
    font-size: 0.72rem !important;
  }

  .home-client-marquee {
    mask-image: none;
    -webkit-mask-image: none;
  }

  .client-logo-item {
    padding: 10px 8px !important;
  }

  .client-logo-item img {
    max-height: 36px;
    margin: 0 auto;
  }

  .client-logo-item span {
    font-size: 0.7rem;
  }
}

/* ═══ ≤400px：超窄屏 ═══ */
@media (max-width: 400px) {
  .grid-3,
  .grid-4,
  .feature-hub-grid,
  .package-grid,
  .package-grid-compact,
  .home-page .feature-hub-grid {
    grid-template-columns: 1fr !important;
  }

  .home-page .home-stats-band .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .contact-bar-item {
    font-size: 0.6rem !important;
  }

  .logo-brand {
    max-width: min(140px, 52vw) !important;
  }
}

/* 触控设备：减少 hover 放大 */
@media (hover: none) {
  .card:hover .card-img,
  .plant-catalog-card:hover img {
    transform: none !important;
  }

  .fx-aurora,
  .fx-grid,
  .fx-scanline,
  #fxParticles {
    display: none !important;
  }
}
