/* 顶栏 — 三栏网格：品牌 | 居中导航轨 | 工具区 */

.header.page-header-parent {
  --nav-h: 72px;
  --nav-accent: var(--theme-accent);
  --nav-accent-soft: rgba(var(--theme-accent-rgb), 0.1);
  --nav-text: var(--theme-ink);
  --nav-muted: var(--theme-muted);
  display: block;
  height: auto;
  min-height: var(--nav-h);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid rgba(var(--theme-accent-rgb), 0.12);
  box-shadow: 0 8px 32px rgba(var(--theme-ink-rgb), 0.06);
}

.header.page-header-parent::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--theme-gradient-nav-line);
  opacity: 0.65;
  pointer-events: none;
}

.header.page-header-parent.is-home {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 24px rgba(30, 27, 75, 0.04);
}

.header.page-header-parent.is-inner {
  background: rgba(255, 255, 255, 0.96);
}

.header.page-header-parent .section {
  position: relative;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 36px);
  height: var(--nav-h);
  box-sizing: border-box;
}

/* 三栏网格壳 */
.header__shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  width: 100%;
  height: 100%;
  min-width: 0;
}

.header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header .logo a {
  display: flex;
  align-items: center;
  padding: 4px 0;
}

.header .logo img {
  height: 28px;
  width: auto;
  max-height: 42px;
  transition: transform 0.2s ease;
}

.header .logo a:hover img {
  transform: scale(1.02);
}

/* 居中导航轨 */
.header__center {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.header__nav-rail {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(var(--theme-accent-rgb), 0.08) 0%, rgba(var(--theme-accent-rgb), 0.04) 100%);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.header .nav {
  margin-left: 0;
  display: flex;
  min-width: 0;
  overflow: visible;
}

.header .nav ul {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.header .nav li {
  min-width: 0;
  margin-right: 0;
  position: relative;
}

.header .nav li a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--nav-muted);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.header .nav li:hover a {
  color: var(--nav-accent);
  background: rgba(255, 255, 255, 0.72);
}

.header .nav li.active a {
  color: #fff;
  font-weight: 600;
  background: var(--theme-gradient-btn-diag);
  box-shadow: 0 4px 14px rgba(var(--theme-accent-rgb), 0.35);
}

.header .nav li.active::after {
  display: none;
}

.header .nav li.nav-item--promo > a {
  padding: 6px 14px 6px 10px;
  border: 1px solid #ff6b6b;
  border-radius: 999px;
  color: #ff4d4f !important;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 77, 79, 0.06);
  box-shadow: none;
}

.header .nav li.nav-item--promo > a::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff4d4f'%3E%3Cpath d='M12 23c-1.1 0-2-.9-2-2h4c0 1.1-.9 2-2 2zm6-6.5V9c0-3.1-2.1-5.7-5-6.4V1h-2v1.6C8.1 3.3 6 5.9 6 9v7.5l-2 2V19h16v-.5l-2-2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.header .nav li.nav-item--promo:hover > a {
  background: rgba(255, 77, 79, 0.12);
  color: #ff4d4f !important;
}

.header .nav li.nav-item--promo.active > a {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
  border-color: transparent;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(255, 77, 79, 0.35);
}

.header .nav li.nav-item--dropdown > a::after {
  content: "\25BE";
  margin-left: 2px;
  font-size: 11px;
  line-height: 1;
  opacity: 0.55;
}

/* 右侧工具区 */
.header__aside {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px;
  border-radius: 999px;
  background: rgba(244, 245, 255, 0.9);
  border: 1px solid rgba(var(--theme-accent-rgb), 0.14);
}

.header__actions-group {
  display: flex;
  align-items: center;
}

.header__actions-group--lang {
  padding: 0 4px 0 8px;
}

.header__actions-group--auth {
  padding: 0 4px 0 0;
  border-left: 1px solid rgba(var(--theme-accent-rgb), 0.14);
}

.header .lang-switch {
  margin-left: 0;
}

.header .lang-switch-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--nav-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
}

.header .lang-switch-trigger::before {
  content: "";
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2352527a' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a15 15 0 0 1 0 18M12 3a15 15 0 0 0 0 18'/%3E%3C/svg%3E") center/contain no-repeat;
}

.header .lang-switch:hover .lang-switch-trigger,
.header .lang-switch-trigger:focus-visible {
  background: rgba(var(--theme-accent-rgb), 0.08);
  color: var(--nav-accent);
}

.header .link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto !important;
  padding: 0 4px;
}

.header .login {
  margin-right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--nav-text);
  font-weight: 500;
  border: 1px solid rgba(var(--theme-accent-rgb), 0.2);
  background: #fff;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.header .login:hover {
  color: var(--nav-accent);
  border-color: rgba(var(--theme-accent-rgb), 0.45);
  background: rgba(var(--theme-accent-rgb), 0.04);
}

.header .register {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--theme-gradient-btn-diag);
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  border: none;
  box-shadow: 0 4px 14px rgba(var(--theme-accent-rgb), 0.32);
}

.header .register:hover {
  background: var(--theme-gradient);
  filter: brightness(0.95);
}

.header .mobile-icon {
  display: none;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(var(--theme-accent-rgb), 0.16);
  background: rgba(244, 245, 255, 0.95);
}

.header > .section > span[style*="font-size: 20px"] {
  display: none !important;
}

@media (max-width: 1199px) {
  .header__nav-rail {
    padding: 4px;
  }

  .header .nav li a {
    padding: 7px 12px;
    font-size: 13px;
  }
}

@media (max-width: 991px) {
  .header.page-header-parent {
    --nav-h: 64px;
  }

  .header__shell {
    grid-template-columns: auto 1fr auto;
  }

  /* 保留 nav 供移动端全屏菜单使用，仅隐藏桌面导航轨视觉 */
  .header__center {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 1300;
  }

  .header__nav-rail {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }

  .header .nav {
    pointer-events: auto;
  }

  .header__actions {
    display: none;
  }

  .header .mobile-icon {
    display: inline-flex;
  }
}

body:has(.header.page-header-parent) {
  padding-top: var(--nav-h, 72px);
}

@media (max-width: 991px) {
  body:has(.header.page-header-parent) {
    padding-top: 64px;
  }
}

@media (max-width: 767px) {
  .header.page-header-parent {
    --nav-h: 56px;
  }

  body:has(.header.page-header-parent) {
    padding-top: 56px;
  }

  .header.page-header-parent .section {
    height: 56px;
    padding: 0 14px;
  }

  .header__brand {
    min-width: 0;
    flex-shrink: 1;
  }

  .header .logo img {
    height: 34px;
    max-width: 40px;
    width: auto;
  }

  .header .mobile-icon {
    width: 36px;
    height: 36px;
  }
}
