/**
 * LaoBiz 移动端壳层（≤768px）v3
 * PC 端不变：布局重置均在 @media (max-width: 768px) 内。
 *
 * 注意：.site-header 的 backdrop-filter 会把内部 position:fixed
 * 限制在 header 盒内 —— 移动端必须关闭，否则全屏菜单变成黑条。
 */

.mobile-only {
  display: none !important;
}

/* PC / 宽屏：移动主链不出现在顶栏 */
.nav-m-primary {
  display: none !important;
}

/* PC 兜底：恢复顶栏水平导航（防 site.css 缓存半更新） */
@media (min-width: 961px) {
  .main-nav {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0;
    overflow: visible !important;
    background: transparent !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    border: none !important;
    box-shadow: none !important;
  }
  .main-nav > a.nav-link {
    display: inline !important;
  }
  .main-nav > a.nav-link--featured {
    display: inline-flex !important;
  }
  .main-nav > .nav-group {
    display: block !important;
  }
  .nav-link--featured {
    display: inline-flex !important;
  }
  .site-header {
    height: auto;
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    overflow: visible;
  }
  .header-inner {
    height: auto;
    padding: 14px 0;
  }
}

@media (max-width: 768px) {
  .mobile-only {
    display: block !important;
  }
  .mobile-only.mobile-only--flex {
    display: flex !important;
  }
  .desktop-only {
    display: none !important;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  body {
    line-height: 1.65;
    font-size: 14px;
  }

  /* ========== Header ========== */
  .site-header {
    height: 64px;
    /* 关键：避免成为 fixed 包含块，导致全屏菜单裁切 */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    overflow: visible !important;
  }
  .header-inner {
    height: 64px;
    padding: 0;
    flex-wrap: nowrap;
    align-items: center;
    position: relative;
    z-index: 140;
  }
  .logo-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }
  .logo-text {
    font-size: 1rem;
  }
  .logo-text small {
    font-size: 0.65rem;
  }
  .nav-toggle {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    position: relative;
    z-index: 150;
  }

  /* 全屏 Overlay：相对视口定位 */
  .main-nav {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 130 !important;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 76px 20px 32px;
    max-height: none !important;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background:
      radial-gradient(ellipse 90% 45% at 85% 0%, rgba(26, 138, 143, 0.22), transparent 55%),
      linear-gradient(165deg, #0a1522 0%, #0b1220 45%, #0f2430 100%) !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 0;
    transform: translate3d(0, 12px, 0);
    transition:
      opacity 0.28s ease,
      transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .site-header.nav-open .main-nav {
    display: flex !important;
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  /* 隐藏桌面级导航树 */
  .main-nav > a.nav-link,
  .main-nav > .nav-group {
    display: none !important;
  }

  /* 移动主链 */
  .main-nav > .nav-m-primary {
    display: flex !important;
    flex-direction: column;
    gap: 0;
    margin: 4px 0 16px;
    padding: 0;
    list-style: none;
    width: 100%;
    flex: 0 0 auto;
  }
  .main-nav > .nav-m-primary a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding: 14px 4px !important;
    margin: 0 !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #f5f7fb !important;
    font-size: 1.08rem !important;
    font-weight: 650 !important;
    letter-spacing: 0.01em;
    text-decoration: none !important;
    line-height: 1.3;
  }
  .main-nav > .nav-m-primary a::after {
    content: "";
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    margin-left: 12px;
    border-right: 1.5px solid rgba(255, 255, 255, 0.4);
    border-top: 1.5px solid rgba(255, 255, 255, 0.4);
    transform: rotate(45deg);
  }
  .main-nav > .nav-m-primary a.is-featured {
    color: #8ee0e4 !important;
  }
  .main-nav > .nav-m-primary a:active {
    color: #fff !important;
    padding-left: 8px !important;
  }

  .main-nav > .nav-auth {
    display: flex !important;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }
  .main-nav .nav-auth-icon {
    border-color: rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
  }
  .main-nav .nav-auth-menu {
    background: #152033 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
  }
  .main-nav .nav-auth-menu-item {
    color: #e8edf5 !important;
  }

  .site-header.nav-open {
    background: transparent !important;
    border-bottom-color: transparent !important;
    box-shadow: none !important;
  }
  .site-header.nav-open .logo-text {
    color: #fff;
  }
  .site-header.nav-open .logo-text small {
    color: rgba(255, 255, 255, 0.55);
  }
  .site-header.nav-open .nav-toggle {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
  }
  .site-header.nav-open .nav-toggle-bar {
    background: #fff;
  }

  /* ========== Footer Accordion ========== */
  .site-footer {
    padding: 36px 0 24px;
  }
  .footer-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 20px;
  }
  .footer-regions {
    display: none;
  }
  .footer-tagline {
    font-size: 13px;
    line-height: 1.55;
    max-width: none;
    margin-bottom: 0;
  }
  .footer-brand-mark {
    height: 40px;
    max-height: 40px;
    max-width: 40px;
  }
  .footer-brand {
    font-size: 1rem;
  }
  .footer-grid > .footer-col {
    display: none !important;
  }
  .footer-m-shell {
    display: block !important;
    width: 100%;
  }
  .footer-m-acc {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .footer-m-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .footer-m-item summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 2px;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    cursor: pointer;
    user-select: none;
  }
  .footer-m-item summary::-webkit-details-marker {
    display: none;
  }
  .footer-m-item summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 1.5px solid rgba(255, 255, 255, 0.45);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.45);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-right: 4px;
  }
  .footer-m-item[open] summary::after {
    transform: rotate(-135deg);
    margin-top: 4px;
  }
  .footer-m-item ul {
    list-style: none;
    margin: 0 0 12px;
    padding: 0 0 4px;
  }
  .footer-m-item li {
    margin: 0;
  }
  .footer-m-item a {
    display: block;
    padding: 9px 2px;
    color: #aab0bc;
    text-decoration: none;
    font-size: 0.86rem;
  }
  .footer-m-item a:active {
    color: #fff;
  }
  .footer-m-contact {
    margin-top: 18px;
    padding: 14px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .footer-m-contact a {
    color: #7fd4d8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 550;
  }
  .footer-m-contact-label {
    display: block;
    font-size: 11px;
    color: #6f7888;
    margin-bottom: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .footer-bottom-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .footer-copy {
    font-size: 12px;
  }

  /* ========== 悬浮按钮 ========== */
  .wa-float {
    --wa-size: 48px;
    right: 16px !important;
    left: auto !important;
    bottom: max(24px, env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
  }
  .wa-float__actions {
    gap: 10px;
  }
  .wa-float__btn {
    border-radius: 14px !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22) !important;
  }
  .wa-float.is-edge-right .wa-float__btn,
  .wa-float.is-edge-left .wa-float__btn {
    border-radius: 14px !important;
  }
  .wa-float__icon svg {
    width: 20px;
    height: 20px;
  }
  .wa-float .wa-float__btn {
    max-width: var(--wa-size) !important;
  }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .main-nav {
    transition: none;
  }
}
