/* ============================================================
   OLOBAY · 全站统一导航组件 v1
   由 assets/site-nav.js 渲染 <olobay-nav> 生成，样式全部命名空间化，
   不依赖页面变量、不复用页面 .nav 选择器，可在任意页面直接引入。
   结构：品牌 · 产品▾ / 动态 / 研博 / 文档 / 技巧 / 问答 / 资源 / 拆解实验室
         右侧：登录或用户 · 下载 CTA · 移动端汉堡
   ============================================================ */

olobay-nav {
  display: block;
  position: sticky;
  top: 0;
  z-index: 300;
  height: 64px;
}
html.sn-lock { overflow: hidden; }

.site-nav {
  --sn-fg: #EDE8F7;
  --sn-dim: rgba(226, 220, 241, 0.64);
  --sn-line: rgba(255, 255, 255, 0.08);
  --sn-accent: #FF6B35;
  --sn-gold: #FFD166;
  --sn-coral: #FF4D7E;
  --sn-surface: rgba(255, 255, 255, 0.055);
  --sn-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  position: relative;
  height: 100%;
  background: linear-gradient(180deg, rgba(18, 12, 30, 0.92), rgba(18, 12, 30, 0.74));
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  border-bottom: 1px solid var(--sn-line);
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--sn-fg);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.site-nav.is-scrolled {
  background: rgba(13, 8, 23, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
}

.sn-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- 品牌 ---------- */
.sn-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--sn-fg);
  text-decoration: none;
  border-radius: 10px;
}
.sn-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--sn-accent), var(--sn-coral));
  color: #FFF6EC;
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 0 16px rgba(255, 107, 53, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.sn-type { display: flex; flex-direction: column; line-height: 1.1; }
.sn-type b {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}
.sn-type i {
  font-style: normal;
  font-family: var(--sn-mono);
  font-size: 0.47rem;
  letter-spacing: 0.3em;
  color: var(--sn-dim);
  margin-top: 3px;
}

/* ---------- 主导航 ---------- */
.sn-links {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  margin: 0 auto;
}
.sn-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 1px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--sn-dim);
  text-decoration: none;
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.18s ease;
}
.sn-link:hover { color: #fff; }
.sn-link.is-active { color: #fff; }
.sn-link.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--sn-accent), var(--sn-gold));
}
.sn-link--lab { color: var(--sn-gold); }
.sn-link--lab:hover { color: #FFE7A8; }
.sn-link--lab.is-active::after { background: var(--sn-gold); }
.sn-link--lab i { font-style: normal; font-size: 0.78rem; opacity: 0.9; }

/* ---------- 产品下拉 ---------- */
.sn-prod { position: relative; }
.sn-caret {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid currentColor;
  margin-top: 2px;
  opacity: 0.7;
  transition: transform 0.2s ease;
}
.sn-prod.open .sn-caret { transform: rotate(180deg); }
.sn-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: -14px;
  width: 292px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(21, 14, 36, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 209, 102, 0.05);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 5;
}
.sn-prod:hover .sn-menu,
.sn-prod:focus-within .sn-menu,
.sn-prod.open .sn-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.sn-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--sn-fg);
  text-decoration: none;
  transition: background 0.15s ease;
}
.sn-menu a:hover { background: var(--sn-surface); }
.sn-menu a b { display: block; font-size: 0.82rem; font-weight: 700; }
.sn-menu a span { display: block; margin-top: 2px; font-size: 0.68rem; color: var(--sn-dim); }

/* ---------- 右侧动作区 ---------- */
.sn-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.sn-auth { display: flex; align-items: center; }

.sn-skeleton {
  width: 78px;
  height: 31px;
  border-radius: 100px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: sn-shimmer 1.4s infinite;
}
@keyframes sn-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 7px 17px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sn-fg);
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.sn-ghost:hover {
  color: var(--sn-accent);
  border-color: var(--sn-accent);
  box-shadow: 0 0 16px rgba(255, 107, 53, 0.18);
}

