
:root {
  --navbar-height: 60px; /* 桌面端导航栏高度 */
  --title-vertical-padding: 40px; /* 标题上下所需的基础留白（可根据需求调整） */
}/* 布局容器基础样式 */
.layout-container {
    box-sizing: border-box;
    position: relative;
    padding-top: 60px; /* 为顶部导航栏预留空间 */
    width: 100%;
}

/* 顶部导航栏 */
#top-navbar {
   position: fixed;
   top: 0;
   left: 0;
   height: var(--navbar-height); /* 使用变量 */
   z-index: 90;
}

/* 搜索区域容器 */
#search-container {
    position: relative;
    /* 原设置：margin: 25px auto; 上下边距均为25px */
    margin-top: 0px;    /* 上方间距单独设置 */
    margin-bottom: 5px; /* 下方间距单独设置（值可自定义） */
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    z-index: 80;
}

/* 搜索框 */
#search {
    position: relative;
    margin: 0 auto;
    top: 0;
    left: 0;
    transform: none;
    width: 90%;
    max-width: 600px;
    padding: 0px 0;
}

/* 分类标签容器 */
#category-tabs-container {
    position: relative;
    margin: 20px auto;
    width: 100%;
    z-index: 70;
    padding: 0px 0;
}

/* 导航容器 */
#navigation-container {
    position: relative;
    margin: 20px auto;
    margin-bottom: 50px; /* 底部留出空间 */
    width: 100%;
    z-index: 60;
    height: auto;
    min-height: 292px;
        /* 限制最大高度为视口高度减去上方元素总高度 */
    max-height: calc(100vh - 450px);
    overflow: auto; /* 隐藏容器自身滚动条，由内部容器负责滚动 */
}

/* 右侧功能按钮 */
#button-container {
    position: fixed;
    right: 0;
    top: 20%;
    transform: translateY(-50%);
    z-index: 2000000;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    #search {
        width: 95%;
    }
    
    #navigation-container {
        margin-top: 15px;
    }
}

@media (max-width: 768px) {
    #top-navbar {
        height: 50px;
    }
    
    #search-container {
        min-height: 19px;
        /* 平板端上下间距单独设置 */
        margin-top: 16px;
        margin-bottom: 1px;
    }
    
    #navigation-container {
        margin-top: 10px;
        max-height: calc(100vh - 380px);
    }
}

@media (max-height: 768px) {
    #search-container {
        height: 55px;
        min-height: auto;
        /* 小屏高度下上下间距单独设置 */
        margin-top: 15px;
        margin-bottom: 20px;
    }
    
    #navigation-container {
        margin-top: 15px;
        margin-bottom: 40px;
        max-height: calc(100vh - 350px);
    }
}
/* 网站标题样式 */
#site-title {
  text-align: center;
  /* 顶部内边距 = 导航栏高度 + 基础留白（从导航栏底部开始计算） */
  padding-top: calc(var(--navbar-height) + var(--title-vertical-padding));
  /* 底部内边距 = 基础留白（保持与顶部基础留白一致） */
  padding-bottom: var(--title-vertical-padding);
  font-size: 40px;
  font-weight: bold;
  color: var(--text-color);
  margin: 0;
}

@media (max-width: 768px) {
  :root {
    --navbar-height: 50px; /* 移动端导航栏高度 */
    --title-vertical-padding: 15px; /* 移动端可适当减小留白 */
  }
  
  #site-title {
    font-size: 20px;
    /* 移动端自动继承变量计算，无需重复写calc */
  }
}

/* 5. 小屏手机额外适配 */
@media (max-width: 375px) {
  #site-title {
    font-size: 18px;
    /* 如需进一步调整留白，可在此处覆盖变量 */
    /* --title-vertical-padding: 10px; */
  }
}
/* 公告栏容器 */
#announcement-container {
    position: relative;
    margin: 0 auto 60px;
    width: 90%;
    max-width: 600px; /* 与搜索框宽度一致 */
    height: 20px; /* 约搜索框高度一半 */
    overflow: hidden; /* 隐藏溢出内容 */
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-radius: 8px;
    background-color: #f5f7fa;
    color: #333;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-size: 16px; /* 基础字体大小，缩小1/3（原16px→12px） */
}

/* 固定公告标题 */
.announcement-label {
    font-weight: 600;
    color: #3F9DFF;
    margin-right: 8px;
    white-space: nowrap;
    flex-shrink: 0; /* 固定不收缩 */
    font-size: 11px; /* 标题字体缩小（原16px→11px） */
}

/* 公告文本 */
.announcement-text {
    margin-right: 10px;
    flex-shrink: 0;
    font-size: 10px; /* 正文字体缩小（原15px→10px） */
    line-height: 1.2; /* 行高适配小字体 */
}

/* 公告链接 */
.announcement-link {
    color: #3F9DFF;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 10px; /* 链接字体缩小（原15px→10px） */
    line-height: 1.2;
}

/* 夜间模式标题颜色 */
.dark-mode .announcement-label {
    color: #7cb3ff;
}

/* 轮播项容器 */
.announcement-carousel {
    position: absolute;
    width: calc(100% - 60px); /* 留出标题空间 */
    left: 60px; /* 标题宽度+间距 */
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    transition: 
        opacity var(--animation-duration) ease, 
        transform var(--animation-duration) ease;
    opacity: 0;
    transform: translateY(10px);
}

/* 激活状态 */
.announcement-carousel.active {
    opacity: 1;
    transform: translateY(0);
}

/* 滑动动画类型适配 */
#announcement-container.slide-mode .announcement-carousel {
    transition: transform var(--animation-duration) ease;
}

/* 滚动内容容器 */
.announcement-scroll-content {
    display: flex;
    align-items: center;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* 滚动文本容器（核心滚动效果） */
.announcement-text-wrapper {
    display: flex;
    align-items: center;
    animation: scrollText 15s linear infinite;
    white-space: nowrap;
}

/* 滚动动画（向左循环滚动） */
@keyframes scrollText {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* 夜间模式适配 */
.dark-mode #announcement-container {
    background-color: #414141;
    color: #e2e8f0;
}

.dark-mode .announcement-link {
    color: #7cb3ff;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    #announcement-container {
        width: 95%;
        font-size: 11px; /* 移动端进一步缩小 */
    }
    
    .announcement-carousel {
        width: calc(100% - 55px);
        left: 55px;
    }
    
    .announcement-label {
        font-size: 10px; /* 移动端标题缩小 */
    }
    
    .announcement-text, .announcement-link {
        font-size: 9px; /* 移动端正文/链接缩小 */
    }
}

/* 短文本不滚动（可选） */
.announcement-text-wrapper.short-text {
    animation: none;
    transform: translateX(0);
}
