/*
 * 全站顶部功能导航（2026-10 起替换左侧栏）。
 * 主站 index.php 把本文件内联进 <head>（首屏不用等 app.css）；节点工作流在 main.jsx 里 import 同一份。
 * 默认深色，跟各工具页一致；首页用 data-theme="light"。
 * 宽屏一行排开；窄于 1080px 收进「功能」菜单（2026-10-22 加了 AI PPT、AI 3D 共 12 项，1024 宽排不下）。
 */
:root { --site-nav-h: 56px; }

.site-nav {
  position: sticky;
  top: 0;
  /* 压在普通弹窗遮罩（40）之上：自动弹出的说明框也挡不住切换栏目；改密码等主动打开的弹窗（70+）仍盖住它 */
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  height: var(--site-nav-h);
  padding: 0 clamp(12px, 1.5vw, 24px);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  background: linear-gradient(180deg, #0e121b 0%, #0a0d14 100%);
  color: #e7ecf5;
  font-family: "Ziheng UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.2;
  letter-spacing: 0;
}
.site-nav *,
.site-nav *::before,
.site-nav *::after { box-sizing: border-box; }
.site-nav a { color: inherit; text-decoration: none; }
.site-nav svg { display: block; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.site-nav__brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 8px 0 2px;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.site-nav__brand img {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #fff;
}
.site-nav__current { display: none; }

.site-nav__links {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.site-nav__links::-webkit-scrollbar { display: none; }
/* 宽屏时整排居中；放不下时自动外边距归零，照常可横向滚动、不会裁掉开头 */
.site-nav__links > a:first-child { margin-left: auto; }
.site-nav__links > a:last-child { margin-right: auto; }
.site-nav__links a {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  color: rgba(226, 232, 243, .72);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .15s ease, background-color .15s ease;
}
.site-nav__links a:hover,
.site-nav__links a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .07);
  outline: none;
}
.site-nav__links a.is-active {
  color: #fff;
  background: rgba(255, 255, 255, .13);
}
.site-nav__links a.is-active::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -10px;
  left: 12px;
  height: 2px;
  border-radius: 2px;
  background: #5b8cff;
}

.site-nav__account {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.site-nav__account svg { width: 17px; height: 17px; }
.site-nav__account:hover,
.site-nav__account:focus-visible { border-color: rgba(255, 255, 255, .34); background: rgba(255, 255, 255, .08); outline: none; }
.site-nav__account.is-active { border-color: #fff; background: #fff; color: #0b0e15; }

/* 窄屏才出现的「功能」按钮。全局 button 样式（app.css）会加圆角、背景和悬停上浮，这里全部压回去 */
.site-nav .site-nav__toggle {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  height: 36px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transform: none;
}
.site-nav .site-nav__toggle:hover,
.site-nav .site-nav__toggle:active { background: rgba(255, 255, 255, .08); box-shadow: none; transform: none; }
.site-nav .site-nav__toggle svg { width: 18px; height: 18px; }
.site-nav__toggle .site-nav__icon-close { display: none; }
.site-nav.is-open .site-nav__toggle .site-nav__icon-menu { display: none; }
.site-nav.is-open .site-nav__toggle .site-nav__icon-close { display: block; }

/* 首页：浅色 */
.site-nav[data-theme="light"] {
  border-bottom-color: #e5eaf3;
  background: rgba(255, 255, 255, .96);
  color: #1d2943;
}
.site-nav[data-theme="light"] .site-nav__brand { color: #101a33; }
.site-nav[data-theme="light"] .site-nav__brand img { box-shadow: 0 0 0 1px #e5eaf3; }
.site-nav[data-theme="light"] .site-nav__links a { color: #4a5670; }
.site-nav[data-theme="light"] .site-nav__links a:hover,
.site-nav[data-theme="light"] .site-nav__links a:focus-visible { color: #0f1b33; background: #f1f4f9; }
.site-nav[data-theme="light"] .site-nav__links a.is-active { color: #1764ff; background: #edf3ff; }
.site-nav[data-theme="light"] .site-nav__links a.is-active::after { background: #1764ff; }
.site-nav[data-theme="light"] .site-nav__account,
.site-nav[data-theme="light"] .site-nav__toggle { border-color: #cfdcf3; color: #1764ff; }
.site-nav[data-theme="light"] .site-nav__account:hover,
.site-nav[data-theme="light"] .site-nav__account:focus-visible,
.site-nav[data-theme="light"] .site-nav__toggle:hover { border-color: #9dbbff; background: #f3f7ff; }
.site-nav[data-theme="light"] .site-nav__account.is-active { border-color: #1764ff; background: #1764ff; color: #fff; }

@media (max-width: 1199px) and (min-width: 1080px) {
  .site-nav { gap: 8px; }
  .site-nav__brand { padding-right: 2px; }
  .site-nav__brand span { display: none; }
  .site-nav__links a { padding: 0 9px; font-size: 13.5px; }
  .site-nav__links a.is-active::after { right: 9px; left: 9px; }
  .site-nav__account { padding: 0 11px; }
}

@media (max-width: 1079px) {
  :root { --site-nav-h: 52px; }
  .site-nav { gap: 8px; }
  .site-nav__brand span { display: none; }
  .site-nav__current {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font-size: 15px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .site-nav .site-nav__toggle { display: inline-flex; }
  .site-nav__account { width: 36px; padding: 0; justify-content: center; }
  .site-nav__account span { display: none; }
  .site-nav__links {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    height: auto;
    max-height: calc(100vh - var(--site-nav-h));
    padding: 10px 12px 14px;
    overflow-y: auto;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: #0d1119;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  }
  .site-nav.is-open .site-nav__links { display: grid; }
  .site-nav__links a {
    height: 46px;
    padding: 0 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    font-size: 15px;
  }
  .site-nav__links a.is-active::after { display: none; }
  .site-nav__links > a:first-child,
  .site-nav__links > a:last-child { margin: 0; }
  .site-nav[data-theme="light"] .site-nav__links { border-bottom-color: #e5eaf3; background: #fff; box-shadow: 0 18px 40px rgba(15, 30, 60, .14); }
  .site-nav[data-theme="light"] .site-nav__links a { background: #f5f7fb; }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav * { transition: none !important; }
}
