/* header.css — 单行统一 Header 组件（2026-11-27 包63：令牌已迁至 tokens.css）
   ------------------------------------------------------------------
   1. 全站 --kx-* 唯一来源是 web/static/tokens.css 的 @layer tokens；
      本文件不再定义任何 :root 变量，只引用 var(--kx-*)；
   2. tokens.css 由页面 <head> 的 <link> 提供（服务端按文件 mtime 置顶到第一个
      样式表位置，见 site_version.py）；本文件不再用串行引入 —— 串行引入会让首屏
      多等一个 RTT，也是导航闪烁（FOUC）的来源之一；
   3. 组件全部收进 @layer components，永远压得住 @layer base 的基础样式；
   4. Header 只有一份导航 DOM（.kx-nav-list），移动端由 CSS 收进抽屉；
   5. 质感口径：宣纸底、白卡、墨黑正文、朱砂主色、黛蓝辅助、细线边框，
      不用霓虹渐变与重阴影（卡片阴影上限 0 2px 6px rgba(24,24,27,.04)）。
   ------------------------------------------------------------------ */
@layer shell {

.kx-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--kx-h-height);
  background: var(--kx-h-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--kx-h-border);
  font-family: var(--kx-sans);
}

.kx-header-inner {
  position: relative;
  box-sizing: border-box;
  max-width: var(--kx-h-maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.kx-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  text-decoration: none;
  color: var(--kx-ink);
  flex-shrink: 0;
}

.kx-brand-zh {
  font-family: var(--kx-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .08em;
}

.kx-brand-en {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--kx-muted-2);
}

.kx-header[data-kx-lang="en"] .kx-brand-en {
  display: none;
}

.kx-header[data-kx-lang="en"] .kx-brand-zh {
  font-size: 18px;
  letter-spacing: .02em;
}

/* 面板 = 单一导航 + 语言 + 主按钮；桌面横排，移动端整体变抽屉。
   2026-11-27 包73：Header 面板类名改为 kx-hpanel。kryxel-atlas.css 与
   dist/app.*.css 里的 kx-panel 是图谱面板（min-width:0），同名会把
   Header 的 flex:1 1 auto 吃掉，导致 /tools/ 等页导航挤成两行。 */
.kx-hpanel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.kx-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.kx-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 22px;
}

.kx-nav-list a {
  display: inline-flex;
  align-items: center;
  height: var(--kx-h-height);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--kx-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}

.kx-nav-list a:hover {
  color: var(--kx-cinnabar);
}

.kx-nav-list a.kx-nav-active,
.kx-nav-list a[aria-current="page"] {
  color: var(--kx-cinnabar);
  font-weight: 600;
  border-bottom-color: var(--kx-cinnabar);
}

.kx-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.kx-lang {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--kx-line);
  border-radius: var(--kx-radius);
  background: var(--kx-card);
}

.kx-lang a {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  /* 包79：landing.html 内联 <style> 里的无层 a{color:inherit} 会压掉本层颜色，
     这里显式 !important 兜底，保证语言切换两态都按设计色渲染 */
  color: var(--kx-muted, #5B5650) !important;
  text-decoration: none;
  white-space: nowrap;
}

.kx-lang a.is-current,
.kx-lang a[aria-current="true"] {
  background: var(--kx-ink, #18181B);
  /* 深墨底上强制亮宣纸白（修复黑底黑字） */
  color: var(--kx-on-ink, #FAF8F4) !important;
  font-weight: 600;
}

.kx-app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--kx-radius);
  background: var(--kx-cinnabar);
  color: var(--kx-on-accent) !important;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
  white-space: nowrap;
}

.kx-app-btn:hover {
  background: var(--kx-cinnabar-hover);
}

.kx-app-btn[aria-current="page"] {
  outline: 1px solid var(--kx-ink);
  outline-offset: 2px;
}

.kx-burger {
  display: none;
  width: 38px;
  height: 38px;
  padding: 8px;
  border: 1px solid var(--kx-line);
  border-radius: var(--kx-radius);
  background: var(--kx-card);
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.kx-burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--kx-ink);
  border-radius: 1px;
}

/* 移动端：同一份 DOM 收进抽屉（不重复渲染第二套导航） */
@media (max-width: 720px) {
  .kx-burger {
    display: inline-flex;
    margin-left: auto;
  }

  .kx-hpanel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 18px 16px;
    background: var(--kx-paper);
    border-bottom: 1px solid var(--kx-line);
    box-shadow: var(--kx-shadow-panel);
  }

  .kx-hpanel[data-open="false"] {
    display: none;
  }

  .kx-nav {
    justify-content: flex-start;
  }

  .kx-nav-list {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .kx-nav-list a {
    height: auto;
    min-height: 46px;
    padding: 0 10px;
    border-bottom: 0;
    border-left: 2px solid transparent;
  }

  .kx-nav-list a.kx-nav-active,
  .kx-nav-list a[aria-current="page"] {
    background: var(--kx-stone);
    border-left-color: var(--kx-cinnabar);
  }

  .kx-actions {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--kx-line);
    justify-content: space-between;
    gap: 12px;
  }

  .kx-app-btn {
    flex: 1 1 auto;
    height: 42px;
    margin-left: 8px;
  }
}

/* ---------- 全站三栏页脚（footer_renderer 输出） ---------- */
.site-foot {
  box-sizing: border-box;
  /* 2026-11-27 包73：给左下角固定件（#kxSettings / .kx-nudge）留出安全区，
     页脚最后一行（13+/18+ 合规行）不再被浮层压住；footer_renderer 的
     内联 padding 与这里同一口径，缺失安全区变量时回落 48px。 */
  padding-bottom: calc(20px + var(--kx-safe-bottom, 48px));
}

.site-foot-3col {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1.1fr;
  gap: 26px;
  align-items: start;
  font-family: var(--kx-sans);
  color: var(--kx-muted-2);
}

.site-foot .sf-col-head {
  font-family: var(--kx-serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--kx-ink);
  margin: 0 0 .5rem;
}

.site-foot .sf-col p {
  margin: 0 0 .45rem;
}

.site-foot .sf-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-foot .sf-links li {
  margin: 0;
}

.site-foot a {
  color: var(--kx-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}

.site-foot a:hover {
  color: var(--kx-cinnabar);
  border-bottom-color: var(--kx-line);
}

.site-foot .sf-age {
  grid-column: 1 / -1;
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--kx-line);
  font-size: 12px;
  line-height: 1.7;
  color: var(--kx-muted-2);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

@media (max-width: 760px) {
  .site-foot-3col {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

} /* @layer shell 结束（header.css） */
