/* English site navigation: header, mobile menu, actions, language switch and logos. */
header {
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- mobile / touch navigation ---------- */
.mnav {
  display: none;
}
.mnav > summary {
  list-style: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--ff-white);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.mnav > summary::-webkit-details-marker {
  display: none;
}
.mnav > summary:focus-visible {
  outline: 2px solid var(--ff-focus);
  outline-offset: 2px;
}
.mnav .ic-close {
  display: none;
}
.mnav[open] .ic-open {
  display: none;
}
.mnav[open] .ic-close {
  display: block;
}
.mnav-panel {
  position: fixed;
  left: 0;
  right: 0;
  top: 60px;
  bottom: 0;
  z-index: 60;
  background: var(--ff-gravity);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 20px 40px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  box-sizing: border-box;
}
.mnav-l,
.mnav-g > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 4px;
  color: var(--ff-white);
  text-decoration: none;
  font-size: 18px;
  font-family: var(--ff-head);
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  list-style: none;
  cursor: pointer;
}
.mnav-l:hover,
.mnav-g > summary:hover {
  color: var(--ff-white);
}
.mnav-g > summary::-webkit-details-marker {
  display: none;
}
.mnav-g > summary::after {
  content: '';
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--ff-white);
  border-bottom: 2px solid var(--ff-white);
  transform: rotate(45deg);
  margin-right: 6px;
  transition: transform 0.2s;
}
.mnav-g[open] > summary::after {
  transform: rotate(-135deg);
}
.mnav-sub {
  display: flex;
  flex-direction: column;
  padding: 6px 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.mnav-sub a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  color: var(--ff-white);
  text-decoration: none;
  font-size: 15px;
}
.mnav-sub a:hover {
  color: var(--ff-white);
}
.mnav-panel .btn {
  margin-top: 28px;
  width: 100%;
}

@media (max-width: 1179px), (hover: none) {
  .navlinks {
    display: none !important;
  }
  .mnav {
    display: block;
  }
  header .wrap {
    min-height: 60px !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
  }
  header .wrap > a:first-child img {
    height: 32px !important;
  }
  header .wrap > .btn {
    margin-left: auto;
    padding: 0 14px !important;
    font-size: 13px !important;
    min-height: 40px;
  }
  /* backdrop-filter makes the header the containing block of position:fixed children,
     which clipped the menu panel to the header's 60px. Use an opaque header instead. */
  header {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: var(--ff-gravity) !important;
  }
  .mnav-panel {
    top: 60px;
    bottom: auto;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    overscroll-behavior: contain;
  }
  /* 由 runtime 在菜单开合时切换；不用 :has()，以兼容 Firefox 114–120。 */
  html.mnav-open {
    overflow: hidden;
  }
}
@media (max-width: 380px) {
  header .wrap > .btn {
    display: none !important;
  }
  .mnav {
    margin-left: auto;
  }
}

/* ---------- header actions: Contact Us + language switch ---------- */
.hdr-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}
.lang-link {
  /* Temporarily hide the Chinese site entry; restore inline-flex to re-enable. */
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  color: var(--ff-white) !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.lang-link:hover {
  color: var(--ff-white) !important;
  border-color: var(--ff-white);
  background: rgba(255, 255, 255, 0.08);
}
@media (max-width: 1179px), (hover: none) {
  header .hdr-actions {
    margin-left: auto;
    gap: 8px;
  }
  header .hdr-actions .btn {
    padding: 0 14px !important;
    font-size: 13px !important;
    min-height: 40px;
  }
  .lang-link {
    padding: 0 12px;
    font-size: 13px;
  }
}
@media (max-width: 640px) {
  header .hdr-actions .btn {
    display: none !important;
  }
  header .hdr-actions + .mnav {
    margin-left: 0;
  }
}

/* ---------- logo (horizontal lockup, 6.3:1) ---------- */
header .wrap > a:first-child {
  flex: none;
}
header .wrap > a:first-child img,
footer img[alt='Final Frontier'] {
  max-width: none;
  flex: none;
}
/* Keep the logo's 8px protection space at the narrowest phone width.
   Contact Us remains available in the mobile menu. */
@media (max-width: 360px) {
  header .wrap {
    padding-left: 8px;
    padding-right: 8px;
    gap: 8px !important;
  }
  header .lang-link {
    padding: 0 6px;
  }
}
