/*
 * lawtools.top 全站顶栏「索引卡 · INDEX TABS」（2026-10，与 Fable 讨论定稿）。
 * 首页、内容页、工具页共用；交互逻辑在 brand.js 的「顶栏」一节。
 * 结构：.site-nav > .nav-inner > (.brand, .nav-links > .nav-item × 5 + .nav-ink + .nav-download, .nav-menu-btn)；手机端全屏菜单 .nav-sheet。
 */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: rgba(18, 18, 18, .9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background-color .3s ease;
}
.site-nav.is-scrolled { background: rgba(18, 18, 18, .96); }
/* 子页、工具页：顶栏是 fixed，用占位块撑出高度，滚动收窄时正文不跳 */
.nav-spacer { height: 72px; }
.nav-inner {
  width: min(1180px, 100% - 40px); margin: 0 auto; min-height: 72px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  transition: min-height .3s cubic-bezier(.65, 0, .35, 1);
}
.site-nav.is-scrolled .nav-inner { min-height: 58px; }
.site-nav a { text-decoration: none; }
.site-nav .brand {
  display: inline-flex; align-items: baseline; gap: 10px; white-space: nowrap;
  color: var(--text-hi); font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: .04em;
}
.site-nav .brand .mono-label { font-size: 10px; transition: color .3s ease; }
.site-nav.is-scrolled .brand .mono-label { color: var(--lime); }

/* ---------- 索引卡 ---------- */
.nav-links { position: relative; display: flex; align-items: center; gap: 4px; }
.nav-item {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 9px 14px 10px; border-radius: 12px;
  color: var(--text); transition: background-color .25s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover, .nav-item:focus-visible { background: rgba(255, 255, 255, .04); }
.nav-item:active { transform: scale(.95); }
.nav-num {
  grid-row: 1 / span 2; align-self: center; min-width: 2.2em;
  font: 600 11px/1 var(--font-mono); font-style: normal; letter-spacing: .08em; color: var(--text-mute);
  transition: color .25s ease;
}
.nav-zh { display: block; height: 1.25em; overflow: hidden; line-height: 1.25; font-family: var(--font-display); font-weight: 700; font-size: 15.5px; letter-spacing: .04em; }
.nav-zh > span { display: flex; flex-direction: column; transition: transform .38s cubic-bezier(.65, 0, .35, 1); }
.nav-zh > span::after { content: attr(data-text); color: var(--lime); }
.nav-en {
  display: block; height: 14px; overflow: hidden;
  font: 500 9.5px/14px var(--font-mono); font-style: normal; letter-spacing: .2em; text-transform: uppercase; color: var(--text-mute);
  transition: height .3s ease, opacity .3s ease;
}
.site-nav.is-scrolled .nav-en { height: 0; opacity: 0; }
.nav-item:hover .nav-zh > span, .nav-item:focus-visible .nav-zh > span { transform: translateY(-50%); }
.nav-item:hover .nav-num, .nav-item:focus-visible .nav-num,
.nav-item[aria-current="page"] .nav-num, .nav-item.is-active .nav-num { color: var(--lime); }
.nav-item[aria-current="page"] .nav-zh, .nav-item.is-active .nav-zh { color: var(--text-hi); }

/* 荧绿墨线：brand.js 写 transform，跟着悬停 / 当前项走 */
.nav-ink {
  position: absolute; left: 0; bottom: -2px; width: 1px; height: 2px; border-radius: 2px;
  background: var(--lime); box-shadow: 0 0 12px rgba(198, 243, 107, .6);
  transform-origin: left center; transform: translateX(0) scaleX(0);
  transition: transform .4s cubic-bezier(.65, 0, .35, 1), opacity .3s ease;
  pointer-events: none;
}

/* ---------- 下载药丸：全站唯一的荧绿实心 ---------- */
.nav-download {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: 8px; margin-left: 10px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  background: var(--lime); color: #0d0d0d !important;
  font-family: var(--font-display); font-weight: 800; font-size: 15px; letter-spacing: .04em;
  transition: transform .2s ease, box-shadow .25s ease;
}
.nav-download:hover { box-shadow: 0 0 0 5px rgba(198, 243, 107, .18), 0 10px 30px rgba(198, 243, 107, .25); }
.nav-download:active { transform: scale(.94); }
.dl-zh { display: block; height: 1.3em; overflow: hidden; line-height: 1.3; }
.dl-zh > span { display: flex; flex-direction: column; transition: transform .38s cubic-bezier(.65, 0, .35, 1); }
.dl-zh > span::after { content: attr(data-text); }
.nav-download:hover .dl-zh > span { transform: translateY(-50%); }
.dl-arrow { display: inline-block; overflow: hidden; width: 1em; height: 1em; line-height: 1; }
.dl-arrow i { display: block; font-style: normal; }
.nav-download:hover .dl-arrow i { animation: arrow-fly .5s cubic-bezier(.65, 0, .35, 1); }
@keyframes arrow-fly { 45% { transform: translate(110%, -110%); } 46% { transform: translate(-110%, 110%); } }
/* 加载时一道高光扫过 + 每隔几秒一圈呼吸环 */
.nav-download::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%) -150% 0 / 200% 100% no-repeat;
  animation: shine 1.4s ease .8s 1 both;
}
@keyframes shine { to { background-position: 250% 0; } }
.nav-download::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px var(--lime); opacity: 0;
  animation: breathe 5s ease-out 2.5s infinite;
}
@keyframes breathe { 0% { opacity: .9; transform: scale(1); } 18%, 100% { opacity: 0; transform: scale(1.35, 1.6); } }

