/* ========== 基础变量 ========== */
:root {
  --bg-darkest: #0a0a0a;
  --bg-header: #111111;
  --bg-nav: #1a1a1a;
  --bg-hover: #242424;
  --text-primary: #f0f0f0;
  --text-secondary: #b0b0b0;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --radius-sm: 8px;
  --radius-md: 12px;
  --transition: 0.3s ease;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 28px; }

/* ========== 主头部容器 ========== */
.site-header {
  background: var(--bg-darkest);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  position: relative;
  z-index: 900;
  transition: all var(--transition);
}

/* 滚动后变小并隐藏导航条 */
.site-header.scrolled .header-primary {
  padding: 8px 0;
  background: rgba(17,17,17,0.9);
  backdrop-filter: blur(10px);
}
.site-header.scrolled .brand img {
  height: 32px;
}
.site-header.scrolled .header-navbar {
  display: none;                   /* 隐藏水平导航 */
}

/* ========== 第一行 ========== */
.header-primary {
  padding: 24px 0;
  background: var(--bg-header);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: padding 0.3s;
}
.header-primary__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand img {
  height: 48px;
  width: auto;
  display: block;
  transition: height 0.3s;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.tool-icon:hover { background: var(--bg-hover); color: var(--accent); }
.tool-icon svg { width: 20px; height: 20px; display: block; }

.hamburger {
  display: none;                  /* 桌面端隐藏汉堡，移动端显示 */
  flex-direction: column;
  gap: 5px;
  padding: 10px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  transition: 0.3s;
}

/* ========== 水平导航栏 ========== */
.header-navbar {
  background: var(--bg-nav);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: all 0.3s;
}
.primary-nav { display: flex; align-items: center; }
.nav-list { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav-item a {
  display: block;
  padding: 18px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: 0.2s;
}
.nav-item a:hover,
.nav-item.active > a {
  color: #fff;
  background: rgba(255,255,255,0.03);
  border-bottom-color: var(--accent);
}
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #1e1e1e;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 12px 28px rgba(0,0,0,0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: 0.25s;
  z-index: 200;
  list-style: none;
  padding: 8px 0;
}
.dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu li a {
  display: block;
  padding: 12px 24px;
  color: var(--text-secondary);
  border-bottom: none;
  font-size: 0.95rem;
}
.dropdown-menu li a:hover { background: var(--accent); color: #fff; }

/* ========== 左侧浮动按钮（滚动后显示） ========== */
.side-nav-trigger {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(10,10,10,0.7);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 800;
  transition: 0.3s;
}
.side-nav-trigger:hover { background: var(--accent); }
.site-header.scrolled .side-nav-trigger {
  display: flex;                 /* 滚动后出现 */
}

/* ========== 左侧垂直面板 ========== */
.side-nav-panel {
  position: fixed;
  left: -280px;                 /* 默认隐藏在左侧外 */
  top: 0;
  bottom: 0;
  width: 260px;
  background: #181818;
  box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  transition: left 0.3s ease;
  z-index: 950;
  overflow-y: auto;
  padding: 20px 0;
}
.side-nav-panel.open { left: 0; }
.side-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-weight: 600;
  font-size: 1.2rem;
}
.side-nav-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 2rem;
  cursor: pointer;
}
.side-nav-list { list-style: none; padding: 20px 0; margin: 0; }
.side-nav-list li a {
  display: block;
  padding: 14px 24px;
  color: #ccc;
  text-decoration: none;
  font-size: 1rem;
  transition: 0.2s;
}
.side-nav-list li a:hover { background: var(--accent); color: #fff; }
.side-nav-dropdown .side-dropdown-toggle::after {
  content: ' ▾';
  font-size: 0.8rem;
}
.side-dropdown-menu {
  list-style: none;
  padding-left: 24px;
  display: none;
}
.side-nav-dropdown.open .side-dropdown-menu { display: block; }

/* ========== 搜索浮层 ========== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: 0.35s;
  z-index: 1000;
}
.search-overlay.active { opacity: 1; visibility: visible; }
.search-overlay__box { width: 90%; max-width: 640px; position: relative; }
.search-close-btn {
  position: absolute;
  top: -48px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.4rem;
  cursor: pointer;
}
.search-form { display: flex; border-radius: 60px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.search-form input {
  flex: 1;
  padding: 20px 28px;
  font-size: 1.1rem;
  background: #fff;
  border: none;
  outline: none;
  color: #111;
}
.search-form button {
  padding: 0 40px;
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  .container { padding: 0 20px; }
  .brand img { height: 36px; }
  .hamburger { display: flex !important; }   /* 移动端显示汉堡 */
  .header-navbar { display: none; }          /* 移动端默认隐藏 */
  .side-nav-trigger { display: flex !important; }  /* 移动端始终显示左侧按钮 */
  .site-header.scrolled .side-nav-trigger { display: flex; }
  .side-nav-panel.open { left: 0; }
}