/* =========================================================
   全局重置样式
   ========================================================= */
body {
  margin: 0;
  padding: 0;
  font-family: "Microsoft YaHei", sans-serif;
  color: #333;
  line-height: 1.6;
  background-color: #fff;
  /* 注意：已移除 cursor: none 和 user-select: none，避免与JS光标冲突 */
}

/* =========================================================
   第一屏背景样式
   ========================================================= */
.first-screen {
  position: relative;
  height: 100vh;
  width: 100%;
  background-image: url('https://i.postimg.cc/g2zzr7Nn/desktop.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}

/* =========================================================
   页首区域样式
   ========================================================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 5%;
  position: fixed;
  width: 90%;
  top: 0;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-left {
  font-size: 20px;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.nav-center {
  display: flex;
  font-size: 16px;
  justify-content: center;
  flex-grow: 1;
  margin-left: 0;
}

.nav-center a {
  margin: 0 10px;
  color: #555;
  text-decoration: none;
  transition: color 0.3s;
  white-space: nowrap;
}

.nav-center a:hover {
  color: #1e88e5;
  border-bottom: 2px solid #1e88e5;
  padding-bottom: 5px;
}

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

.header-right a {
  color: #555;
  text-decoration: none;
  font-size: 18px;
  transition: color 0.3s;
}

.header-right a:hover {
  color: #1e88e5;
}

.header-right img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #eee;
}

/* =========================================================
   页面主体核心区样式
   ========================================================= */
#mainContent {
  max-width: 65ch;
  margin: 2rem auto;
  padding: 1.5rem;
  background: white;
  border-radius: 0.375rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.main-content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  text-align: center;
  z-index: 2;
  padding: 0 20px;
}

.main-title {
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  margin-bottom: 15px;
  font-family: "SimSun", serif;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
  line-height: 1.2;
}

.sub-title {
  font-size: 1.2rem;
  letter-spacing: 2px;
  color: #fff;
}

/* =========================================================
   独立居中的分类导航 - 修复对齐问题
   ========================================================= */
.category-nav-container {
  width: 100%;
  background-color: white;
  padding: 15px 0;
  margin-bottom: 20px;
  position: relative;
  z-index: 5;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
  align-items: center;
}

.category-nav-container::-webkit-scrollbar {
  display: none;
}

.category-nav {
  display: flex;
  justify-content: center;  /* 确保内容居中 */
  align-items: center;      /* 垂直居中 */
  margin: 0 auto;
  padding: 0 20px;
  min-width: min-content;
  border-bottom: 1px solid #eee;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 1000px;
}

.category-nav a {
  color: #666;
  text-decoration: none;
  padding: 8px 15px;
  margin: 0 3px;
  transition: all 0.3s;
  white-space: nowrap;
  font-size: 14px;
  flex-shrink: 0;
  text-align: center;  /* 确保链接文本居中 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.category-nav a:hover {
  color: #1e88e5;
  background-color: #f5f7fa;
  border-radius: 4px;
}

/* =========================================================
   博客内容区容器
   ========================================================= */
.blog-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px 30px;
  display: flex;
  flex-direction: column;
  background-color: white;
  position: relative;
}

.blog-main {
  flex: 1;
  padding-right: 0;
  width: 100%;
  order: 1;
}

/* =========================================================
   文章列表
   ========================================================= */
.article-list {
  margin-bottom: 30px;
}

.article-item {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #f0f0f0;
}

.article-title {
  font-size: 18px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.article-title a {
  color: #333;
  text-decoration: none;
  transition: color 0.3s;
}

.article-title a:hover {
  color: #1e88e5;
}

.article-meta {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.article-excerpt {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* =========================================================
   侧边栏
   ========================================================= */
.blog-sidebar {
  width: 100%;
  order: 2;
  margin-top: 30px;
}

.sidebar-notice,
.sidebar-calendar {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.sidebar-notice h4,
.sidebar-calendar h4 {
  font-size: 16px;
  color: #444;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0f0f0;
}

.notice-content p {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  line-height: 1.5;
}

/* 日历样式 */
.custom-calendar {
  width: 100%;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  color: white;
}

.calendar-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.calendar-nav {
  display: flex;
  gap: 6px;
}

.calendar-nav button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background 0.3s;
  flex-shrink: 0;
}

.calendar-nav button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f8f9fa;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  padding: 4px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #f0f0f0;
  padding: 1px;
}

.day-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-height: 40px;
}

.day-cell:hover {
  background: #f5f8ff;
  transform: translateY(-1px);
  z-index: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.day-cell.today {
  background: #1e88e5;
  color: white;
  font-weight: bold;
  border-radius: 4px;
}

.day-cell.other-month {
  color: #ccc;
  background: #fafafa;
}

.day-cell.has-event:after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: #ff6b6b;
  border-radius: 50%;
}

/* =========================================================
   博客园默认页脚居中样式
   ========================================================= */
#footer {
  text-align: center;
  padding: 20px 0;
  font-size: 12px;
  color: #999;
  background-color: #fff;
  border-top: 1px solid #eee;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#footer-text,
#poweredby,
#footer-links {
  text-align: center;
  margin: 5px 0;
  width: 100%;
}

#footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 10px;
}

