/* ================= 基础重置与变量 ================= */
:root {
  --bg-color: #0f172a;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --accent-blue: #1d93d0;
  --accent-deep-blue: #0f225d;
  --font-main: 'Microsoft YaHei', 'PingFang SC', system-ui, sans-serif;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.6;
}
/* ================= 主页动画 ================= */
#landing-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}
#effect-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
.svg-container {
  width: 300px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}
.avatar-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 793.7007874015749/1122.5196850393702;
}
.avatar-wrapper svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}
.svg-path {
  fill: none;
  stroke: var(--accent-blue);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 3s ease-in-out;
}
.svg-path.animated {
  stroke-dashoffset: 0;
}
#moyuan-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  z-index: 3;
}
#moyuan-img.show {
  opacity: 1;
}
.landing-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2rem;
}
.landing-title {
  font-size: 1.5rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease, transform 1s ease;
  color: var(--text-primary);
}
.landing-title.show {
  opacity: 1;
  transform: translateY(0);
}
.enter-btn {
  margin-top: 2rem;
  padding: 0.8rem 2.5rem;
  background: transparent;
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  font-family: var(--font-main);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}
.enter-btn:hover {
  background: var(--accent-blue);
  color: var(--bg-color);
}
/* ================= 文章列表与布局 ================= */
.blog-layout {
  display: flex;
  gap: 4rem;
  padding: 2rem;
}
.sidebar {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 5rem;
  height: fit-content;
}
.sidebar-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-deep-blue);
  margin-bottom: 1rem;
}
.sidebar-name {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.sidebar-slogan {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}
.sidebar-nav a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  transition: color 0.2s;
  border-left: 2px solid transparent;
  padding-left: 1rem;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--text-primary);
  border-left-color: var(--accent-blue);
}
.sidebar-github {
  margin-top: 2rem;
  display: inline-block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}
.sidebar-github:hover {
  color: var(--text-primary);
}
.content-area {
  flex-grow: 1;
}
.search-bar {
  width: 100%;
  padding: 0.8rem 1.2rem;
  background: rgba(30,41,59,0.5);
  border: 1px solid var(--accent-deep-blue);
  color: var(--text-primary);
  font-family: var(--font-main);
  margin-bottom: 2rem;
  outline: none;
  transition: border-color 0.3s;
}
.search-bar:focus {
  border-color: var(--accent-blue);
}
/* 文章列表样式 (包含缩略图布局) */
.article-item {
  display: flex; /* 让图片和文字横向排列 */
  gap: 1.5rem; /* 图片和文字的间距 */
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(30,41,59,0.8);
  align-items: center; /* 垂直居中对齐 */
}
/* 缩略图容器 */
.article-banner {
  flex-shrink: 0; /* 防止图片被压缩 */
  width: 120px; /* 固定缩略图宽度 */
  height: 80px; /* 固定缩略图高度 */
  overflow: hidden; /* 裁剪溢出部分 */
  border-radius: 4px; /* 微圆角 */
  border: 1px solid var(--accent-deep-blue);
}
.article-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 保证图片不变形，填满容器 */
  transition: transform 0.3s ease;
}
.article-banner:hover img {
  transform: scale(1.05); /* 鼠标悬停微微放大 */
}
/* 文字信息区 */
.article-info {
  flex-grow: 1;
}
/* 文字区占据剩余空间 */
.article-title {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  display: block;
}
.article-title:hover {
  color: var(--accent-blue);
}
.article-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
}
.article-tags span {
  font-size: 0.75rem;
  background: rgba(29,147,208,0.1);
  color: var(--accent-blue);
  padding: 0.2rem 0.6rem;
  margin-right: 0.5rem;
  border-radius: 2px;
}
.article-title {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  display: block;
}
.article-title:hover {
  color: var(--accent-blue);
}
.article-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
}
.article-tags span {
  font-size: 0.75rem;
  background: rgba(29,147,208,0.1);
  color: var(--accent-blue);
  padding: 0.2rem 0.6rem;
  margin-right: 0.5rem;
  border-radius: 2px;
}
/* 日记时间轴样式 */
.diary-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(30,41,59,0.5);
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
}
.diary-date {
  color: var(--accent-blue);
  font-size: 0.9rem;
  font-family: var(--font-main);
  white-space: nowrap;
}
.diary-title {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.3s;
}
.diary-title:hover {
  color: var(--accent-blue);
}
/* ================= 全局顶部导航栏 ================= */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(15,23,42,0.9), transparent);
}
.nav-logo {
  font-weight: bold;
  color: var(--accent-blue);
  text-decoration: none;
  font-size: 1.2rem;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 2rem;
  transition: color 0.3s ease;
  font-size: 0.9rem;
}
.nav-links a:hover {
  color: var(--text-primary);
}
/* ================= 关于页与文章详情页布局 ================= */
.about-layout,
.blog-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  gap: 4rem;
  padding-top: 100px; /* 给顶部导航留出空间 */
}
/* 左侧栏通用样式 */
.sidebar,
.about-left {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  height: fit-content;
}
.sidebar-avatar,
.about-avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-deep-blue);
  margin-bottom: 1rem;
}
.sidebar-avatar {
  width: 80px;
  height: 80px;
}
.about-avatar {
  width: 120px;
  height: 120px;
}
.sidebar-name,
.about-name {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.sidebar-slogan,
.about-slogan {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}
.sidebar-nav a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  transition: color 0.2s;
  border-left: 2px solid transparent;
  padding-left: 1rem;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--text-primary);
  border-left-color: var(--accent-blue);
}
.sidebar-github {
  margin-top: 2rem;
  display: inline-block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}
