/* 丝路全景 · 顶部导航（浅色商务风） */
:root {
  --nav-h: 64px;
  --nav-bg: #ffffff;
  --nav-text: #2c3a45;
  --nav-muted: #6b7c88;
  --nav-blue: #2f7cf6;
  --nav-blue-soft: #eaf2ff;
  --nav-line: rgba(15, 35, 55, 0.08);
  --nav-shadow: 0 8px 28px rgba(15, 35, 55, 0.08);
  --nav-max: 1280px;
  --nav-font: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--nav-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--nav-font);
  transition: box-shadow .25s ease;
}

.site-header.is-scrolled {
  box-shadow: var(--nav-shadow);
}

.site-header__bar {
  height: var(--nav-h);
  max-width: var(--nav-max);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
}

/* Logo */
.site-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  margin-right: 12px;
}

.site-brand__logo {
  height: 40px;
  width: auto;
  display: block;
  border-radius: 6px;
  background: #0b0b0b;
}

.site-brand__text {
  display: none;
}

/* Primary nav */
.site-nav {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.site-nav__list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  gap: 2px;
}

.site-nav__item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 14px;
  color: var(--nav-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  border-radius: 8px;
  transition: color .2s ease, background .2s ease;
  white-space: nowrap;
}

.site-nav__link:hover,
.site-nav__link:focus {
  color: var(--nav-blue);
  background: var(--nav-blue-soft);
  text-decoration: none !important;
}

.site-nav__item.is-active > .site-nav__link {
  color: var(--nav-blue);
  font-weight: 600;
}

.site-nav__item.is-active > .site-nav__link::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -14px;
  height: 2px;
  background: var(--nav-blue);
  border-radius: 2px;
}

.site-nav__badge {
  position: absolute;
  top: -8px;
  right: 2px;
  font-size: 10px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 8px 8px 8px 2px;
  background: #ff4d4f;
  color: #fff;
  font-weight: 700;
  transform: scale(0.92);
}

.site-nav__caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  transition: transform .2s ease;
}

.site-nav__item.is-open > .site-nav__link .site-nav__caret,
.site-nav__item:hover > .site-nav__link .site-nav__caret {
  transform: rotate(180deg);
}

/* Mega panel */
.site-mega {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-30%);
  width: 680px;
  padding: 24px;
  padding-top: 28px;
  margin-top: 0;
  background: #fff;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  box-shadow: var(--nav-shadow);
  z-index: 1300;
}

/* 桥接触发区与下拉层，避免鼠标移动时空隙导致菜单消失 */
.site-mega::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
  background: transparent;
}

.site-nav__item.is-open > .site-mega,
.site-nav__item:hover > .site-mega {
  display: block;
}

.site-mega__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--nav-text);
  margin: 0 0 18px;
}

.site-mega__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
}

.site-mega__card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none !important;
  color: inherit;
  transition: background .2s ease;
}

.site-mega__card:hover {
  background: var(--nav-blue-soft);
  text-decoration: none !important;
}