#footer-links a {
  margin: 0 5px;
  color: #333;
  text-decoration: none;
  font-size: 12px;
}

.topicListFooter {
  text-align: center;
  padding: 20px 0;
  width: 100%;
  margin: 0 auto;
}

#nav_next_page {
  text-align: center;
  margin: 0 auto;
  width: 100%;
}

/* =========================================================
   默认隐藏元素样式
   ========================================================= */
#blog-news,
#blog-calendar,
#blog-sidecolumn-tags,
#blog-sidecolumn-stats,
#blog-sidecolumn-search,
#blog-sidecolumn-categories,
#blog-sidecolumn-comments,
#blog-sidecolumn-topdiggers,
#sideBarMain,
#leftcontentcontainer,
#sidebar_search,
#sidebar_categories,
#calendar {
  display: none;
}

/* =========================================================
   自定义内容显示样式
   ========================================================= */
.blog-container {
  margin-top: 0;
  display: block;
}

/* =========================================================
   博客园特定元素控制
   ========================================================= */
#home #header {
  display: none;
}

#home {
  padding-top: 0;
}

#home #main {
  margin-top: 0;
}

body:not(#home) #header {
  display: block;
}

#home #header #blogTitle,
#home #header #navigator,
#home #header .blogStats {
  display: none;
}

/* 新增：隐藏博客园默认的文章详情页结构，防止冲突 */
#home #mainContent,
#home #post_list,
#home .day {
  display: none !important;
}

