/* Shared header system: one desktop grid for every route, then a compact
   mobile layout. The old rule counted the hidden mobile button as a grid
   column and pushed the action button down over the hero image. */
:root {
  --jiuwu-header-height: 80px;
  --jiuwu-header-pad: clamp(28px, 3.2vw, 64px);
  --jiuwu-nav-ink: #0c1620;
  --jiuwu-brand-width: 148px;
}

header.topbar,
header.pu-topbar,
header.gc-topbar,
header.bc-topbar {
  position: relative;
  z-index: 90;
  min-height: var(--jiuwu-header-height) !important;
  height: var(--jiuwu-header-height) !important;
  display: grid !important;
  grid-template-columns: minmax(var(--jiuwu-brand-width), 1fr) auto minmax(var(--jiuwu-brand-width), 1fr) !important;
  grid-template-rows: 1fr !important;
  align-items: center !important;
  column-gap: clamp(18px, 2.2vw, 40px) !important;
  padding: 0 var(--jiuwu-header-pad) !important;
  background: #fff !important;
}

/* The menu trigger belongs only to the small-screen layout. */
header.topbar > .bc-mobile-toggle,
header.pu-topbar > .bc-mobile-toggle,
header.gc-topbar > .bc-mobile-toggle,
header.bc-topbar > .bc-mobile-toggle,
header.topbar > button:not(.jiuwu-nav-link),
header.pu-topbar > button:not(.jiuwu-nav-link),
header.gc-topbar > button:not(.jiuwu-nav-link) { display: none !important; }

header.topbar > a:first-child,
header.pu-topbar > a:first-child,
header.gc-topbar > a:first-child,
header.bc-topbar > a:first-child {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  width: var(--jiuwu-brand-width) !important;
  min-width: var(--jiuwu-brand-width);
  margin: 0 !important;
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  color: var(--jiuwu-nav-ink) !important;
  text-align: center !important;
  text-decoration: none !important;
  line-height: 1 !important;
}

header.topbar > a:first-child,
header.topbar > a:first-child > span,
header.pu-topbar > a:first-child > b,
header.gc-topbar > a:first-child > b,
header.bc-topbar > a:first-child > b {
  font-family: ui-serif, "Songti SC", "STSong", serif !important;
  font-size: 23px !important;
  font-weight: 700 !important;
  letter-spacing: .08em !important;
  line-height: 1 !important;
}

header.topbar > a:first-child > small,
header.pu-topbar > a:first-child > small,
header.gc-topbar > a:first-child > small,
header.bc-topbar > a:first-child > small {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  color: var(--jiuwu-nav-ink) !important;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: .25em !important;
  line-height: 1 !important;
  text-align: center !important;
}

header.topbar > a:first-child img,
header.pu-topbar > a:first-child img,
header.gc-topbar > a:first-child img,
header.bc-topbar > a:first-child img {
  display: block;
  width: 132px !important;
  height: 42px !important;
  max-height: 42px !important;
  object-fit: contain;
  object-position: left center;
}
header.topbar nav,
header.pu-topbar nav,
header.gc-topbar nav,
header.bc-topbar nav {
  grid-column: 2;
  grid-row: 1;
  justify-self: center !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: center;
  gap: clamp(18px, 2.1vw, 38px) !important;
  height: 100% !important;
  min-width: 0;
  font-size: 14px !important;
  white-space: nowrap;
}

header.topbar > .jiuwu-language,
header.pu-topbar > .jiuwu-language,
header.gc-topbar > .jiuwu-language,
header.bc-topbar > .jiuwu-language {
  grid-column: 3;
  grid-row: 1;
  justify-self: end !important;
  align-self: center !important;
  display: inline-grid !important;
  grid-template-columns: 40px 1px 32px !important;
  align-items: center !important;
  gap: 9px !important;
  margin: 0 !important;
  white-space: nowrap;
}

header.topbar > .jiuwu-language button,
header.pu-topbar > .jiuwu-language button,
header.gc-topbar > .jiuwu-language button,
header.bc-topbar > .jiuwu-language button {
  min-width: 0;
  padding: 10px 0 !important;
  text-align: center;
  font-size: 15px !important;
  line-height: 1 !important;
}

header.topbar > .jiuwu-language i,
header.pu-topbar > .jiuwu-language i,
header.gc-topbar > .jiuwu-language i,
header.bc-topbar > .jiuwu-language i {
  width: 1px;
  height: 18px;
  background: #c8c8c8;
}