.sidebar-github:hover {
  color: var(--text-primary);
}
.about-left {
  text-align: center;
}
.about-left .sidebar-nav {
  text-align: left;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--accent-deep-blue);
}
.content-area,
.about-right {
  flex-grow: 1;
}
/* 文章详情排版 */
.article-content {
  line-height: 1.8;
}
.article-content h1 {
  margin-bottom: 1rem;
}
.article-content p {
  margin-bottom: 1.2rem;
}
.article-content blockquote {
  border-left: 4px solid var(--accent-blue);
  padding: 0.5rem 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  background: rgba(15,23,42,0.3);
}
.article-content pre {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.article-content code {
  font-family: 'Fira Code', monospace;
}
/* ================= 文章正文图片大小限制 ================= */
.article-content img {
  max-width: 100%; /* 图片最大宽度绝不超过文章容器宽度 */
  height: auto; /* 高度自动等比例缩放，防止图片变形 */
  display: block; /* 让图片独占一行 */
  margin: 1.5rem auto; /* 上下留出1.5rem间距，左右自动居中 */
  border-radius: 4px; /* 加个微圆角，看起来更精致 */
  box-shadow: 0 4px 12px rgba(0,0,0,0.3); /* 加一点阴影，增加层次感 */
}
/* 置顶标签样式 */
.pin-top-label {
  display: inline-block;
  background-color: var(--accent-blue);
  color: var(--bg-color);
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  margin-right: 0.5rem;
  vertical-align: middle;
  font-weight: bold;
}
/* ================= 文章页返回与上下章导航 ================= */
.back-to-list {
  display: inline-block;
  color: var(--accent-blue);
  margin-bottom: 2rem;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}
.back-to-list:hover {
  color: var(--text-primary);
}
/* ================= 文章页返回与上下章导航 ================= */
.back-to-list {
  display: inline-block;
  color: var(--accent-blue);
  margin-bottom: 2rem;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}
.back-to-list:hover {
  color: var(--text-primary);
}
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--accent-deep-blue);
  gap: 2rem;
}
.post-nav-item {
  text-decoration: none;
  color: var(--text-secondary);
  flex: 1;
  transition: all 0.3s ease; /* 修改这里：让边框和背景变化也有过渡动画 */
/* 新增：边框与内边距 */
  border: 1px solid var(--accent-deep-blue);
  padding: 1rem 1.5rem;
  border-radius: 4px; /* 微圆角 */
}
.post-nav-item.next {
  text-align: right;
  margin-left: auto;
}
.post-nav-item span {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.post-nav-item strong {
  display: block;
  color: var(--text-primary);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 修改这里：Hover 时边框变亮，并加上微弱的背景底色 */
.post-nav-item:hover {
  border-color: var(--accent-blue);
  background: rgba(29,147,208,0.05);
}
.post-nav-item:hover strong {
  color: var(--accent-blue);
}
/* 分页导航样式 */
.page-nav {
  margin-top: 3rem;
  text-align: center;
}
.page-nav a,
.page-nav span {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin: 0 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--accent-deep-blue);
  border-radius: 4px;
  transition: all 0.3s;
}
.page-nav a:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
}
.page-nav .page-current {
  background: var(--accent-deep-blue);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}