/* 文章列表样式（确保真实文章有样式） */
#post_list {
  width: 100%;
}
.day {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #f0f0f0;
}
.dayTitle {
  font-size: 13px;
  color: #999;
  margin-bottom: 8px;
}
.postTitle a {
  font-size: 18px;
  color: #333;
  text-decoration: none;
  font-weight: bold;
  line-height: 1.4;
  display: block;
  margin-bottom: 8px;
}
.postTitle a:hover {
  color: #1e88e5;
}
.postCon {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin: 10px 0;
}
.postMeta {
  font-size: 12px;
  color: #999;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* =========================================================
   移动端响应式样式
   ========================================================= */
@media screen and (max-width: 768px) {
  /* 页首调整 */
  header {
    padding: 10px 4%;
    width: 92%;
  }
  
  .header-left {
    font-size: 18px;
    max-width: 300px;
  }
  
  .nav-center {
    display: none;
  }
  
  .header-right {
    gap: 12px;
  }
  
  .header-right img {
    width: 32px;
    height: 32px;
  }
  
  /* 主标题调整 */
  .main-title {
    font-size: 2rem;
    margin-bottom: 10px;
  }
  
  .sub-title {
    font-size: 1rem;
    letter-spacing: 1px;
  }
  
  /* 分类导航调整 - 修复移动端对齐 */
  .category-nav-container {
    padding: 12px 0;
    justify-content: flex-start; /* 移动端左对齐开始 */
  }
  
  .category-nav {
    padding: 0 15px;
    justify-content: flex-start; /* 移动端左对齐 */
  }
  
  .category-nav a {
    padding: 6px 12px;
    font-size: 13px;
  }
  
  /* 博客容器调整 */
  .blog-container {
    padding: 0 10px 20px;
  }
  
  /* 侧边栏调整 */
  .blog-sidebar {
    margin-top: 20px;
  }
  
  .sidebar-notice,
  .sidebar-calendar {
    margin-bottom: 15px;
    padding-bottom: 12px;
  }
  
  /* 日历调整 */
  .calendar-header {
    padding: 8px 10px;
  }
  
  .calendar-header h4 {
    font-size: 14px;
  }
  
  .calendar-nav button {
    width: 26px;
    height: 26px;
  }
  
  .day-cell {
    min-height: 35px;
    font-size: 12px;
  }
  
  .weekday {
    font-size: 11px;
  }
  
  /* 页脚调整 */
  #footer {
    padding: 15px 0;
    font-size: 11px;
  }
  
  #footer-links a {
    font-size: 11px;
    margin: 0 3px;
  }
  
  /* 移动端菜单按钮 */
  .mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    font-size: 20px;
    color: #555;
    cursor: pointer;
    padding: 5px;
  }
  
  .mobile-menu-btn:hover {
    color: #1e88e5;
  }
  
  /* 移动端导航菜单 */
  .mobile-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 999;
    display: none;
    padding: 15px;
  }
  
  .mobile-nav.active {
    display: block;
  }
  
  .mobile-nav a {
    display: block;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
  }
  
  .mobile-nav a:hover {
    color: #1e88e5;
    background: #f5f7fa;
  }
  
  .mobile-nav a:last-child {
    border-bottom: none;
  }
}

/* 小屏幕手机 */
@media screen and (max-width: 480px) {
  .main-title {
    font-size: 1.8rem;
  }
  
  .sub-title {
    font-size: 0.9rem;
  }
  
  .header-left {
    font-size: 16px;
    max-width: 300px;
  }
  
  .header-right img {
    width: 28px;
    height: 28px;
  }
  
  .category-nav a {
    padding: 5px 10px;
    font-size: 12px;
  }
  
  .day-cell {
    min-height: 30px;
    font-size: 11px;
  }
  
  .calendar-header h4 {
    font-size: 13px;
  }
  
  .calendar-nav button {
    width: 24px;
    height: 24px;
  }
  
  /* 文章内容适配 */
  .postTitle a {
    font-size: 16px;
  }
  
  .postCon {
    font-size: 13px;
  }
  
  .postMeta {
    font-size: 11px;
  }
}

/* 平板设备 */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .blog-container {
    flex-direction: row;
  }
  
  .blog-main {
    padding-right: 20px;
    order: 1;
  }
  
  .blog-sidebar {
    width: 300px;
    order: 2;
    margin-top: 0;
  }
  
  .nav-center {
    margin-left: -100px;
  }
  
  .nav-center a {
    margin: 0 8px;
    font-size: 16px;
  }
  
  /* 平板设备分类导航居中 */
  .category-nav {
    justify-content: center;
  }
}

/* 桌面设备 */
@media screen and (min-width: 1025px) {
  .blog-container {
    flex-direction: row;
  }
  
  .blog-main {
    padding-right: 30px;
    order: 1;
  }
  
  .blog-sidebar {
    width: 250px;
    order: 2;
    margin-top: 0;
  }
  
  .nav-center {
    margin-left: -144px;
  }
  
  .nav-center a {
    margin: 0 15px;
  }
  
  /* 桌面设备分类导航居中 */
  .category-nav {
    justify-content: center;
  }
}
