/* ========== 基础重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  color: #2d3436;
}

/* ========== 随机风景图床背景层 ========== */
.bg-layer {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 1.2s ease-in-out;
}

/* 暗化遮罩，确保文字可读 */
.bg-layer::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

/* ========== 白色雨特效层 ========== */
.rain-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ========== 紫色渐变顶栏 ========== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  z-index: 1000;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.25);
}

.header-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg,
    #667eea 0%,
    #764ba2 20%,
    #8e44ad 40%,
    #6c5ce7 60%,
    #a29bfe 80%,
    #fd79a8 100%);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 顶栏随机背景图（半透明叠加） */
.header-bg::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url('https://picsum.photos/1920/64?random=header');
  background-size: cover;
  background-position: center;
  opacity: 0.12;
  mix-blend-mode: overlay;
}

.header-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 30px;
  max-width: 1400px;
  margin: 0 auto;
}

.logo a {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
  letter-spacing: 1px;
  transition: transform 0.3s ease;
}

.logo a:hover {
  transform: scale(1.05);
}

.main-nav {
  display: flex;
  gap: 8px;
}

.main-nav a {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 24px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.main-nav a::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.main-nav a:hover::before {
  opacity: 1;
}

.main-nav a:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ========== 主体布局 ========== */
.main-wrapper {
  display: flex;
  padding-top: 64px;
  min-height: 100vh;
}

/* ========== 贴紧最左侧的侧边栏 ========== */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-right: 1px solid rgba(255,255,255,0.4);
  position: fixed;
  left: 0;
  top: 64px;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,0.06);
}

/* 滚动条美化 */
.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(108, 92, 231, 0.3);
  border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(108, 92, 231, 0.5);
}

.sidebar-inner {
  padding: 28px 22px;
}

.sidebar-title {
  font-size: 1.05rem;
  color: #6c5ce7;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 2px solid rgba(108, 92, 231, 0.15);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recent-posts {
  list-style: none;
}

.post-item {
  margin-bottom: 8px;
}

.post-link {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: #2d3436;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid transparent;
  background: rgba(255,255,255,0.4);
}

.post-link:hover {
  background: rgba(108, 92, 231, 0.08);
  border-left-color: #6c5ce7;
  transform: translateX(6px);
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.1);
}

.post-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #2d3436;
}

.post-date {
  font-size: 0.72rem;
  color: #a0a0a0;
  margin-top: 6px;
  font-weight: 400;
}

.sidebar-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(0,0,0,0.06);
  text-align: center;
}

.sidebar-footer p {
  color: #b2bec3;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ========== 正文区域 ========== */
.content {
  margin-left: 280px;
  flex: 1;
  padding: 40px 50px;
  position: relative;
  z-index: 10;
}

/* 正中央自定义标题区域 */
.hero-section {
  text-align: center;
  padding: 100px 20px 70px;
  margin-bottom: 50px;
  position: relative;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 700px; height: 240px;
  background: radial-gradient(ellipse, rgba(255,255,255,0.92) 0%, transparent 70%);
  z-index: -1;
  filter: blur(30px);
  pointer-events: none;
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 900;
  color: #2d3436;
  margin-bottom: 18px;
  text-shadow: 0 2px 20px rgba(255,255,255,0.9), 0 4px 40px rgba(255,255,255,0.6);
  letter-spacing: -1px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: #636e72;
  font-weight: 400;
  text-shadow: 0 1px 10px rgba(255,255,255,0.8);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* 正文内容卡片 */
.page-content {
  max-width: 820px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 45px 50px;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  line-height: 1.85;
  color: #2d3436;
  font-size: 1rem;
}

.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4 {
  color: #6c5ce7;
  margin: 35px 0 18px;
  font-weight: 700;
  line-height: 1.3;
}

.page-content h1 { font-size: 2rem; border-bottom: 2px solid rgba(108, 92, 231, 0.12); padding-bottom: 12px; }
.page-content h2 { font-size: 1.6rem; }
.page-content h3 { font-size: 1.3rem; }

.page-content p {
  margin-bottom: 18px;
}

.page-content a {
  color: #6c5ce7;
  text-decoration: none;
  border-bottom: 1px dashed rgba(108, 92, 231, 0.4);
  transition: all 0.2s ease;
}

.page-content a:hover {
  border-bottom-style: solid;
  border-bottom-color: #6c5ce7;
  background: rgba(108, 92, 231, 0.05);
  padding: 0 2px;
  border-radius: 3px;
}

.page-content ul, .page-content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.page-content li {
  margin-bottom: 8px;
}

.page-content blockquote {
  border-left: 4px solid #6c5ce7;
  padding: 12px 20px;
  margin: 20px 0;
  background: rgba(108, 92, 231, 0.04);
  border-radius: 0 8px 8px 0;
  color: #555;
  font-style: italic;
}

.page-content code {
  background: rgba(108, 92, 231, 0.08);
  padding: 2px 8px;
  border-radius: 5px;
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 0.9em;
  color: #6c5ce7;
}

.page-content pre {
  background: #2d3436;
  color: #dfe6e9;
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 20px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.page-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.85em;
}

.page-content img {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  margin: 16px 0;
}

.page-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.2), transparent);
  margin: 35px 0;
}

/* ========== 文章列表页样式 ========== */
.post-list {
  list-style: none;
}

.post-list-item {
  padding: 28px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.post-list-item:hover {
  padding-left: 12px;
}

.post-list-item:last-child {
  border-bottom: none;
}

.post-list-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2d3436;
  text-decoration: none;
  display: block;
  margin-bottom: 8px;
  transition: color 0.2s ease;
}

.post-list-title:hover {
  color: #6c5ce7;
}

.post-list-meta {
  font-size: 0.85rem;
  color: #a0a0a0;
  margin-bottom: 10px;
}

.post-list-excerpt {
  color: #636e72;
  line-height: 1.7;
  font-size: 0.95rem;
}

/* ========== 响应式适配 ========== */
@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
    min-width: 240px;
  }
  .content {
    margin-left: 240px;
    padding: 30px 35px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
    z-index: 2000;
    top: 64px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,0.15);
  }

  .content {
    margin-left: 0;
    padding: 25px 20px;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .page-content {
    padding: 30px 25px;
    border-radius: 16px;
  }

  .main-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
    color: #fff;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
  }
}

@media (min-width: 769px) {
  .mobile-menu-btn {
    display: none;
  }
}

/* ========== 底栏 ========== */
.site-footer {
  text-align: center;
  padding: 30px 20px 20px;
  margin-left: 280px;
  position: relative;
  z-index: 10;
}

.footer-content {
  max-width: 820px;
  margin: 0 auto;
}

.github-link {
  display: inline-block;
  color: #636e72;
  transition: color 0.3s ease, transform 0.3s ease;
}

.github-link:hover {
  color: #6c5ce7;
  transform: scale(1.15);
}

.footer-copyright {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #b2bec3;
  font-weight: 500;
}

@media (max-width: 768px) {
  .site-footer {
    margin-left: 0;
  }
}
