/* ========================================
   自定义移动端适配：菜单折叠成汉堡按钮
   ======================================== */

/* 强制导航栏常驻显示 */
#nav {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  transform: none !important;
  filter: none !important;
}

/* 防止整个页面横向溢出 */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

/* 平板及以下：菜单折叠成汉堡按钮 */
@media screen and (max-width: 1300px) {
  /* 只隐藏顶部导航的菜单项，不影响侧边栏 */
  #nav .menus_items {
    display: none !important;
    visibility: hidden !important;
  }

  /* 显示汉堡按钮 - 用最高优先级 */
  #nav #toggle-menu {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #fff !important;
    font-size: 1.3em !important;
  }

  #nav #toggle-menu:hover {
    color: rgba(255, 255, 255, 0.7) !important;
  }

  #toggle-menu .site-page {
    font-size: inherit;
  }

  /* 搜索按钮只显示图标 */
  #nav #search-button span:not(.site-page) {
    display: none !important;
    visibility: hidden !important;
  }

  /* 调整 nav 内边距 */
  #nav {
    padding: 0 16px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  #nav #menus {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #nav > * {
    max-width: 100% !important;
  }
}

/* 调整标题在小屏幕的表现 */
@media screen and (max-width: 1300px) {
  #site-name,
  .site-name {
    max-width: 50vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.1em !important;
  }

  #site-title {
    max-width: 90vw !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 auto !important;
  }

  #page-header {
    max-width: 100vw !important;
    overflow: hidden !important;
  }
}

/* 小屏（手机）进一步压缩 */
@media screen and (max-width: 768px) {
  #nav {
    padding: 0 12px !important;
  }

  .site-name {
    font-size: 1em !important;
    max-width: 40vw !important;
  }

  #site-title {
    font-size: 1.8em !important;
    max-width: 85vw !important;
  }
}
