/**
 * 旅途与旧时光 - 主样式表
 * 文艺简约风格，支持明暗主题
 */

/* CSS 变量 - 亮色主题 */
:root {
  --bg-primary: #faf8f5;
  --bg-secondary: #f3efe8;
  --bg-card: #ffffff;
  --text-primary: #3a3a3a;
  --text-secondary: #6b6b6b;
  --text-muted: #999999;
  --accent: #8b7355;
  --accent-light: #a89078;
  --accent-dark: #6b5540;
  --border: #e5e0d8;
  --shadow: rgba(139, 115, 85, 0.1);
  --shadow-hover: rgba(139, 115, 85, 0.2);
  --gradient-start: #fdfcfb;
  --gradient-end: #e8e4df;
  --nav-bg: rgba(255, 255, 255, 0.95);
}

/* CSS 变量 - 暗色主题 */
[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #252525;
  --bg-card: #2d2d2d;
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b0;
  --text-muted: #777777;
  --accent: #c9b896;
  --accent-light: #d4c6a8;
  --accent-dark: #a89878;
  --border: #3d3d3d;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.5);
  --gradient-start: #1a1a1a;
  --gradient-end: #0f0f0f;
  --nav-bg: rgba(45, 45, 45, 0.95);
}

/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

img {
  max-width: 100%;
  height: auto;
}

/* 导航栏 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 2px;
}

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

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

.nav-links a {
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  background: var(--bg-secondary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 1.2rem;
}

.theme-toggle:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-primary);
}

/* 主要内容区 */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 20px 60px;
  min-height: calc(100vh - 100px);
}

/* 页面标题 */
.page-header {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 40px;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: 4px;
  margin-bottom: 12px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  letter-spacing: 2px;
}

/* 卡片样式 */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px var(--shadow);
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}

.card:hover {
  box-shadow: 0 4px 20px var(--shadow-hover);
  transform: translateY(-2px);
}

/* 首页 Hero 区 */
.hero {
  text-align: center;
  padding: 80px 20px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border-radius: 20px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
  opacity: 0.1;
  border-radius: 50%;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: white;
  margin: 0 auto 24px;
  box-shadow: 0 8px 32px var(--shadow);
  animation: float 3s ease-in-out infinite;
}

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

.hero h1 {
  font-size: 2.8rem;
  font-weight: 300;
  margin-bottom: 16px;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  letter-spacing: 3px;
}

.hero .bio {
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-secondary);
  line-height: 2;
}

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--accent-dark);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: white;
}

/* 网格布局 */
.grid {
  display: grid;
  gap: 24px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* 相册网格 */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  transition: all 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px var(--shadow-hover);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-caption {
  opacity: 1;
}

/* 时间轴样式 */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
  padding-left: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -31px;
  top: 10px;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid var(--bg-primary);
  z-index: 1;
}

.timeline-date {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.timeline-title {
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.timeline-content {
  color: var(--text-secondary);
  line-height: 1.8;
}

/* 旅行地图容器 */
.map-container {
  width: 100%;
  height: 500px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 24px var(--shadow);
  border: 1px solid var(--border);
}

/* 分类标签 */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.tab:hover,
.tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* 留言墙样式 */
.message-list {
  list-style: none;
}

.message-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.message-nickname {
  font-weight: 600;
  color: var(--text-primary);
}

.message-time {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.message-content {
  color: var(--text-secondary);
  line-height: 1.8;
}

/* 留言表单 */
.message-form {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 4px 24px var(--shadow);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--shadow);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* 随笔卡片 */
.essay-card {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px var(--shadow);
  transition: all 0.3s ease;
  cursor: pointer;
}

.essay-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px var(--shadow-hover);
}

.essay-cover {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  font-weight: 300;
}

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

.essay-body {
  padding: 24px;
}

.essay-title {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.essay-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* 书单卡片 */
.book-card {
  display: flex;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px var(--shadow);
  transition: all 0.3s ease;
}

.book-card:hover {
  box-shadow: 0 4px 20px var(--shadow-hover);
}

.book-cover {
  width: 120px;
  height: 160px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
  text-align: center;
  padding: 10px;
}

.book-info {
  padding: 20px;
  flex: 1;
}

.book-title {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.book-author {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.book-rating {
  color: var(--accent);
  margin-bottom: 8px;
}

/* 图片灯箱 */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

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

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
}

/* 页脚 */
.footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 滚动动画 */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    flex-direction: column;
    padding: 20px;
    gap: 4px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 12px 16px;
  }

  .mobile-menu-btn {
    display: block;
  }

  .page-title {
    font-size: 2rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .map-container {
    height: 350px;
  }

  .book-card {
    flex-direction: column;
  }

  .book-cover {
    width: 100%;
    height: 200px;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.5rem;
  }

  .hero {
    padding: 40px 20px;
  }

  .avatar {
    width: 90px;
    height: 90px;
    font-size: 2.2rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* 加载动画 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 标记 */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-visited {
  background: var(--accent);
  color: white;
}

.badge-wishlist {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px dashed var(--border);
}
