/**
 * 顶栏第一、二行合并为单行：仅左侧返回；右侧 APP / 登录 / 语言 / 搜索。
 * 默认（窄屏）：与原布局一致，Logo+公司名靠左顺序横排。
 * 宽屏（≥901px）：Logo+公司名在页面水平居中，不与右侧工具条重叠。
 */
/* 桌面顶栏高度；窄屏 :root --nav-h 由 breakpoints.css / mobile-public.css 覆盖 */
@media (min-width: 901px) {
  :root {
    --nav-h: clamp(108px, 18vw + 52px, 168px);
  }
}

/* —— 窄屏 / 默认：flex 左对齐（与改前一致）—— */
.site-header .header-row--topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--hdr-row-gap, clamp(4px, 1vw, 10px));
  flex-wrap: nowrap;
  min-height: max(var(--hdr-r1-min-h, 52px), var(--hdr-r2-min-h, var(--header-r2-r3-strip, 44px)));
  padding-block: var(--hdr-row-padding-block, 6px);
  padding-inline: var(--hdr-row-padding-inline, clamp(6px, 1.8vw, 12px));
}

.site-header .header-row--topbar .header-brand-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.site-header .header-row--topbar .header-brand-cluster {
  min-width: 0;
  max-width: 100%;
}

.site-header .header-row--topbar .brand-link {
  min-width: 0;
}

.site-header .header-row--topbar .brand-zh,
.site-header .header-row--topbar .brand-en {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header .header-topbar-tools {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(4px, 1vw, 10px);
  flex-wrap: nowrap;
  border-bottom: none;
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  color: var(--hdr-row-text, var(--nav-theme-text));
  font-size: var(
    --hdr-row-font-size,
    var(--nav-theme-tools-font-size, var(--nav-theme-font-size, clamp(17px, 5.2vw, 21px)))
  );
}

.site-header .header-topbar-tools__inner {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--hdr-r1-tools-gap, clamp(4px, 1vw, 10px));
}

.site-header .header-row--topbar .header-r2-inner {
  flex: 0 0 auto;
  min-width: 0;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--hdr-r1-tools-gap, clamp(4px, 1vw, 10px));
}

.site-header .header-row--topbar .nav-history-edge--right {
  display: none !important;
}

/* —— 宽屏：三列等宽，品牌独占中间列，真居中且不与工具条叠压 —— */
@media (min-width: 901px) {
  .site-header .header-row--topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex-wrap: unset;
  }

  .site-header .header-row--topbar .nav-history-edge--left {
    grid-column: 1;
    justify-self: start;
  }

  .site-header .header-row--topbar .header-brand-wrap {
    grid-column: 2;
    justify-self: center;
    flex: none;
    width: auto;
    max-width: min(100%, 640px);
    justify-content: center;
  }

  .site-header .header-row--topbar .header-brand-cluster {
    justify-content: center;
  }

  .site-header .header-topbar-tools {
    grid-column: 3;
    justify-self: end;
    flex: none;
    max-width: none;
    overflow: visible;
  }

  /* 宽屏工具区：搜索 + 登录/语言 成组对齐，避免元素松散、叠影 */
  .site-header .header-topbar-tools__inner {
    align-items: center;
    gap: var(--hdr-r1-tools-gap, var(--hdr-row-gap, 12px));
  }

  .site-header .header-row--topbar .brand-zh {
    font-size: var(--hdr-r1-brand-fs, clamp(14px, 1vw, 15px));
    line-height: 1.2;
  }

  .site-header .header-row--topbar .brand-en {
    font-size: var(--hdr-r1-en-fs, 10px);
    line-height: 1.25;
    margin-top: 2px;
  }

  .site-header .header-search-trigger {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--hdr-search-red, #0ea5e9) 36%, transparent);
  }

  .site-header .header-search-trigger__icon {
    width: var(--hdr-r1-search-icon, 22px);
    height: var(--hdr-r1-search-icon, 22px);
  }

  .site-header .header-topbar-tools {
    font-size: var(--hdr-r1-tools-fs, 12px);
  }

  /* 宽屏与窄屏一致：搜索 + 登录/语言/账户 横排文字链，无胶囊底 */
  .site-header .header-r2-inner {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--hdr-r1-tools-gap, var(--hdr-row-gap, clamp(8px, 1.2vw, 14px)));
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .site-header .header-r2-auth {
    display: inline-flex;
    align-items: center;
    gap: var(--hdr-r1-tools-gap, var(--hdr-row-gap, clamp(6px, 1vw, 12px)));
    padding: 0;
  }

  .site-header .header-tools {
    display: inline-flex;
    align-items: center;
    gap: var(--hdr-r1-tools-gap, var(--hdr-row-gap, clamp(6px, 1vw, 12px)));
    padding: 0;
    margin: 0;
    border-left: none;
  }
}