.site-mega__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.site-mega__icon--blue { background: linear-gradient(135deg, #2f7cf6, #56a0ff); }
.site-mega__icon--teal { background: linear-gradient(135deg, #1a9b6b, #2ec4b6); }
.site-mega__icon--cyan { background: linear-gradient(135deg, #00a3e0, #4fc3f7); }
.site-mega__icon--amber { background: linear-gradient(135deg, #f0a202, #f6c344); }
.site-mega__icon--slate { background: linear-gradient(135deg, #3d4f5f, #6b7c88); }
.site-mega__icon--rose { background: linear-gradient(135deg, #e85d75, #f08ca0); }

.site-mega__body h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--nav-text);
  line-height: 1.3;
}

.site-mega__body p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--nav-muted);
}

/* Right actions */
.site-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.site-search {
  position: relative;
}

.site-search__toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--nav-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, color .2s ease;
}

.site-search__toggle:hover {
  background: var(--nav-blue-soft);
  color: var(--nav-blue);
}

.site-search__panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  padding: 12px;
  padding-top: 16px;
  background: #fff;
  border: 1px solid var(--nav-line);
  border-radius: 10px;
  box-shadow: var(--nav-shadow);
  z-index: 1300;
}

.site-search__panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}

.site-search.is-open .site-search__panel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-search__input {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--nav-line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.site-search__input:focus {
  border-color: rgba(47, 124, 246, 0.45);
}

.site-search__go {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: var(--nav-blue);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
  white-space: nowrap;
}

.site-btn--primary {
  background: var(--nav-blue);
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(47, 124, 246, 0.28);
}

.site-btn--primary:hover {
  background: #1f6ae8;
  color: #fff !important;
  text-decoration: none !important;
  transform: translateY(-1px);
}

.site-btn--ghost {
  background: transparent;
  color: var(--nav-text) !important;
}

.site-btn--ghost:hover {
  background: var(--nav-blue-soft);
  color: var(--nav-blue) !important;
  text-decoration: none !important;
}

.site-user {
  position: relative;
}

.site-user__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 4px;
  border-radius: 20px;
  border: 1px solid var(--nav-line);
  background: #fff;
  color: var(--nav-text);
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  max-width: 140px;
}

.site-user__trigger:hover {
  border-color: rgba(47, 124, 246, 0.35);
  color: var(--nav-blue);
  text-decoration: none !important;
}

.site-user__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8eef5;
}

.site-user__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 72px;
}

.site-user__menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--nav-line);
  border-radius: 10px;
  box-shadow: var(--nav-shadow);
  list-style: none;
  margin: 0;
  z-index: 1300;
}

.site-user.is-open .site-user__menu {
  display: block;
}

.site-user__menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--nav-text);
  font-size: 13px;
  text-decoration: none !important;
}

.site-user__menu a:hover {
  background: var(--nav-blue-soft);
  color: var(--nav-blue);
}

.site-user__menu .divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--nav-line);
}

/* Mobile toggle */
.site-burger {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  margin-left: 4px;
}

.site-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--nav-text);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}

.site-header.is-menu-open .site-burger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-header.is-menu-open .site-burger span:nth-child(2) {
  opacity: 0;
}
.site-header.is-menu-open .site-burger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Spacer under fixed header — used by page body */
body > header + *,
.site-header-spacer {
  /* handled via header height in layout */
}

header.site-header-wrap {
  height: var(--nav-h);
  margin-bottom: 0;
}

/* Mobile drawer */
@media (max-width: 992px) {
  .site-burger {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--nav-line);
    box-shadow: var(--nav-shadow);
    padding: 12px 16px 20px;
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }

  .site-header.is-menu-open .site-nav {
    display: block;
  }

  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    gap: 4px;
  }

  .site-nav__item {
    height: auto;
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav__link {
    height: 44px;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
  }

  .site-nav__item.is-active > .site-nav__link::after {
    display: none;
  }

  .site-mega {
    position: static;
    transform: none;
    width: 100%;
    box-shadow: none;
    border: none;
    padding: 4px 0 8px;
    display: none;
    background: #f7f9fc;
    border-radius: 10px;
    margin-top: 4px;
  }

  .site-nav__item.is-open > .site-mega {
    display: block;
  }

  .site-nav__item:hover > .site-mega {
    display: none;
  }

  .site-nav__item.is-open:hover > .site-mega {
    display: block;
  }

  .site-mega__grid {
    grid-template-columns: 1fr;
  }

  .site-actions .site-btn--primary {
    padding: 0 12px;
  }

  .site-user__name,
  .site-btn--ghost {
    display: none;
  }

  .site-search__panel {
    right: -40px;
    width: min(280px, calc(100vw - 24px));
  }
}

@media (max-width: 520px) {
  .site-brand__logo {
    height: 34px;
  }

  .site-actions .site-btn--primary span.hide-xs {
    display: none;
  }
}
