/* ================================================================
   ziyue. — 极简个人博客样式
   ================================================================ */

/* ==================== 设计令牌 ==================== */
:root {
  /* 亮色 */
  --bg-light: #f8f7f4;
  --text-light: #2c2c2c;
  --muted-light: #999999;
  --subtle-light: #e8e6e1;
  --card-light: #ffffff;
  --border-light: #eae8e3;

  /* 暗色 */
  --bg-dark: #18181b;
  --text-dark: #e5e5e5;
  --muted-dark: #777777;
  --subtle-dark: #2a2a2e;
  --card-dark: #222225;
  --border-dark: #333337;

  /* 语义色 */
  --accent: #8b7355;
  --accent-light: #a08b6e;
  --radius: 8px;
  --radius-lg: 14px;

  /* 动画曲线 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Noto Serif SC",
    "Microsoft YaHei",
    sans-serif;
  background: var(--bg-light);
  color: var(--text-light);
  transition:
    background-color 0.8s var(--ease-in-out),
    color 0.8s var(--ease-in-out);
  line-height: 2;
  letter-spacing: 0.05em;
  overflow-x: hidden;
}

body.dark {
  background: var(--bg-dark);
  color: var(--text-dark);
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* ==================== 页面加载遮罩 ==================== */
.loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-light);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}

body.dark .loader {
  background: var(--bg-dark);
}

.loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-text {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 200;
  letter-spacing: 0.15em;
  color: var(--text-light);
  animation: loader-pulse 1.2s var(--ease-in-out) infinite alternate;
}

body.dark .loader-text {
  color: var(--text-dark);
}

@keyframes loader-pulse {
  from { opacity: 0.3; }
  to   { opacity: 1; }
}

/* ==================== 提示框 ==================== */
#toast {
  position: fixed;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.05em;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-light);
  transition: top 0.5s var(--ease-out);
  z-index: 9999;
  white-space: nowrap;
}

body.dark #toast {
  background: rgba(40, 40, 44, 0.7);
  color: var(--text-dark);
}

#toast.show {
  top: 30px;
}

/* ==================== 导航 ==================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 220px;
  height: 100dvh;
  padding: 30vh 40px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition:
    opacity 0.6s var(--ease-out),
    transform 0.5s var(--ease-out);
}

.sidebar.hidden-nav {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px);
}

.logo {
  font-size: 26px;
  font-weight: 200;
  letter-spacing: 2px;
  margin-bottom: 60px;
}

.logo a {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.3s;
}

.logo a:hover {
  opacity: 0.6;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin: 20px 0;
}

.sidebar a {
  text-decoration: none;
  color: var(--muted-light);
  font-size: 14px;
  letter-spacing: 0.1em;
  transition: color 0.3s, transform 0.3s;
  position: relative;
  display: inline-block;
}

.sidebar a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease-out);
}

.sidebar a:hover {
  color: var(--text-light);
  transform: translateX(4px);
}

.sidebar a:hover::after,
.sidebar a.active::after {
  width: 100%;
}

.sidebar a.active {
  color: var(--text-light);
}

body.dark .sidebar a {
  color: var(--muted-dark);
}

body.dark .sidebar a:hover,
body.dark .sidebar a.active {
  color: var(--text-dark);
}

/* ==================== 首屏 ==================== */
.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  position: relative;
}

.hero h1 {
  font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 200;
  letter-spacing: 0.12em;
  margin-bottom: 2rem;
}

.hero-title {
  font-style: italic;
}

.slogan {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted-light);
  letter-spacing: 4px;
  margin-bottom: 3rem;
  font-size: 14px;
  font-weight: 300;
}

.slogan .dot {
  opacity: 0.5;
}

body.dark .slogan {
  color: var(--muted-dark);
}

.poem {
  max-width: 650px;
  padding: 0 20px;
  font-size: 1.1rem;
  line-height: 2.2;
  letter-spacing: 2px;
  font-weight: 300;
  min-height: 2.2em;
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  opacity: 0.25;
  animation: float 2.5s var(--ease-in-out) infinite;
  cursor: pointer;
  transition: opacity 0.3s;
}

.scroll-hint:hover {
  opacity: 0.6;
}

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

