/* ============================================================
   JINER Blog — Navigation System
   导航栏 · 移动抽屉 · 底部导航 · 搜索弹窗
   ============================================================ */

/* ---------- 顶部导航栏 ---------- */
.nav-main {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-height, 60px);
  transition: box-shadow .3s ease, background-color .3s ease;
}

/* 玻璃拟态背景层 */
.nav-glass {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--color-border-light, rgba(0,0,0,.06));
  transition: background-color .3s ease, border-color .3s ease;
}

[data-theme="dark"] .nav-glass {
  background: rgba(15, 13, 26, 0.72);
  border-bottom-color: rgba(230, 227, 242, 0.07);
}

/* 导航滚动后加阴影 */
.nav-main.nav-scrolled .nav-glass {
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.08));
}

/* 首页 Hero：悬浮在渐变上，不要一条奶白色带子 */
.nav-main.nav-hero:not(.nav-scrolled) .nav-glass {
  background: rgba(255, 255, 255, 0.55);
  border-bottom-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}
[data-theme="dark"] .nav-main.nav-hero:not(.nav-scrolled) .nav-glass {
  background: rgba(15, 13, 26, 0.45);
  border-bottom-color: rgba(167, 139, 250, 0.14);
}

.nav-inner {
  position: relative;
  height: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ---------- Logo ---------- */
.nav-logo {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  text-decoration: none;
  flex-shrink: 0;
  user-select: none;
}
.nav-logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, var(--color-accent, #6d28d9), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.nav-logo-dot {
  color: var(--color-accent, #6d28d9);
  font-weight: 800;
  font-size: 1.2rem;
}
.nav-logo-sub {
  font-size: .9rem;
  font-weight: 500;
  color: var(--color-text-muted, #8b86a8);
}

/* ---------- 桌面导航链接 ---------- */
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: var(--text-sm, .875rem);
  font-weight: 500;
  color: var(--color-text-secondary, #57517a);
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}
.nav-links a:hover {
  color: var(--color-accent, #6d28d9);
  background: var(--color-accent-soft, rgba(109,40,217,.08));
}
.nav-links a.active {
  color: var(--color-accent, #6d28d9);
  background: var(--color-accent-soft, rgba(109,40,217,.08));
  font-weight: 600;
}

/* ---------- 右侧操作区 ---------- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary, #57517a);
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease, transform .2s ease;
}
.nav-icon-btn:hover {
  color: var(--color-accent, #6d28d9);
  background: var(--color-accent-soft, rgba(109,40,217,.08));
  transform: translateY(-1px);
}

/* 主题图标：亮/暗/自动三态切换时只显示对应图标 */
.icon-sun, .icon-moon { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }
html:not([data-theme="dark"]) .icon-sun { display: block; }

/* ---------- 汉堡按钮 ---------- */
.nav-hamburger {
  display: none;
  position: relative;
  width: 40px; height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-hamburger span {
  display: block;
  width: 20px; height: 2px;
  border-radius: 2px;
  background: var(--color-text-secondary, #57517a);
  transition: transform .3s cubic-bezier(.16,1,.3,1), opacity .2s ease;
}
.nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 移动端抽屉 ---------- */
.nav-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(300px, 84vw);
  z-index: 1002;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 80px 24px 32px;
  background: var(--color-surface, #fff);
  border-left: 1px solid var(--color-border-light, rgba(0,0,0,.06));
  box-shadow: -20px 0 60px rgba(0,0,0,.15);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform .35s cubic-bezier(.16,1,.3,1), visibility .35s;
  overflow-y: auto;
}
.nav-drawer.open {
  transform: translateX(0);
  visibility: visible;
}
.nav-drawer a {
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-secondary, #57517a);
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}
.nav-drawer a:hover {
  color: var(--color-accent, #6d28d9);
  background: var(--color-accent-soft, rgba(109,40,217,.08));
}
.nav-drawer a.active {
  color: var(--color-accent, #6d28d9);
  font-weight: 600;
}
.nav-drawer-divider {
  height: 1px;
  margin: 12px 8px;
  background: var(--color-border-light, rgba(0,0,0,.08));
}

/* ---------- 遮罩 ---------- */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(15, 13, 26, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}
.nav-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ---------- 移动端底部导航 ---------- */
.nav-bottom {
  display: none;
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 990;
  padding: 6px;
  border-radius: 20px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border-light, rgba(0,0,0,.06));
  box-shadow: var(--shadow-lg, 0 20px 48px rgba(0,0,0,.18));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.nav-bottom a,
.nav-bottom button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 3px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted, #8b86a8);
  text-decoration: none;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.nav-bottom a svg,
.nav-bottom button svg {
  width: 20px; height: 20px;
}
.nav-bottom a.active,
.nav-bottom button:active {
  color: var(--color-accent, #6d28d9);
  background: var(--color-accent-soft, rgba(109,40,217,.08));
}

/* ---------- 搜索弹窗 ---------- */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: min(20vh, 160px) 16px 16px;
}
.search-modal.open { display: flex; }
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 13, 26, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: search-fade .25s ease both;
}
@keyframes search-fade { from { opacity: 0; } to { opacity: 1; } }

.search-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border-light, rgba(0,0,0,.06));
  border-radius: 20px;
  box-shadow: var(--shadow-lg, 0 20px 48px rgba(0,0,0,.2));
  overflow: hidden;
  animation: search-rise .35s cubic-bezier(.16,1,.3,1) both;
}
@keyframes search-rise {
  from { opacity: 0; transform: translateY(-16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-light, rgba(0,0,0,.06));
  color: var(--color-text-muted, #8b86a8);
}
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.05rem;
  color: var(--color-text, #221c3a);
  font-family: var(--font-sans);
}
.search-bar input::placeholder { color: var(--color-text-muted, #8b86a8); }
.search-bar input:focus-visible { outline: 2px solid var(--color-accent, #6d28d9); outline-offset: 2px; border-radius: 6px; }
.search-kbd {
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--color-text-muted, #8b86a8);
  background: var(--color-surface-alt, #efedf8);
  border: 1px solid var(--color-border-light, rgba(0,0,0,.06));
}
.search-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}
.search-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: var(--text-sm, .875rem);
  color: var(--color-text-muted, #8b86a8);
}

/* 搜索结果条目 */
.search-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--color-text);
  transition: background-color .15s ease, color .15s ease;
}
.search-item:hover,
.search-item:focus-visible {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.search-item .s-title {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
}
.search-item .s-date {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-bottom { display: flex; }
  .nav-github-btn { display: none; }
  /* 给底部导航让出空间 */
  body { padding-bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-drawer, .search-panel, .nav-overlay { animation: none !important; transition-duration: .01s !important; }
}
