/* ==================== 全局重置与变量 ==================== */
:root {
  --primary: #2c5f5d;
  --primary-light: #3a7a78;
  --primary-dark: #1f4543;
  --accent: #e8a87c;
  --accent-dark: #d4956a;
  --bg: #f8f6f1;
  --bg-card: #ffffff;
  --text: #2d3436;
  --text-light: #636e72;
  --text-muted: #95a5a6;
  --border: #e8e4dc;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1200px;
  --header-h: 70px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent);
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== 导航栏 ==================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  transition: var(--transition);
}

.navbar .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  color: var(--text);
  font-weight: 500;
  position: relative;
  padding: 6px 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--primary);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 8px;
}

.nav-toggle span {
  width: 25px;
  height: 2px;
  background: var(--text);
  transition: var(--transition);
}

/* ==================== Hero 区域 ==================== */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('../images/hero-banner.jpg') center/cover no-repeat;
  transform: scale(1.05);
  animation: heroZoom 20s ease-in-out infinite alternate;
}

@keyframes heroZoom {
  to {
    transform: scale(1.15);
  }
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.5) 100%);
}

.hero-content {
  position: relative;
  text-align: center;
  color: #fff;
  z-index: 2;
  padding: 0 20px;
  animation: fadeInUp 1.2s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-content h1 {
  font-size: 52px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 2px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.hero-content p {
  font-size: 20px;
  margin-bottom: 36px;
  opacity: 0.95;
  letter-spacing: 1px;
}

.hero-btn {
  display: inline-block;
  padding: 14px 40px;
  background: var(--accent);
  color: #fff;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  transition: var(--transition);
  box-shadow: 0 8px 30px rgba(232, 168, 124, 0.4);
}

.hero-btn:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(232, 168, 124, 0.5);
}

.scroll-down {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 24px;
  animation: bounce 2s infinite;
  z-index: 2;
}

@keyframes bounce {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(10px);
  }
}

/* ==================== 通用区段 ==================== */
.section {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 50px;
}

.section-title h2 {
  font-size: 36px;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 700;
}

.section-title p {
  color: var(--text-light);
  font-size: 16px;
}

.section-title .line {
  width: 60px;
  height: 3px;
  background: var(--accent);
  margin: 16px auto 0;
  border-radius: 2px;
}

/* ==================== 统计数据 ==================== */
.stats {
  background: var(--primary);
  padding: 50px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  text-align: center;
}

.stat-item {
  color: #fff;
}

.stat-num {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 15px;
  opacity: 0.9;
  letter-spacing: 1px;
}

/* ==================== 日记卡片 ==================== */
.diaries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 28px;
}

.diary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
}

.diary-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.diary-card-img {
  height: 220px;
  overflow: hidden;
  position: relative;
}

.diary-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.diary-card:hover .diary-card-img img {
  transform: scale(1.08);
}

.diary-card-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary);
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
}

.diary-card-body {
  padding: 22px;
}

.diary-card-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.diary-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.diary-card-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
  transition: var(--transition);
}

.diary-card:hover .diary-card-title {
  color: var(--primary);
}

.diary-card-excerpt {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.diary-card-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.diary-card-footer .read-more {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.diary-card-footer .read-more:hover {
  color: var(--accent);
}

/* ==================== 分类筛选 ==================== */
.filters {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 24px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-light);
  border-radius: 50px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ==================== 页面头部（非首页） ==================== */
.page-header {
  margin-top: var(--header-h);
  padding: 60px 0 50px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  text-align: center;
  color: #fff;
}

.page-header h1 {
  font-size: 40px;
  margin-bottom: 12px;
  font-weight: 700;
}

.page-header p {
  font-size: 16px;
  opacity: 0.9;
}

.breadcrumb {
  margin-top: 16px;
  font-size: 14px;
}

.breadcrumb a {
  color: rgba(255, 255, 255, 0.8);
}

.breadcrumb a:hover {
  color: #fff;
}

.breadcrumb span {
  margin: 0 8px;
  opacity: 0.5;
}

/* ==================== 日记详情页 ==================== */
.diary-detail {
  margin-top: var(--header-h);
  padding: 50px 0 80px;
}

.diary-detail-header {
  text-align: center;
  margin-bottom: 40px;
}

.diary-detail-tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 5px 18px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}

.diary-detail-title {
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
  line-height: 1.3;
}

.diary-detail-meta {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 14px;
}

.diary-detail-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.diary-detail-cover {
  width: 100%;
  height: 480px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 50px;
  box-shadow: var(--shadow);
}

.diary-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.diary-detail-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.9;
  color: var(--text);
}