/* ==================== 内容区（通用） ==================== */
.section {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 20px 100px;
  max-width: 860px;
  margin: 0 auto;
  position: relative;
}

.section-title {
  font-size: 1.2rem;
  letter-spacing: 8px;
  margin-bottom: 1rem;
  font-weight: 200;
  text-transform: uppercase;
}

.section-desc {
  color: var(--muted-light);
  font-size: 13px;
  letter-spacing: 2px;
  margin-bottom: 3.5rem;
  font-weight: 300;
}

body.dark .section-desc {
  color: var(--muted-dark);
}

/* ==================== 分隔线 ==================== */
.section::before {
  content: '';
  display: block;
  width: 30px;
  height: 1px;
  background: var(--border-light);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

body.dark .section::before {
  background: var(--border-dark);
}

/* ==================== 阅读区 — 博客卡片 ==================== */
.posts {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  padding: 28px 0;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  transition: padding-left 0.3s var(--ease-out);
  cursor: pointer;
}

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

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

body.dark .post-card {
  border-bottom-color: var(--border-dark);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted-light);
  letter-spacing: 0.05em;
}

body.dark .post-meta {
  color: var(--muted-dark);
}

.post-tag {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border-light);
  letter-spacing: 0.08em;
}

body.dark .post-tag {
  border-color: var(--border-dark);
}

.post-title {
  font-size: 1.15rem;
  font-weight: 400;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  transition: color 0.3s;
}

.post-card:hover .post-title {
  color: var(--accent);
}

.post-excerpt {
  font-size: 13px;
  color: var(--muted-light);
  line-height: 1.9;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

body.dark .post-excerpt {
  color: var(--muted-dark);
}

.post-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.06em;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
}

.post-card:hover .post-link {
  opacity: 1;
  transform: translateX(0);
}

/* ==================== 瞬间 — 时间轴 ==================== */
.timeline {
  width: 100%;
  max-width: 500px;
  text-align: left;
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border-light);
}

body.dark .timeline::before {
  background: var(--border-dark);
}

.timeline-item {
  position: relative;
  padding-bottom: 36px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-light);
  border: 1.5px solid var(--accent);
  transition: background 0.3s, transform 0.3s;
}

body.dark .timeline-dot {
  background: var(--bg-dark);
}

.timeline-item:hover .timeline-dot {
  background: var(--accent);
  transform: scale(1.3);
}

.timeline-content time {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 4px;
}

.timeline-content p {
  font-size: 14px;
  line-height: 1.9;
  color: var(--muted-light);
  letter-spacing: 0.03em;
}

body.dark .timeline-content p {
  color: var(--muted-dark);
}

/* ==================== 对话 ==================== */
.chat-container {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.chat-bubble {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 85%;
}

.chat-ai {
  align-self: flex-start;
}

.chat-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
  letter-spacing: 0;
}

.chat-ai .chat-avatar {
  background: var(--subtle-light);
  color: var(--muted-light);
}

.chat-user .chat-avatar {
  background: var(--accent);
  color: #fff;
}

body.dark .chat-ai .chat-avatar {
  background: var(--subtle-dark);
  color: var(--muted-dark);
}

.chat-text {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.8;
  letter-spacing: 0.03em;
}

.chat-ai .chat-text {
  background: var(--subtle-light);
  border-top-left-radius: 4px;
}

.chat-user .chat-text {
  background: var(--accent);
  color: #fff;
  border-top-right-radius: 4px;
}

body.dark .chat-ai .chat-text {
  background: var(--subtle-dark);
}

.chat-input-wrap {
  width: 100%;
  max-width: 520px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: transparent;
  color: inherit;
  font-size: 13px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
}

.chat-input:focus {
  border-color: var(--accent);
}

.chat-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

body.dark .chat-input {
  border-color: var(--border-dark);
}

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s, transform 0.3s;
}

.chat-send:hover:not(:disabled) {
  transform: scale(1.08);
}

.chat-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* 思考中动画 */
.thinking-dots span {
  animation: think-blink 1.4s ease-in-out infinite;
}
.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes think-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* ==================== 留言 ==================== */
.message-form {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 48px;
}

