:root {
  --primary-color: #6d5c4b;
  --secondary-color: #4a4a48;
  --accent-color: #9ab0a5;
  --bg-gradient: linear-gradient(135deg, #f4f1ed 0%, #e5e1da 100%);
  --transition-bg: radial-gradient(
    circle at 50% 50%,
    rgba(244, 241, 237, 0.8) 0%,
    rgba(229, 225, 218, 0.6) 100%
  );
  --text-primary: #3e3c36;
  --parchment: #fffcf5;
  --page-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
  --stardust-color: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.8) 10%,
    transparent 70%
  );
}

body {
  background: var(--bg-gradient);
  font-family: "Noto Serif SC", serif;
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  transition: background 0.6s ease;
}

.morph-container {
  position: fixed;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

.morph-bg {
  position: absolute;
  background: var(--transition-bg);
  animation: morph 24s infinite linear;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  filter: blur(60px);
  opacity: 0.8;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  /* margin-top: 5%; */
}

.journal-cover {
  width: 90%;
  max-width: 380px;
  height: auto;
  min-height: 520px;
  background: var(--parchment);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transform: scale(0.95);
  opacity: 0;
}

.cover-content {
  padding: 2rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* background: linear-gradient(15deg, rgba(255, 252, 245, 0.6) 0%, rgba(255, 252, 245, 0.3) 100%); */
}

.title {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.5rem;
  color: var(--primary-color);
  text-align: center;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transform: translateY(20px);
  opacity: 0;
}

.divider {
  width: 100px;
  height: 1px;
  background: var(--accent-color);
  margin: 1.5rem auto;
  transform: scaleX(0);
  opacity: 0;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--secondary-color);
  letter-spacing: 0.1em;
  text-align: center;
  transform: translateY(20px);
  opacity: 0;
}

.content-pages {
  display: none;
  width: 90%;
  max-width: 800px;
  background: var(--bg-gradient) !important;
  /* 强制使用首页渐变 */
  box-shadow: var(--page-shadow);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.16);
  position: relative;
  overflow: hidden;
  margin: 2rem auto;
}

.content-pages::before {
  content: "";
  position: absolute;
  width: 120%;
  height: 120%;
  background: inherit;
  filter: blur(30px);
  z-index: -1;
}

.page {
  padding: 2rem;
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.page.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.entry-content {
  width: 100%;
  line-height: 1.8;
  font-size: 1rem;
}

.journal-image {
  width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.journal-image:hover {
  transform: scale(1.02);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 30px;
  cursor: pointer;
  z-index: 1001;
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
    min-height: auto;
  }

  .title {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .entry-content {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .journal-image {
    margin: 1rem 0;
  }

  .modal-content {
    max-width: 95%;
  }

  .journal-cover {
    margin-top: 45%;
    margin-bottom: 45%;
  }
}

/* 新增深色模式变量 */
:root {
  --primary-color: #6d5c4b;
  --secondary-color: #4a4a48;
  --accent-color: #9ab0a5;
  --bg-gradient: linear-gradient(135deg, #f9f5f0 0%, #e8e4dd 100%);
  --text-primary: #3e3c36;
  --parchment: #fffcf5;
  --page-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #c4b7a6;
    --secondary-color: #a8a8a8;
    --accent-color: #6e8b7d;
    --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --text-primary: #e0e0e0;
    --parchment: #2a2a2a;
    --page-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  }
}

[data-theme="dark"] {
  --primary-color: #c4b7a6;
  --secondary-color: #a8a8a8;
  --accent-color: #6e8b7d;
  --bg-gradient: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
  --transition-bg: radial-gradient(
    circle at 30% 50%,
    rgba(46, 49, 49, 0.9) 0%,
    rgba(23, 25, 26, 0.8) 100%
  );
  --text-primary: #e0e0e0;
  --parchment: #363636;
  --page-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  --stardust-color: radial-gradient(
    circle,
    rgba(154, 176, 165, 0.6) 10%,
    transparent 70%
  );

  /* 内容页主容器 */
  .content-pages {
    background: linear-gradient(
      135deg,
      rgba(42, 42, 42, 0.95) 0%,
      rgba(30, 30, 30, 0.9) 100%
    ) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  }

  /* 模糊背景层 */
  .content-pages::before {
    background: linear-gradient(
      135deg,
      rgba(18, 18, 18, 0.8) 0%,
      rgba(35, 35, 35, 0.6) 100%
    );
    filter: blur(30px) brightness(0.9);
  }

  /* 页面内容 */
  .page {
    background: rgba(25, 25, 25, 0.4);
    border-radius: 8px;
  }

  /* 图片卡片 */
  .photo-card {
    background: rgba(40, 40, 40, 0.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }

  /* 引用叠加层 */
  .quote-overlay {
    background: linear-gradient(
      to top,
      rgba(15, 15, 15, 0.9) 30%,
      transparent 100%
    );
  }
}

/* 新增星际穿越动画 */
@keyframes stardust {
  0% {
    opacity: 0;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.5);
  }

  100% {
    opacity: 0;
    transform: scale(2);
  }
}

.stardust {
  position: fixed;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.8) 10%,
    transparent 70%
  );
  width: 20px;
  height: 20px;
  border-radius: 50%;
  pointer-events: none;
  animation: stardust 1.2s ease-out;
}

/* 新增主题切换按钮 */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle::before {
  content: "🌙";
  font-size: 1.2rem;
}

[data-theme="dark"] .theme-toggle::before {
  content: "☀️";
}

/* 修改原有动画 */
.journal-cover {
  transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55),
    box-shadow 0.6s ease;
}

