/* Haishuo shared site shell: header, mobile navigation, footer and floating support. */

.nav-item:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

:where(a, button, summary, input, select, textarea):focus-visible {
  outline: 3px solid rgba(244, 123, 32, .5);
  outline-offset: 3px;
}

.mobile-header-consult,
.mobile-nav-rail-link,
.chat-trigger {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chat-trigger {
  padding: 0;
  border: 0;
  font: inherit;
}

.chat-header-action,
.chat-tooltip-close,
.chat-quick-item,
.chat-emoji {
  border: 0;
  font: inherit;
}

.chat-header-action {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.chat-header-action:hover {
  background: rgba(255, 255, 255, .14);
}

.chat-tooltip-close,
.chat-emoji {
  background: transparent;
}

.footer-channel-note {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: rgba(255, 255, 255, .68);
  font-size: 13px;
}

.footer-channel-note i {
  color: #57d7b1;
}

@media (min-width: 1024px) {
  .mobile-nav-rail,
  .mobile-header-consult {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  #site-header:empty {
    min-height: 112px;
    background: #fff;
  }

  .top-bar {
    display: none !important;
  }

  .main-nav {
    min-height: 60px;
    border-bottom: 1px solid rgba(10, 39, 71, .08);
    box-shadow: 0 8px 24px rgba(7, 27, 49, .06);
  }

  .main-nav > .container {
    min-height: 60px;
    padding-right: 16px !important;
    padding-left: 16px !important;
  }

  .main-nav > .container > a:first-child {
    min-width: 0;
    gap: 10px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }

  .main-nav > .container > a:first-child img {
    width: 36px !important;
    height: 36px !important;
  }

  .main-nav > .container > a:first-child .text-xl {
    font-size: 15px !important;
    line-height: 1.2;
  }

  .main-nav > .container > a:first-child .text-xs {
    margin-top: 2px;
    font-size: 10px !important;
    line-height: 1.2;
  }

  .mobile-header-consult {
    display: inline-flex;
    min-width: 54px;
    height: 44px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 4px;
    border: 0;
    border-radius: 8px;
    color: #32465a;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-header-consult i {
    color: #07589b;
    font-size: 17px;
  }

  .mobile-nav-rail {
    position: relative;
    display: block;
    border-top: 1px solid rgba(10, 39, 71, .07);
    border-bottom: 1px solid rgba(10, 39, 71, .08);
    background: rgba(255, 255, 255, .98);
  }

  .mobile-nav-rail::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 82%);
    content: "";
  }

  .mobile-nav-track {
    display: flex;
    align-items: stretch;
    gap: 2px;
    min-height: 51px;
    padding: 0 32px 0 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-behavior: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-nav-track::-webkit-scrollbar {
    display: none;
  }

  .mobile-nav-rail-link {
    position: relative;
    display: flex;
    min-height: 48px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    color: #4a5c6f;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    scroll-snap-align: center;
  }

  .mobile-nav-rail-link::after {
    position: absolute;
    right: 16px;
    bottom: 0;
    left: 16px;
    height: 2px;
    border-radius: 999px;
    background: transparent;
    content: "";
  }

  .mobile-nav-rail-link.active {
    color: #07589b;
    font-weight: 800;
  }

  .mobile-nav-rail-link.active::after {
    background: #f36f21;
  }

  .mobile-nav-rail-link:hover,
  .mobile-nav-rail-link:focus-visible {
    color: #07589b;
  }

  .mobile-nav-rail-link,
  .mobile-header-consult {
    min-height: 44px;
  }

  .chat-tooltip {
    display: none !important;
  }

  .chat-trigger {
    display: none !important;
  }

  .page-banner-content .breadcrumb a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding-right: 9px;
    padding-left: 9px;
  }

  .chat-panel {
    top: calc(8px + env(safe-area-inset-top)) !important;
    right: 8px !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    left: 8px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 16px !important;
  }

  .chat-header-action,
  .chat-tool-btn,
  .chat-send-btn {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px;
  }

  .chat-header > div:last-child {
    gap: 4px !important;
  }

  .chat-input {
    gap: 4px;
    padding: 10px 8px;
  }

  .chat-input input {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .chat-quick-item {
    min-height: 44px;
    padding: 9px 13px;
  }

  .site-footer {
    padding-top: 44px;
  }

  .footer-grid {
    grid-template-columns: 1.2fr 1fr;
    gap: 34px 28px;
    padding-bottom: 32px;
  }

  .footer-col h3 {
    margin-bottom: 14px;
    padding-bottom: 10px;
    font-size: 16px;
  }

  .footer-col p,
  .footer-col a {
    font-size: 13px;
    line-height: 1.75;
  }

  .footer-col > .mt-4.flex a {
    display: flex;
    width: 44px !important;
    height: 44px !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    line-height: 1;
  }

  .footer-col a:hover {
    padding-left: 0;
  }

  .footer-bottom {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    font-size: 12px;
  }
}

/* Android 浏览器启用“桌面版网站”时常落在 769–1023px 视口。
   这一档仍按触屏设备处理，避免把手机页压成缩小的电脑版。 */
@media (min-width: 769px) and (max-width: 1023px) {
  #site-header:empty {
    min-height: 146px;
  }

  .main-nav,
  .main-nav > .container {
    min-height: 84px;
  }

  .main-nav > .container {
    padding-right: 28px !important;
    padding-left: 28px !important;
  }

  .main-nav > .container > a:first-child {
    gap: 14px !important;
  }

  .main-nav > .container > a:first-child img {
    width: 50px !important;
    height: 50px !important;
  }

  .main-nav > .container > a:first-child .text-xl {
    font-size: 22px !important;
  }

  .main-nav > .container > a:first-child .text-xs {
    font-size: 13px !important;
  }

  .mobile-header-consult {
    min-width: 82px;
    height: 52px;
    gap: 8px;
    font-size: 16px;
  }

  .mobile-header-consult i {
    font-size: 21px;
  }

  .mobile-nav-track {
    min-height: 62px;
    padding-right: 46px;
    padding-left: 22px;
  }

  .mobile-nav-rail-link {
    min-height: 60px;
    padding-right: 22px;
    padding-left: 22px;
    font-size: 18px;
  }
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 18px;
  }

  .footer-col:first-child,
  .footer-col:nth-child(2),
  .footer-col:nth-child(3),
  .footer-col:nth-child(4) {
    grid-column: 1 / -1;
  }

  .footer-col:nth-child(2) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 18px;
  }

  .footer-col:nth-child(2) h3 {
    grid-column: 1 / -1;
  }

  .footer-col:nth-child(2) > a {
    display: flex;
    min-height: 44px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }

  .footer-qr {
    gap: 14px;
  }

  .footer-qr-item img {
    width: 92px;
    height: 92px;
  }

  .footer-bottom-grid {
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
