/* ======================
   Navigation
====================== */

.nav {
  position: fixed;
  z-index: 100;
  top: 0;

  width: 100%;

  background: rgba(10, 10, 12, 0.7);

  border-bottom:
    1px solid rgba(255, 255, 255, 0.06);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;

  width: var(--page-width);
  height: 56px;
  margin: 0 auto;
  padding: 0 24px;

  box-sizing: border-box;
}


/* ======================
   Logo
====================== */

.logo a {
  color: #fff;

  font-weight: 600;
  letter-spacing: 1px;

  text-decoration: none;
}

.logo a,
.nav-item,
.language-switch-link,
.nav-menu-toggle-text {
  line-height: 1;
}


/* ======================
   Desktop Navigation
====================== */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-item {
  position: relative;

  padding: 6px 2px;

  color: rgba(255, 255, 255, 0.6);

  font-size: 14px;

  text-decoration: none;

  transition: color 0.25s ease;
}

.nav-item:hover {
  color: rgba(255, 255, 255, 0.9);
}

.nav-item.active {
  color: #fff;
}


/* 当前页面下划线 */

.nav-item::after {
  content: "";

  position: absolute;
  bottom: -6px;
  left: 0;

  width: 100%;
  height: 1px;

  background: #fff;

  transform: scaleX(0);
  transform-origin: left;

  transition: transform 0.25s ease;
}

.nav-item.active::after {
  transform: scaleX(1);
}


/* ======================
   Language Switch
====================== */

.language-switch {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 7px;

  padding-left: 24px;

  border-left:
    1px solid rgba(255, 255, 255, 0.15);
}

.language-switch-link {
  position: relative;

  padding: 6px 0;

  color: rgba(255, 255, 255, 0.38);

  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.08em;

  text-decoration: none;

  transition: color 0.25s ease;
}

.language-switch-link:hover {
  color: rgba(255, 255, 255, 0.8);
}

.language-switch-link.active {
  color: #fff;
}

.language-switch-separator {
  color: rgba(255, 255, 255, 0.18);

  font-size: 0.6rem;
  line-height: 1;
}


/* ======================
   Mobile Menu Button
====================== */

.nav-menu-toggle {
  display: none;

  padding: 0;

  border: 0;

  background: transparent;
  color: #fff;

  font: inherit;

  cursor: pointer;
}

.nav-menu-toggle:focus-visible,
.nav-item:focus-visible,
.language-switch-link:focus-visible,
.logo a:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.8);
  outline-offset: 5px;
}


/* 打开菜单时禁止背景滚动 */

html.nav-menu-open,
html.nav-menu-open body {
  overflow: hidden;
}


/* ======================
   Mobile Navigation
====================== */

@media (max-width: 850px) {
  .nav-inner {
    width: var(--page-width-mobile);
    height: 56px;
    padding: 0 12px;
  }


  /* Logo 和菜单按钮显示在面板上方 */

  .logo,
  .nav-menu-toggle {
    position: relative;
    z-index: 3;
  }


  /* MENU / CLOSE 按钮 */

  .nav-menu-toggle {
    display: flex;
    align-items: center;

    min-height: 32px;
  }

  .nav-menu-toggle-text {
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.12em;
  }


  /* ======================
     Fullscreen Panel
  ====================== */

  .nav-actions {
    position: fixed;
    z-index: 2;
    inset: 0;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: 2rem;

    width: 100%;
    height: 100vh;
    height: 100dvh;

    padding:
      clamp(6.5rem, 16vh, 8rem)
      30px
      28px;

    overflow-y: auto;

    background: rgba(8, 8, 9, 0.985);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-12px);

    transition:
      opacity 0.35s ease,
      visibility 0.35s ease,
      transform 0.35s ease;
  }

  .nav.menu-open .nav-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0);
  }


  /* ======================
     Mobile Page Links
  ====================== */

  .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0;

    width: 100%;
  }

  .nav-item {
    display: block;

    width: 100%;
    padding: 0.8rem 0;

    border-bottom:
      1px solid rgba(255, 255, 255, 0.1);

    color: rgba(255, 255, 255, 0.72);

    font-size: clamp(2rem, 10vw, 3.8rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.04em;
  }

  .nav-item:first-child {
    border-top:
      1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-item:hover,
  .nav-item.active {
    color: #fff;
  }

  .nav-item::after {
    display: none;
  }


  /* ======================
     Mobile Language Switch
  ====================== */

  .nav .nav-actions > .language-switch {
    align-self: stretch;
    justify-content: flex-end;
    gap: 10px;

    width: 100%;
    margin-right: 0;
    margin-left: auto;
    padding: 1.4rem 0 0;

    border-top:
      1px solid rgba(255, 255, 255, 0.1);
    border-left: 0;
  }

  /*
    即使切换路由后 justify-content 的加载顺序变化，
    也用自动左边距把整组语言推到右边。
  */

  .nav
  .nav-actions
  > .language-switch
  > .language-switch-link:first-child {
    margin-left: auto;
  }

  .language-switch-link {
    padding: 6px 0;

    font-size: 0.72rem;
  }

  .language-switch-separator {
    font-size: 0.68rem;
  }
}


/* ======================
   Small Mobile
====================== */

@media (max-width: 490px) {
  .nav-inner {
    padding-right: 12px;
    padding-left: 12px;
  }

  .nav-actions {
    padding-right: 20px;
    padding-left: 20px;
  }

  .nav-item {
    font-size: clamp(1.9rem, 10vw, 3rem);
  }
}


/* ======================
   Reduced Motion
====================== */

@media (prefers-reduced-motion: reduce) {
  .nav-actions {
    transition: none;
  }
}


/* ======================
   Page Container
====================== */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 120px 24px 80px;

  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}