/* ============================================
   自定义样式 - AnZhiYu 主题演示站对齐
   版本: 3.0 (精简重构版)
   说明: 仅包含对主题默认样式的增强/修正，
         不重复声明主题已有的 CSS 变量和布局规则。
   ============================================ */

/* --- 1. 导航栏增强 --- */
#page-header #nav {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

#page-name {
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 子菜单圆角 + hover 高亮 */
#nav .menus_items .menus_item .menus_item_child li a {
  border-radius: 50px;
  transition: all 0.3s;
}

#nav .menus_items .menus_item .menus_item_child li a:hover {
  background: var(--anzhiyu-main);
  color: #fff;
}

/* 中间标题遮罩层不挡两侧菜单 */
#nav .mask-name-container {
  pointer-events: none;
}

#nav .mask-name-container #name-container {
  pointer-events: auto;
}

/* --- 2. 中控台层级修正 --- */
#console {
  z-index: 10000;
}

/* 未启用「最近评论」时左侧无卡片，避免空白 */
#console .console-card-group-left:not(:has(.console-card)) {
  display: none;
  width: 0;
  margin: 0;
  min-width: 0;
}

#console.show .console-card-group-left:not(:has(.console-card)) ~ .console-card-group-right,
#console.reward-show .console-card-group-left:not(:has(.console-card)) ~ .console-card-group-right {
  width: 100%;
  max-width: 92%;
  min-width: 0;
}

/* --- 3. 首页标题 --- */
#site-title {
  font-size: 2.5rem;
  font-weight: 700;
}

#home_top .banners-title-small {
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 2px;
}

/* 首页 banner 左下横幅按钮 */
#random-banner #random-hover {
  z-index: 10;
  pointer-events: auto;
}

/* --- 4. 侧边栏卡片 --- */
#aside-content .card-widget {
  border-radius: 12px;
  border: 1px solid var(--anzhiyu-card-border);
  transition: all 0.3s ease-in-out;
  overflow: hidden;
}

#aside-content .card-info {
  background: var(--anzhiyu-theme) !important;
}

#random-hover {
  background: var(--anzhiyu-theme) !important;
}

#aside-content .card-widget:hover {
  border-color: var(--anzhiyu-main);
}

#aside-content .card-archives ul.card-archive-list > .card-archive-list-item a {
  border-radius: 8px;
  transition: all 0.3s;
}

#aside-content .card-archives ul.card-archive-list > .card-archive-list-item a:hover {
  background: var(--anzhiyu-main-op);
  color: var(--anzhiyu-main);
}

/* 头像旋转 */
#aside-content .card-info-avatar img {
  transition: transform 0.5s ease-in-out;
}

#aside-content .card-info-avatar:hover img {
  transform: rotate(360deg);
}

/* --- 5. 标签云 --- */
.card-tag-cloud a {
  display: inline-block;
  padding: 4px 12px;
  margin: 4px;
  border-radius: 8px;
  background: var(--anzhiyu-main-op);
  color: var(--anzhiyu-fontcolor);
  font-size: 0.8rem;
  transition: all 0.3s;
}

.card-tag-cloud a:hover {
  background: var(--anzhiyu-main);
  color: #fff;
  transform: translateY(-1px);
}

/* --- 6. 社交图标 --- */
#site_social_icons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

#site_social_icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--anzhiyu-card-bg);
  color: var(--anzhiyu-fontcolor);
  font-size: 18px;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#site_social_icons a:hover {
  background: var(--anzhiyu-main);
  color: #fff;
  transform: translateY(-2px);
}

/* --- 7. 文章卡片 --- */
.recent-post-item {
  transition: all 0.3s ease-in-out;
}

.recent-post-item:hover {
  transform: translateY(-2px);
}

.recent-post-item .post_cover img {
  transition: transform 0.5s ease-in-out;
}

.recent-post-item:hover .post_cover img {
  transform: scale(1.05);
}

/* --- 8. 页脚 --- */
#footer {
  position: relative;
  z-index: 2;
  margin-top: 1rem;
  padding-top: 0;
}

#footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--anzhiyu-main), transparent);
}

/* --- 9. 滚动条 --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--anzhiyu-scrollbar);
  border-radius: 8px;
}

::-webkit-scrollbar-track {
  background-color: transparent;
}

/* --- 10. 关于页面卡片 --- */
.author-content-item {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--anzhiyu-card-border);
  transition: all 0.3s;
}

.author-content-item:hover {
  border-color: var(--anzhiyu-main);
}

/* --- 11. 说说瀑布流 --- */
#waterfall.list {
  column-count: 2;
  column-gap: 16px;
}

.bber-item {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid var(--anzhiyu-card-border);
  background: var(--anzhiyu-card-bg);
  padding: 16px;
  transition: all 0.3s;
}

.bber-item:hover {
  border-color: var(--anzhiyu-main);
}

/* --- 12. 动画效果 --- */
@keyframes floating {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.floating {
  animation: floating 3s ease-in-out infinite;
}

#randomPost_button i {
  animation: floating 3s ease-in-out infinite;
}

/* --- 13. 右下角按钮 --- */
#rightside > div > button,
#rightside > div > a {
  border-radius: 50% !important;
  transition: all 0.3s;
}

#rightside > div > button:hover,
#rightside > div > a:hover {
  background: var(--anzhiyu-main) !important;
  color: #fff !important;
  transform: translateY(-2px);
}

/* --- 14. 其它通用组件 --- */
#article-container figure.highlight {
  border-radius: 12px;
}

.post-copyright {
  border-radius: 12px;
  border: 1px solid var(--anzhiyu-card-border);
  background: var(--anzhiyu-card-bg);
  padding: 16px;
}

#post-head-ai-description {
  border-radius: 12px;
  border: 1px solid var(--anzhiyu-card-border);
  background: var(--anzhiyu-card-bg);
  padding: 16px;
  margin-bottom: 16px;
}

/* --- 15. 响应式与防遮挡优化 --- */
#nav {
  z-index: 9999 !important; /* 确保导航栏在所有普通元素之上，防止被其它模块覆盖 */
}

#page-header {
  z-index: 9999 !important; /* 保持与导航栏一致的层级 */
}

/* 限制中部导航的宽度，防止其与左右两侧的 Logo 和功能按钮重叠 */
#nav #menus {
  position: absolute;
  left: 200px !important; /* 预留给左侧 Logo/返回按钮 的安全宽度 */
  right: 280px !important; /* 预留给右侧 搜索/控制台/回到顶部按钮 的安全宽度 */
  width: auto !important;
  padding: 0;
  display: flex;
  justify-content: center;
}

/* 当导航栏处于固定(滚动)状态且显示文章标题时，确保标题层级正确且不遮挡按钮 */
#page-header.nav-fixed #name-container {
  z-index: 101 !important;
  pointer-events: auto;
}

/* 在中等屏幕/平板分辨率下，当内容宽度大于视口宽度时，优雅地折叠为移动端汉堡菜单 */
@media screen and (max-width: 1200px) {
  #page-header #nav .menus_items {
    display: none !important;
  }
  #page-header #nav #toggle-menu {
    display: inline-block !important;
  }
}

@media screen and (max-width: 768px) {
  #site-title {
    font-size: 1.8rem;
  }
  #waterfall.list {
    column-count: 1;
  }
  #aside-content .card-widget {
    border-radius: 8px;
  }
}
