/* 悬浮工具栏：墨色主体、橙色操作、纸色目录，所有导航尺寸在此集中维护。 */
:root {
  --nav-height: 84px;
  --directory-height: 48px;
  --nav-ink: #252d28;
  --nav-light: #f6f5f1;
  --nav-light-muted: #c4c9c2;
  --nav-surface: #faf9f6;
  --nav-muted: #60665f;
  --nav-accent: #a8411a;
  --nav-orange: #f18b60;
  --nav-motion: 180ms;
}
html { scroll-padding-top: calc(var(--nav-height) + 16px); }
html:has(.home-page) { scroll-padding-top: calc(var(--nav-height) + var(--directory-height) + 16px); }
.site-header { position: relative; z-index: 40; padding-block: 12px; background: var(--paper); }
html[data-navigation-ready] .site-header { position: sticky; top: 0; }
.nav-shell {
  position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px;
  width: calc(100% - 48px); max-width: 1080px; min-height: 60px; padding: 0 12px 0 18px;
  color: var(--nav-light); background: var(--nav-ink); border-radius: 14px;
  box-shadow: 0 8px 18px -14px #17251c70, inset 0 1px 0 #ffffff15;
}
.nav-shell > .brand { justify-self: start; gap: 10px; min-height: 44px; font-size: 22px; letter-spacing: -.9px; }
.nav-shell .brand img { width: 30px; height: 30px; padding: 5px; border-radius: 7px; background: var(--nav-light); }
.nav-shell .brand-dot { color: var(--nav-orange); }
.site-header svg { flex: none; width: 16px; height: 16px; stroke-width: 1.7; }
.desktop-nav { display: flex; align-items: center; gap: 22px; }
.desktop-nav > a { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding-inline: 3px; font-size: 14px; white-space: nowrap; color: var(--nav-light-muted); transition: color var(--nav-motion); }
.desktop-nav > a::after { content: ''; position: absolute; bottom: 4px; inset-inline: 3px; height: 2px; background: var(--nav-orange); transform: scaleX(0); transform-origin: left; transition: transform var(--nav-motion); }
.desktop-nav > a:hover, .desktop-nav > a[aria-current] { color: var(--nav-light); }
.desktop-nav > a[aria-current]::after { transform: scaleX(1); }
.mobile-menu > summary { cursor: pointer; list-style: none; }
.mobile-menu > summary::-webkit-details-marker { display: none; }
.mobile-menu > summary::marker { content: ''; }
.nav-actions { display: flex; align-items: center; justify-self: end; gap: 22px; }
.nav-github { display: flex; align-items: center; gap: 7px; min-height: 44px; color: var(--nav-light-muted); font-size: 12px; transition: color var(--nav-motion); }
.nav-github:hover { color: var(--nav-light); }
.header-cta { display: flex; align-items: center; gap: 14px; min-height: 44px; padding-left: 22px; border-left: 1px solid #ffffff24; color: var(--nav-light); font-size: 13px; white-space: nowrap; }
.cta-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--nav-orange); color: var(--nav-ink); transition: background var(--nav-motion), transform var(--nav-motion); }
.cta-icon svg { width: 18px; height: 18px; stroke-width: 2; }
.header-cta:hover .cta-icon { background: #ffac88; transform: translateY(2px); }
.header-cta[aria-current] > span:first-child { text-decoration: underline; text-underline-offset: 5px; }
.mobile-menu[open] .mobile-panel { animation: nav-enter 200ms cubic-bezier(.2,.8,.2,1); }
.mobile-menu { display: none; }
.site-header :is(a, summary):focus-visible { outline: 2px solid var(--nav-orange); outline-offset: 4px; border-radius: 3px; }
.mobile-panel a:focus-visible, .feature-jump-bar a:focus-visible { outline-color: var(--nav-accent); }
.site-header :is(a, summary), .feature-jump-bar a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.site-header :is(a, summary):active { opacity: .8; }
/* 功能目录仅在首页正文出现，固定在主导航下方。 */
.feature-jump-bar { position: sticky; top: var(--nav-height); z-index: 20; background: var(--paper); border-block: 1px solid var(--line); }
.feature-jump-bar > .section-shell { display: flex; align-items: center; gap: 36px; min-height: var(--directory-height); }
.feature-directory-label { font-size: 11px; color: var(--nav-muted); margin-right: auto; white-space: nowrap; }
.feature-jump-links { display: flex; align-items: stretch; align-self: stretch; gap: 30px; }
.feature-jump-links a { display: flex; position: relative; align-items: center; gap: 8px; min-height: var(--directory-height); color: var(--nav-muted); font-size: 12px; white-space: nowrap; transition: color var(--nav-motion); }
.feature-jump-links a > span { font-size: 10px; font-variant-numeric: tabular-nums; }
.feature-jump-links a:hover { color: var(--ink); }
.feature-jump-links a[aria-current] { color: var(--ink); font-weight: 700; }
.feature-jump-links a[aria-current] > span { color: var(--nav-accent); }
.feature-jump-links a::after { content: ''; position: absolute; bottom: -1px; inset-inline: 0; height: 2px; background: var(--nav-accent); transform: scaleX(0); transform-origin: left; transition: transform var(--nav-motion); }
.feature-jump-links a[aria-current]::after { transform: scaleX(1); }
.feature-back-top { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -12px; color: var(--nav-muted); }
.feature-back-top:hover { color: var(--ink); }
.feature-back-top svg { width: 16px; height: 16px; }
/* 无脚本时菜单参与文档流，锚点正文不会被展开菜单遮挡。 */
html:not([data-navigation-ready]) .feature-jump-bar { top: 0; }
@keyframes nav-enter { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1100px) {
  .nav-shell { gap: 20px; }
  .desktop-nav { gap: 20px; }
  .nav-actions { gap: 14px; }
  .nav-github > span { display: none; }
  .nav-github { justify-content: center; width: 44px; }
  .header-cta { padding-left: 16px; }
  .feature-directory-label { display: none; }
  .feature-jump-links { flex: 1; justify-content: space-between; gap: 20px; }
}
@media (max-width: 760px) {
  :root { --nav-height: 80px; --directory-height: 48px; }
  /* 手机锚点直接定位，避免菜单收起时平滑滚动停在吸顶栏后方。 */
  html { scroll-behavior: auto; }
  .nav-shell { width: calc(100% - 24px); min-height: 56px; grid-template-columns: 1fr auto auto; gap: 12px; padding-inline: 14px 10px; border-radius: 12px; }
  .nav-shell > .brand { font-size: 20px; gap: 8px; }
  .nav-shell .brand img { width: 28px; height: 28px; }
  .desktop-nav, .nav-github, .cta-product { display: none; }
  .header-cta { min-height: 44px; border: 0; padding: 0; gap: 9px; font-size: 12px; }
  .cta-icon { width: 30px; height: 30px; }
  .cta-icon svg { width: 15px; height: 15px; }
  .mobile-menu { display: block; }
  .mobile-menu > summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; color: var(--nav-light); border-left: 1px solid #ffffff24; padding-left: 12px; }
  .mobile-menu > summary > span { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .mobile-menu > summary svg { width: 21px; height: 21px; }
  .mobile-menu > summary .menu-close-icon { display: none; }
  .mobile-menu[open] > summary .menu-open-icon { display: none; }
  .mobile-menu[open] > summary .menu-close-icon { display: block; }
  .mobile-panel { position: absolute; top: calc(100% + 8px); left: 0; right: 0; padding: 12px 24px max(16px, env(safe-area-inset-bottom)); color: var(--ink); background: var(--nav-surface); border: 1px solid var(--line); border-radius: 12px; max-height: calc(100dvh - var(--nav-height) - 16px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 18px 30px -18px #17251c55; }
  html[data-mobile-menu-open] { overflow: hidden; }
  .mobile-page-links { display: grid; }
  .mobile-page-links a { display: flex; align-items: center; min-height: 60px; border-bottom: 1px solid var(--line); font-size: 20px; }
  .mobile-page-links a[aria-current] { font-weight: 650; color: var(--nav-accent); }
  .mobile-page-links a:hover, .mobile-github:hover { color: var(--nav-accent); }
  .mobile-github { display: flex; justify-content: space-between; align-items: center; min-height: 52px; font-size: 13px; color: var(--nav-muted); }
  .feature-jump-bar > .section-shell { gap: 0; }
  .feature-jump-links { gap: 0; }
  .feature-jump-links a { font-size: 12px; }
  .feature-jump-links a > span, .feature-back-top { display: none; }
  html:not([data-navigation-ready]) .site-header:has(details[open]) .nav-shell { display: grid; }
  html:not([data-navigation-ready]) .mobile-menu[open] { grid-column: 1 / -1; }
  html:not([data-navigation-ready]) .mobile-menu[open] > summary { width: max-content; margin-left: auto; }
  html:not([data-navigation-ready]) .mobile-panel { position: static; margin-top: 10px; padding-inline: 18px; max-height: none; box-shadow: none; }
}
@media (max-width: 360px) {
  .nav-shell { padding-inline: 12px 8px; gap: 10px; }
  .nav-shell > .brand { font-size: 18px; gap: 6px; }
  .nav-shell .brand img { width: 26px; height: 26px; }
  .header-cta { gap: 7px; }
  .mobile-panel { padding-inline: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .site-header *, .feature-jump-bar * { animation: none !important; transition: none !important; }
}