.form-input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  font-size: 14px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
  line-height: 1.6;
}

.form-input:focus {
  border-color: var(--accent);
}

body.dark .form-input {
  border-color: var(--border-dark);
}

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

.form-submit {
  align-self: flex-start;
  padding: 12px 32px;
  border: 1px solid var(--text-light);
  border-radius: 999px;
  background: transparent;
  color: var(--text-light);
  font-size: 13px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  font-family: inherit;
}

.form-submit:hover {
  background: var(--text-light);
  color: var(--bg-light);
}

body.dark .form-submit {
  border-color: var(--text-dark);
  color: var(--text-dark);
}

body.dark .form-submit:hover {
  background: var(--text-dark);
  color: var(--bg-dark);
}

/* 留言列表 */
.message-list {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message-item {
  text-align: left;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

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

body.dark .message-item {
  border-bottom-color: var(--border-dark);
}

.message-item-time {
  font-size: 11px;
  color: var(--muted-light);
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 6px;
}

body.dark .message-item-time {
  color: var(--muted-dark);
}

.message-item-content {
  font-size: 14px;
  line-height: 1.9;
  color: var(--muted-light);
  letter-spacing: 0.03em;
}

body.dark .message-item-content {
  color: var(--muted-dark);
}

/* ==================== Footer ==================== */
.site-footer {
  padding: 60px 20px 40px;
  text-align: center;
  border-top: 1px solid var(--border-light);
}

body.dark .site-footer {
  border-top-color: var(--border-dark);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.footer-brand {
  font-size: 18px;
  font-weight: 200;
  letter-spacing: 0.12em;
}

.footer-copy {
  font-size: 11px;
  color: var(--muted-light);
  letter-spacing: 0.06em;
}

body.dark .footer-copy {
  color: var(--muted-dark);
}

/* ==================== 功能按钮 ==================== */
.theme-btn,
.music-btn {
  position: fixed;
  bottom: 35px;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
  user-select: none;
  border-radius: 50%;
}

.theme-btn:hover,
.music-btn:hover {
  opacity: 1;
}

.music-btn.playing {
  opacity: 1;
  animation: music-pulse 2s ease-in-out infinite;
}

@keyframes music-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

.theme-btn {
  left: 35px;
}

.music-btn {
  right: 35px;
}

/* ==================== 滚动渐现动画 ==================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.8s var(--ease-out),
    transform 0.8s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 延迟组 */
.reveal.d1 { transition-delay: 0.1s; }
.reveal.d2 { transition-delay: 0.2s; }
.reveal.d3 { transition-delay: 0.3s; }
.reveal.d4 { transition-delay: 0.4s; }

/* ==================== 手机菜单按钮 ==================== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 25px;
  left: 25px;
  z-index: 1000;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.mobile-menu-btn:hover {
  opacity: 1;
}

/* ==================== 手机适配 ==================== */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .sidebar {
    width: 100%;
    background: var(--bg-light);
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    padding: 100px 40px;
  }

  body.dark .sidebar {
    background: var(--bg-dark);
  }

  .sidebar.show {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .hero h1 {
    font-size: clamp(4rem, 18vw, 6rem);
  }

  .slogan {
    font-size: 13px;
    letter-spacing: 1px;
    margin-bottom: 3rem;
  }

  .poem {
    font-size: 1rem;
    line-height: 2;
  }

  .section {
    padding: 80px 20px;
    min-height: auto;
  }

  .section-title {
    letter-spacing: 4px;
  }

  .post-card:hover {
    padding-left: 0;
  }

  .post-link {
    opacity: 1;
    transform: none;
  }

  .theme-btn {
    left: 25px;
  }

  .music-btn {
    right: 25px;
  }

  .chat-bubble {
    max-width: 92%;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: clamp(3.2rem, 16vw, 5rem);
  }

  .timeline {
    padding-left: 24px;
  }

  .timeline-dot {
    left: -24px;
  }

  .chat-input-wrap {
    max-width: 100%;
  }
}

/* ==================== 减少动效偏好 ==================== */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .scroll-hint {
    animation: none !important;
  }

  .loader-text {
    animation: none !important;
  }

  .music-btn.playing {
    animation: none !important;
  }
}