/* ================= 移动端响应式适配 ================= */
@media (max-width: 768px) {
  .top-nav {
    flex-direction: column; /* 改为上下排列 */
    padding: 1rem 1.5rem;
    gap: 0.5rem;
  }
  .nav-logo {
    margin-bottom: 0.5rem;
  }
  .nav-links {
    width: 100%;
    display: flex;
    justify-content: center; /* 链接居中 */
    flex-wrap: wrap; /* 允许换行 */
  }
  .nav-links a {
    margin: 0 0.8rem; /* 调整间距 */
    font-size: 0.85rem;
  }
  .svg-container {
    width: 70vw; /* 使用视口宽度，适配不同手机 */
    max-width: 250px; /* 最大不超过250px */
  }
  .landing-title {
    font-size: 1.2rem;
  }
  .enter-btn {
    padding: 0.6rem 2rem;
    font-size: 0.9rem;
  }
  .blog-layout,
  .about-layout {
    flex-direction: column; /* 强制单栏 */
    gap: 2rem;
    padding: 1.5rem;
    padding-top: 120px; /* 给导航栏留出空间 */
  }
  .sidebar,
  .about-left {
    width: 100%;
    position: static; /* 取消固定定位 */
    text-align: center;
    border-bottom: 1px solid var(--accent-deep-blue);
    padding-bottom: 1.5rem;
  }
  .sidebar-avatar,
  .about-avatar {
    margin: 0 auto 1rem auto;
    display: block;
  }
  .sidebar-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--accent-deep-blue);
  }
  .sidebar-nav a {
    border-left: none;
    padding: 0;
  }
  .sidebar-github {
    margin-top: 1rem;
    display: block;
  }
  .article-item {
    flex-direction: column; /* 手机上图片和文字上下排列 */
    align-items: flex-start;
  }
  .article-banner {
    width: 100%; /* 手机上缩略图占满宽度 */
    height: auto;
    aspect-ratio: 16/9; /* 给个16:9的比例 */
  }
  .about-list li {
    justify-content: center;
  }
  .post-nav {
    flex-direction: column; /* 上下排列，防止撑爆 */
    gap: 1rem;
  }
  .post-nav-item.next {
    text-align: left;
    margin-left: 0;
  }
}
/* ================= 手机端汉堡菜单与响应式增强 ================= */
.nav-toggle {
  display: none;
  width: 42px;
  height: 36px;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: transform 0.25s, opacity 0.25s;
}
@media (max-width: 768px) {
  .top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 64px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.2rem;
    background: rgba(15,23,42,0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .nav-logo {
    position: static !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0;
    height: 64px;
    font-size: 1rem;
    line-height: 1;
    white-space: nowrap;
  }
  .nav-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: auto;
    position: relative;
    z-index: 1002;
  }
  .nav-links {
    position: absolute;
    top: 64px;
    right: 12px;
    left: auto;
    z-index: 1001;
    width: 80vw;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: rgba(15,23,42,0.86);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 12px;
    transform: translateY(-20px) scale(0.96);
    transform-origin: top right;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .nav-links.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-links a {
    margin: 0;
    padding: 0.6rem 0;
    font-size: 1rem;
  }
  .nav-overlay {
    display: block;
    position: fixed;
    inset: 64px 0 0;
    z-index: 999;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .nav-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }
}
@media (max-width: 768px) {
  .nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  .nav-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
}
