/* ==========================================================================
   头部导航样式 - 极简
   ========================================================================== */

.site-header {
  width: var(--content-width);
  height: 40px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.header-logo img {
  object-fit: contain;
  display: block;
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--heading-color);
  line-height: 1;
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 导航 */
.header-nav ul {
  display: flex;
  gap: 4px;
}

.header-nav a {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-color);
  transition: background-color 150ms, color 150ms;
  line-height: 1.5;
  white-space: nowrap;
}

.header-nav a:hover {
  background: var(--accent2);
  color: var(--primary);
}

/* ====== 汉堡菜单按钮（仅移动端显示） ====== */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-color);
  flex-shrink: 0;
  transition: background-color 150ms;
}
.mobile-menu-btn:active {
  background: var(--accent2);
}

/* ====== 移动端弹出菜单面板 (Popover) ====== */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-overlay.is-open {
  opacity: 1;
}

.mobile-drawer {
  position: fixed;
  left: 16px;
  bottom: 72px;
  width: 120px;
  background: var(--bg);
  border-radius: 18px;
  z-index: 201;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.92);
  transform-origin: left bottom;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 16px;
}

.dark .mobile-drawer {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.mobile-drawer.is-open {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.mobile-drawer-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.mobile-drawer-logo img {
  object-fit: contain;
  display: block;
  max-height: 18px;
}

/* 弹出菜单导航列表 */
.mobile-drawer-nav {
  padding: 2px 0;
}

.mobile-nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-menu li {
  margin: 0;
  padding: 0;
}

.mobile-nav-menu a {
  display: block;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--headingColor);
  text-decoration: none;
  transition: color 150ms;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-menu a:active {
  color: var(--primary);
}

.mobile-nav-menu .current-menu-item > a,
.mobile-nav-menu .current-page-ancestor > a {
  color: var(--primary);
  font-weight: 600;
}

/* 弹出菜单底部操作区 */
.mobile-drawer-footer {
  padding-top: 8px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-drawer-theme {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--textSecondaryColor);
  transition: color 150ms;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.mobile-drawer-theme svg {
  width: 14px;
  height: 14px;
}

.mobile-drawer-theme:active {
  color: var(--headingColor);
}

.mobile-drawer-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.mobile-drawer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mobile-drawer-avatar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--textSecondaryColor);
  background: var(--accent1);
  text-decoration: none;
}
.mobile-drawer-avatar-link svg {
  width: 14px;
  height: 14px;
}

/* ====== 移动端悬浮按钮 ====== */
.mobile-fab-wrap {
  display: none;
}

.mobile-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--headingColor);
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, background 0.15s, border-color 0.15s;
  z-index: 95;
}

.dark .mobile-fab {
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.mobile-fab:active {
  transform: scale(0.92);
  background: var(--accent1);
}

.mobile-fab-top {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.15s, border-color 0.15s;
}

.mobile-fab-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ====== 移动端响应式 ====== */
@media (max-width: 767px) {
  .site-header {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 0 8px;
    height: 32px;
    background: var(--bg);
    z-index: 100;
    border-bottom: none;
    justify-content: center;
  }

  .header-logo img {
    max-height: 22px;
  }

  /* 隐藏桌面导航 */
  .header-nav {
    display: none;
  }

  /* 隐藏桌面用户下拉 */
  .header-user .user-dropdown {
    display: none;
  }

  /* 隐藏桌面主题切换 */
  .theme-toggle {
    display: none;
  }

  /* 隐藏桌面用户头像 */
  .header-user {
    display: none;
  }

  /* 移动端隐藏header-right所有内容 */
  .header-right {
    display: none;
  }

  .logo-text {
    font-size: 13px;
  }

  /* 显示悬浮按钮 */
  .mobile-fab-wrap {
    display: flex;
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    justify-content: space-between;
    align-items: center;
    z-index: 95;
    pointer-events: none;
  }

  .mobile-fab-wrap .mobile-fab {
    pointer-events: auto;
  }
}

@media (max-width: 640px) {
  .site-header {
    height: 32px;
  }
}

.current-menu-item > a,
.current-page-ancestor > a {
  color: var(--primary);
  font-weight: 500;
}

/* 主题切换 */
.theme-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 150ms;
  color: var(--text-color);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--accent2);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* 用户状态 */
.header-user {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.user-avatar {
  display: flex;
  align-items: center;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.user-avatar img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  transition: opacity 150ms;
}

.user-avatar:hover img {
  opacity: 0.8;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--bg);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 150ms, visibility 150ms, transform 150ms;
  z-index: 100;
}

.dark .user-dropdown {
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-header {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--headingColor);
  background: var(--accent1);
  border-radius: 6px;
  margin-bottom: 6px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--textColor);
  text-decoration: none;
  border-radius: 6px;
  transition: background-color 150ms, color 150ms;
}

.user-dropdown-item:hover {
  background: var(--accent2);
  color: var(--primary);
}

.user-login-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--text-color);
  transition: background-color 150ms, color 150ms;
}

.user-login-link:hover {
  background: var(--accent2);
  color: var(--primary);
}
