/* =========================================
   Header 导航（共享组件）
   Figma Navbar 166:2864 / 语言下拉 247:5259
   ========================================= */

/* 非简体中文时先隐藏导航文案，避免跳转时闪现默认简体中文 */
html[data-i18n-pending] .header [data-i18n],
html[data-i18n-pending] .header .language-current__text {
  visibility: hidden;
}

.header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 96px;
  padding: 0 64px;
  width: 100%;
}

.header__logo {
  display: block;
  width: 170px;
  height: 60px;
  flex-shrink: 0;
}

.header__logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.header__nav-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 96px;
  flex-shrink: 0;
}

.header__nav {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.header__links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header__link-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header__link {
  position: relative;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--color-white);
  line-height: normal;
  min-height: 20px;
  white-space: nowrap;
}

.header__link::after {
  content: '';
  position: absolute;
  left: 0;
  top: 24px;
  width: 100%;
  height: 1px;
  background: var(--color-white);
  opacity: 0;
  pointer-events: none;
}

.header__link:hover:not(.header__link--active)::after {
  opacity: 1;
}

.header__link--active {
  font-weight: 700;
}

.header__slash {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.header__underline {
  position: absolute;
  left: 0;
  top: 24px;
  width: 32px;
  height: 1px;
  background: var(--color-white);
  pointer-events: none;
}

.language-selector {
  position: relative;
  flex-shrink: 0;
}

.language-current {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--color-white);
  font-family: var(--font-inter);
  font-size: 14px;
  font-weight: 500;
  line-height: normal;
  white-space: nowrap;
  overflow: clip;
}

.language-current__icon {
  display: block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.language-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 120px;
  background: var(--color-white);
  z-index: 30;
  overflow: hidden;
  box-shadow:
    0 0 83.5px rgba(0, 0, 0, 0.07),
    0 0 48.902px rgba(0, 0, 0, 0.05),
    0 0 26.596px rgba(0, 0, 0, 0.04),
    0 0 6.804px rgba(0, 0, 0, 0.03);
}

.language-selector.is-open .language-dropdown {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.language-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  color: var(--color-black);
  background: var(--color-white);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}

.language-option.active {
  font-weight: 700;
}

.language-option:hover {
  background: #f4f4f4;
}

@media (max-width: 768px) {
  .language-option:hover {
    background: transparent;
  }
}

@media (max-width: 1440px) {
  .header__inner {
    padding: 0 48px;
  }

  .header__nav-wrap {
    gap: 48px;
  }
}

/* =========================================
   H5 Header / 移动抽屉菜单
   Figma Menu 387:8594（390×844）
   ========================================= */

.header__menu-btn {
  display: none;
}

.mobile-menu {
  display: none;
}

@media (max-width: 768px) {
  .header {
    z-index: 40;
  }

  .header__inner {
    height: 0.8rem;
    padding: 0 0.16rem;
  }

  .header__logo {
    width: 1.7rem;
    height: 0.6rem;
  }

  .header__menu-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 0.32rem;
    height: 0.32rem;
    padding: 0;
    background: transparent;
    border: none;
    z-index: 30;
  }

  .header__menu-btn-icon {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* 全屏抽屉：右侧滑入 / 滑出 */
  .mobile-menu {
    display: flex;
    position: fixed;
    inset: 0;
    width: 100%;
    height: auto;
    max-height: none;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--color-black);
    z-index: 50;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: none;
    transform: translate3d(100%, 0, 0);
    visibility: hidden;
    pointer-events: none;
    transition:
      transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0.35s;
  }

  .mobile-menu[hidden] {
    display: flex !important;
  }

  .header.is-menu-open .mobile-menu {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-menu__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    height: 0.8rem;
    padding: 0 0.16rem;
    width: 100%;
  }

  .mobile-menu__logo {
    display: block;
    width: 1.7rem;
    height: 0.6rem;
    flex-shrink: 0;
  }

  .mobile-menu__logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
  }

  .mobile-menu__close {
    position: relative;
    display: block;
    width: 0.32rem;
    height: 0.32rem;
    flex-shrink: 0;
    padding: 0;
  }

  .mobile-menu__close-line {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.24rem;
    height: 2px;
    background: var(--color-white);
    transform-origin: center;
  }

  .mobile-menu__close-line:first-child {
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .mobile-menu__close-line:last-child {
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  .mobile-menu__nav {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    padding: 0.24rem 0.24rem 0;
    overflow: hidden;
  }

  .mobile-menu__links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.32rem;
  }

  .mobile-menu__links > li {
    display: block;
    font-size: 0;
    line-height: 0;
  }

  .mobile-menu__link {
    position: relative;
    display: inline-block;
    max-width: 100%;
    padding: 0.16rem 0;
    font-family: var(--font-sans);
    font-size: 0.32rem;
    font-weight: 500;
    color: var(--color-white);
    line-height: 0.24rem;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .mobile-menu__link.is-active::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0.03rem;
    background: var(--color-white);
    pointer-events: none;
  }

  .mobile-menu__lang {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    gap: 0.16rem;
    width: 100%;
    padding: 0.24rem 0.24rem 0.48rem;
    padding-bottom: calc(0.48rem + env(safe-area-inset-bottom));
  }

  .mobile-menu__lang-option {
    padding: 0;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.16rem;
    font-weight: 400;
    line-height: 0.18rem;
    color: var(--color-white);
    opacity: 0.4;
    white-space: nowrap;
    cursor: pointer;
  }

  .mobile-menu__lang-option.active {
    font-weight: 500;
    opacity: 1;
  }
}