/* ---------- 手机：菜单按钮 + 全屏菜单 ---------- */
.nav-menu-btn {
  display: none; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-hi);
  font: 700 14px/1 var(--font-body); cursor: pointer;
}
.nav-sheet {
  position: fixed; inset: 0; z-index: 59; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 90px 24px 32px; overflow-y: auto;
  background: var(--texture) 0 0 / 720px 720px, var(--bg);
}
.nav-sheet[hidden] { display: none; }
.nav-sheet a { text-decoration: none; }
.sheet-item {
  display: flex; align-items: baseline; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-weight: 800; font-size: 34px; color: var(--text-hi);
  opacity: 0; transform: translateY(24px);
}
.sheet-item i { font: 600 12px/1 var(--font-mono); font-style: normal; color: var(--lime); letter-spacing: .1em; }
.nav-sheet.is-open .sheet-item { animation: sheet-in .5s cubic-bezier(.22, .61, .36, 1) forwards; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes sheet-in { to { opacity: 1; transform: none; } }
.sheet-download {
  margin-top: 24px; display: flex; justify-content: center; align-items: center; height: 56px; border-radius: 999px;
  background: var(--lime); color: #0d0d0d; font-family: var(--font-display); font-weight: 800; font-size: 18px;
}
.sheet-foot { margin-top: 18px; text-align: center; }
body.menu-open { overflow: hidden; }

@media (max-width: 1060px) { .nav-en { display: none; } .nav-item { padding: 9px 10px; } }
@media (max-width: 860px) {
  .nav-item, .nav-ink { display: none; }
  .nav-menu-btn { display: inline-flex; align-items: center; }
  .site-nav .brand .mono-label { display: none; }
  .nav-inner { width: calc(100% - 32px); min-height: 60px; gap: 10px; }
  .nav-spacer { height: 60px; }
  .nav-links { margin-left: auto; }
  .nav-download { height: 40px; padding: 0 16px; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-zh > span, .dl-zh > span, .nav-ink, .nav-inner { transition: none; }
  .nav-item:hover .nav-zh > span, .nav-download:hover .dl-zh > span { transform: none; }
  .nav-download::before, .nav-download::after, .nav-download:hover .dl-arrow i { animation: none; display: none; }
  .nav-sheet.is-open .sheet-item { animation: none; opacity: 1; transform: none; }
}