.sn-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.sn-user:hover { background: var(--sn-surface); }
.sn-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--sn-accent), #D4541A);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.28);
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
}
.sn-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.sn-uname {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
}
.sn-drop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 262px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(21, 14, 36, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 6;
}
.sn-drop.open { opacity: 1; visibility: visible; transform: translateY(0); }
.sn-drop-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--sn-line); margin-bottom: 6px; }
.sn-drop-head b { display: block; font-size: 0.84rem; }
.sn-drop-head span { display: block; font-family: var(--sn-mono); font-size: 0.66rem; color: var(--sn-dim); margin-top: 3px; word-break: break-all; }
.sn-drop-head em {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 700;
  background: rgba(255, 107, 53, 0.12);
  color: var(--sn-accent);
  border: 1px solid rgba(255, 107, 53, 0.2);
}
.sn-drop-head em.badge-admin { background: rgba(255, 209, 102, 0.12); color: var(--sn-gold); border-color: rgba(255, 209, 102, 0.25); }
.sn-drop-item {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--sn-fg);
  text-decoration: none;
  cursor: pointer;
}
.sn-drop-item:hover { background: var(--sn-surface); }
.sn-drop-item.is-danger { color: #FF8AA4; }
.sn-drop-sep { height: 1px; background: var(--sn-line); margin: 6px 8px; }

.sn-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--sn-accent), var(--sn-coral));
  color: #FFF6EC;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(255, 107, 53, 0.34);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.sn-cta:hover { transform: translateY(-1px); box-shadow: 0 7px 24px rgba(255, 107, 53, 0.45); }
.sn-cta.is-active { outline: 2px solid rgba(255, 209, 102, 0.8); outline-offset: 2px; }
.sn-brand[aria-current="page"] .sn-type b { color: var(--sn-gold); }
.sn-brand[aria-current="page"] .sn-mark { box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.55), 0 0 18px rgba(255, 107, 53, 0.45); }

.sn-burger {
  display: none;
  width: 38px;
  height: 34px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: none;
  cursor: pointer;
}
.sn-burger i {
  display: block;
  width: 16px;
  height: 1.6px;
  border-radius: 2px;
  background: var(--sn-fg);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.sn-burger.is-open i:nth-child(1) { transform: translateY(5.6px) rotate(45deg); }
.sn-burger.is-open i:nth-child(2) { opacity: 0; }
.sn-burger.is-open i:nth-child(3) { transform: translateY(-5.6px) rotate(-45deg); }

/* ---------- 移动端抽屉 ---------- */
.sn-drawer {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 299;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: rgba(13, 8, 23, 0.985);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(255, 209, 102, 0.14);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
.sn-drawer.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.sn-drawer-in { padding: 18px 22px 24px; max-width: 640px; margin: 0 auto; }
.sn-drawer-h {
  font-family: var(--sn-mono);
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  color: var(--sn-gold);
  margin: 16px 0 6px;
}
.sn-drawer-h:first-child { margin-top: 0; }
.sn-drawer a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 2px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--sn-fg);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}
.sn-drawer a small { font-family: var(--sn-mono); font-size: 0.62rem; color: var(--sn-dim); font-weight: 400; }
.sn-drawer a.is-active { color: var(--sn-gold); }
.sn-drawer .sn-drawer-lab { color: var(--sn-gold); }
.sn-drawer-actions { display: flex; gap: 10px; margin-top: 20px; }
.sn-drawer-actions .sn-ghost, .sn-drawer-actions .sn-cta { justify-content: center; flex: 1; padding: 11px 16px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .sn-links { display: none; }
  .sn-burger { display: inline-flex; }
  .sn-inner { gap: 14px; padding: 0 20px; }
}
@media (max-width: 720px) {
  olobay-nav { height: 58px; }
  .site-nav { height: 58px; }
  .sn-drawer { top: 58px; max-height: calc(100vh - 58px); }
  .sn-inner { padding: 0 14px; gap: 10px; }
  .sn-type i { display: none; }
  .sn-type b { font-size: 0.84rem; }
  .sn-mark { width: 27px; height: 27px; border-radius: 8px; font-size: 13px; }
  .sn-uname { display: none; }
  .sn-user { padding: 3px; }
  .sn-cta { padding: 7px 14px; font-size: 0.78rem; }
  .sn-actions { gap: 8px; }
}
@media (max-width: 400px) {
  #nav-login-btn { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav *, .sn-drawer { transition: none !important; animation: none !important; }
}
@media print {
  olobay-nav, .sn-drawer { display: none !important; }
}

.sn-brand:focus-visible, .sn-link:focus-visible, .sn-menu a:focus-visible,
.sn-ghost:focus-visible, .sn-cta:focus-visible, .sn-burger:focus-visible,
.sn-user:focus-visible, .sn-drop-item:focus-visible, .sn-drawer a:focus-visible {
  outline: 2px solid var(--sn-gold);
  outline-offset: 2px;
}