/* Public navigation has one primary action per item. The duplicated contact
   button created a fourth desktop zone and pushed the language control down. */
header.topbar > .admin-link,
header.pu-topbar > .pu-contact,
header.gc-topbar > .gc-contact,
header.bc-topbar > .bc-action {
  display: none !important;
}

.jiuwu-patched-menu { position: relative; display: inline-flex; align-items: center; align-self: stretch; color: var(--jiuwu-nav-ink); }
.jiuwu-nav-link, .jiuwu-patched-menu > a { display: inline-flex; align-items: center; height: 100%; color: inherit; text-decoration: none; border-bottom: 2px solid transparent; }
.jiuwu-patched-menu > button { appearance: none; border: 0; background: transparent; color: inherit; padding: 0 0 0 5px; cursor: pointer; font: inherit; line-height: 1; }
.jiuwu-patched-menu > button span { display: inline-block; font-size: 12px; transition: transform 160ms ease; }
.jiuwu-patched-menu.is-open > button span { transform: rotate(180deg); }
.jiuwu-patched-menu::after { content: ""; position: absolute; top: 100%; left: -14px; right: -14px; height: 14px; pointer-events: none; }
.jiuwu-patched-menu > div { display: none; position: absolute; top: calc(100% - 5px); left: -14px; min-width: 184px; padding: 8px 0; background: #fff; border: 1px solid #d6dce1; box-shadow: 0 18px 42px rgba(7, 20, 33, .16); z-index: 130; }
.jiuwu-patched-menu:hover > div, .jiuwu-patched-menu:focus-within > div, .jiuwu-patched-menu.is-open > div { display: block; }
.jiuwu-patched-menu > div a { display: block; padding: 11px 16px; color: #101721; text-decoration: none; white-space: nowrap; font-size: 13px; }
.jiuwu-patched-menu > div a:hover, .jiuwu-patched-menu > div a:focus-visible, .jiuwu-patched-menu > div a.is-active { background: #101113; color: #fff; outline: 0; }
.jiuwu-nav-link.is-active { border-bottom-color: currentColor; }

@media (max-width: 1080px) {
  header.topbar, header.pu-topbar, header.gc-topbar, header.bc-topbar { column-gap: 18px !important; padding: 0 24px !important; }
  header.topbar nav, header.pu-topbar nav, header.gc-topbar nav, header.bc-topbar nav { gap: 17px !important; font-size: 13px !important; }
  :root { --jiuwu-brand-width: 132px; }
  header.topbar > a:first-child, header.topbar > a:first-child > span, header.pu-topbar > a:first-child > b, header.gc-topbar > a:first-child > b, header.bc-topbar > a:first-child > b { font-size: 21px !important; }
}
@media (max-width: 860px) {
  :root { --jiuwu-header-height: 66px; }
  header.topbar, header.pu-topbar, header.gc-topbar, header.bc-topbar { display: flex !important; padding: 0 16px !important; justify-content: space-between; }
  header.topbar > a:first-child, header.pu-topbar > a:first-child, header.gc-topbar > a:first-child, header.bc-topbar > a:first-child { width: 124px !important; min-width: 124px; }
  header.topbar > a:first-child, header.topbar > a:first-child > span, header.pu-topbar > a:first-child > b, header.gc-topbar > a:first-child > b, header.bc-topbar > a:first-child > b { font-size: 19px !important; }
  header.topbar > a:first-child > small, header.pu-topbar > a:first-child > small, header.gc-topbar > a:first-child > small, header.bc-topbar > a:first-child > small { font-size: 8px !important; }
  header.topbar > .bc-mobile-toggle, header.pu-topbar > .bc-mobile-toggle, header.gc-topbar > .bc-mobile-toggle, header.bc-topbar > .bc-mobile-toggle { display: inline-flex !important; }
  header.topbar nav, header.pu-topbar nav, header.gc-topbar nav, header.bc-topbar nav { display: none !important; }
  header.topbar > .jiuwu-language, header.pu-topbar > .jiuwu-language, header.gc-topbar > .jiuwu-language, header.bc-topbar > .jiuwu-language { margin-left: auto !important; margin-right: 10px !important; }
  .jiuwu-patched-menu > div { position: fixed; top: 66px; left: 16px; right: 16px; min-width: 0; }
}
