/* 必须置于全站 <head> 末尾，用于压过各 page-*.css 里遗留的 @media (max-width:768) 导航规则，
   避免与全站 1024 断点冲突导致桌面导航与移动菜单同时参与排版、链接叠在正文上。 */

@media (min-width: 1025px) {
  body.hzbgs-site .mobile-header,
  body.hzbgs-site #mobileMenu,
  body.hzbgs-site .mobile-menu {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  body.hzbgs-site .nav-container {
    display: none !important;
  }

  body.hzbgs-site .mobile-header.hzbgs-mobile-bar {
    display: flex !important;
  }

  body.hzbgs-site .nav-container .dropdown-horizontal,
  body.hzbgs-site .nav-container .dropdown-content {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

body.hzbgs-site #mobileMenu:not(.active) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 带 data 标记的全站抽屉：防止旧 page-*.css 的 .mobile-menu 侧栏/全屏规则在叠层顺序上压过正文 */
body.hzbgs-site #mobileMenu[data-hzbgs-mobile-drawer][hidden],
body.hzbgs-site #mobileMenu[data-hzbgs-mobile-drawer]:not(.active) {
  display: none !important;
}

@media (max-width: 1024px) {
  body.hzbgs-site #mobileMenu.active {
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 10050 !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    touch-action: auto !important;
    height: 100% !important;
    max-height: 100dvh !important;
  }
}

/* 各 page-*.css 里 body.mobile-menu-open { position:fixed } 会导致菜单内无法滚动，必须覆盖 */
body.hzbgs-site.mobile-menu-open {
  position: static !important;
  width: auto !important;
  touch-action: auto !important;
}

/* 移动顶栏：压过各 page-*.css 遗留的 fixed/104vw/nowrap/ellipsis/大 margin，避免标题与按钮挤作一团 */
@media (max-width: 1024px) {
  body.hzbgs-site .mobile-header.hzbgs-mobile-bar {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    right: auto !important;
    /* 整栏相对屏幕左右内缩，系统浏览器里也能明显与边缘留白（不依赖仅 padding） */
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
    margin-top: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    padding: 16px 20px 16px 20px !important;
    padding-top: calc(18px + env(safe-area-inset-top, 0px)) !important;
    padding-right: calc(20px + env(safe-area-inset-right, 0px)) !important;
    padding-bottom: 16px !important;
    padding-left: calc(20px + env(safe-area-inset-left, 0px)) !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.78) !important;
    border: 1px solid rgba(210, 210, 215, 0.88) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06) !important;
  }

  body.hzbgs-site .hzbgs-mobile-bar-brand {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    padding-right: 8px !important;
    padding-top: 4px !important;
    padding-left: 2px !important;
  }

  body.hzbgs-site .mobile-logo {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    max-width: none !important;
    font-size: 14px !important;
    line-height: 1.38 !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  body.hzbgs-site .mobile-logo-en {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    max-width: none !important;
    display: block !important;
    margin-top: 5px !important;
    font-size: 7.5px !important;
    line-height: 1.4 !important;
    letter-spacing: 0.05em !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    opacity: 0.68 !important;
  }

  body.hzbgs-site .mobile-menu-btn {
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 1px !important;
    flex-shrink: 0 !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: rgba(255, 255, 255, 0.55) !important;
  }

  body.hzbgs-site .mobile-menu-btn-lines {
    width: 16px !important;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor !important;
  }
}

@media (max-width: 380px) {
  body.hzbgs-site .mobile-logo {
    font-size: 13px !important;
  }
  body.hzbgs-site .mobile-logo-en {
    font-size: 7px !important;
    letter-spacing: 0.04em !important;
  }
}