@keyframes morph {
  0% {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  }

  33% {
    border-radius: 70% 30% 50% 50% / 30% 40% 60% 70%;
  }

  66% {
    border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%;
  }

  100% {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  }
}

.modal-content {
  max-width: 80%;
  max-height: 80vh;
  border-radius: 12px;
  position: relative;
  /* background: var(--parchment); */
  padding: 20px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.quote-overlay {
  position: absolute;
  bottom: 0;
  padding: 2rem;
  /* background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); */
  color: white;
  opacity: 0;
  transition: 0.3s;
  width: 100%;
  box-sizing: border-box;
}

.photo-card:hover .quote-overlay {
  opacity: 1;
}

.quote-overlay blockquote {
  color: white;
  font-size: 1.1rem;
  text-align: center;
  line-height: 1.6;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.photo-card:hover .quote-overlay blockquote {
  transform: translateY(0);
}

/* 深色模式适配 */
[data-theme="dark"] .quote-overlay {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .quote-overlay blockquote {
  color: var(--accent-color);
}

/* 新增封面图片样式 */
.journal-cover {
  perspective: 1200px;
}

.cover-decoration-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.4;
  filter: grayscale(1) blur(2px);
  mix-blend-mode: multiply;
  transition: all 1.2s cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
  z-index: 0;
}

/* 封面悬停效果 */
.journal-cover:hover .cover-decoration-image {
  opacity: 0.6;
  filter: grayscale(0.6) blur(1px);
  transform: translate(-3%, -3%) rotateZ(-1deg);
}

/* 封面打开动画 */
.journal-cover.hidden ~ .cover-decoration-image {
  animation: dissolve 1.2s ease-in-out;
}

@keyframes dissolve {
  50% {
    opacity: 0.8;
    filter: grayscale(0) blur(8px);
  }

  100% {
    opacity: 0;
    transform: translateY(40px) scale(1.2);
  }
}

/* 深色模式适配 */
[data-theme="dark"] .cover-decoration-image {
  mix-blend-mode: screen;
  filter: grayscale(1) blur(1px) contrast(1.1);
  opacity: 0.5;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .cover-decoration-image {
    width: 120%;
    transform: translate(-10%, -5%) rotateZ(-1deg);
  }

  [data-theme="dark"] {
    .content-pages {
      background: linear-gradient(
        135deg,
        rgba(35, 35, 35, 0.95) 0%,
        rgba(25, 25, 25, 0.9) 100%
      ) !important;
    }

    .content-pages::before {
      filter: blur(20px) brightness(0.8);
    }
  }
}