.diary-detail-content p {
  margin-bottom: 22px;
}

.diary-gallery {
  max-width: 800px;
  margin: 40px auto;
  display: grid;
  gap: 20px;
}

.diary-gallery img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
}

.diary-gallery img:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-hover);
}

.diary-nav {
  max-width: 800px;
  margin: 60px auto 0;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.diary-nav a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-width: 48%;
  transition: var(--transition);
}

.diary-nav a:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.diary-nav .nav-label {
  font-size: 13px;
  color: var(--text-muted);
}

.diary-nav .nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.diary-nav .next {
  text-align: right;
  margin-left: auto;
}

/* ==================== 精选区段 ==================== */
.featured {
  background: linear-gradient(180deg, var(--bg) 0%, #eef2f0 100%);
}

/* ==================== 关于页 ==================== */
.about-content {
  max-width: 800px;
  margin: 0 auto;
}

.about-content p {
  font-size: 17px;
  line-height: 1.9;
  margin-bottom: 22px;
  color: var(--text-light);
}

.about-author {
  display: flex;
  gap: 30px;
  align-items: center;
  margin: 40px 0;
  padding: 30px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.about-author-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #fff;
  flex-shrink: 0;
}

.about-author-info h3 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text);
}

.about-author-info p {
  color: var(--text-light);
  margin: 0;
}

/* ==================== 页脚 ==================== */
.footer {
  background: var(--primary-dark);
  color: rgba(255, 255, 255, 0.85);
  padding: 50px 0 25px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-col h3 {
  color: #fff;
  font-size: 18px;
  margin-bottom: 18px;
}

.footer-col p {
  font-size: 14px;
  line-height: 1.8;
  opacity: 0.8;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 10px;
}

.footer-col ul a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

.footer-col ul a:hover {
  color: var(--accent);
}

.footer-bottom {
  text-align: center;
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  opacity: 0.7;
}

/* ==================== 分页 ==================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 50px;
}

.pagination button {
  min-width: 42px;
  height: 42px;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.pagination button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================== 返回顶部 ==================== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--accent);
  transform: translateY(-3px);
}

/* ==================== 图片灯箱 ==================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 40px;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  background: none;
  border: none;
}

/* ==================== 加载动画 ==================== */
.loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== 无结果 ==================== */
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.no-results .icon {
  font-size: 60px;
  margin-bottom: 16px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 34px;
  }

  .hero-content p {
    font-size: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }

  .stat-num {
    font-size: 32px;
  }

  .section {
    padding: 50px 0;
  }

  .section-title h2 {
    font-size: 28px;
  }

  .diaries-grid {
    grid-template-columns: 1fr;
  }

  .diary-detail-title {
    font-size: 26px;
  }

  .diary-detail-cover {
    height: 280px;
  }

  .diary-detail-meta {
    gap: 14px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .about-author {
    flex-direction: column;
    text-align: center;
  }

  .diary-nav {
    flex-direction: column;
  }

  .diary-nav a {
    max-width: 100%;
  }

  .diary-nav .next {
    text-align: left;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }
}

@media (max-width: 480px) {
  .hero-content h1 {
    font-size: 26px;
  }

  .filters {
    gap: 8px;
  }

  .filter-btn {
    padding: 6px 16px;
    font-size: 13px;
  }
}
