/* ===== 暮色 Museve — 全局样式 ===== */

/* ---------- CSS 变量 ---------- */
:root {
  /* 品牌色板 */
  --twilight-white: #F9F7F4;     /* 暮光白 主背景 */
  --dusk-rose: #DDB8B8;          /* 薄暮玫瑰 主强调色 */
  --rose-deep: #B28B8B;          /* 玫瑰深 悬浮态 */
  --haze-gray: #F5F2F0;          /* 暮霭灰 次级背景 */
  --serene-blue: #A8C5DA;        /* 静谧蓝 辅助强调 */
  --night-brown: #3E3640;        /* 深夜褐 主文字 */
  --age-gray: #8E827F;           /* 岁月灰 辅助文字 */
  --fog-green: #87A878;          /* 雾绿 已发布 */
  --warm-orange: #E0A96D;        /* 暖橙 待审核 */
  --bean-red: #D18B8B;           /* 豆沙红 删除/错误 */
  --ash-blue: #9BADB7;           /* 灰蓝 已归档 */

  /* 设计 Token */
  --bg-primary: #F9F7F4;
  --card-bg: rgba(255, 255, 255, 0.65);
  --card-blur: blur(20px);
  --accent: #DDB8B8;
  --accent-hover: #B28B8B;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 50px;
  --shadow-card: 0 4px 20px rgba(62, 54, 64, 0.06);
  --shadow-hover: 0 12px 32px rgba(62, 54, 64, 0.12);
  --text-primary: #3E3640;
  --text-secondary: #8E827F;

  /* 字体系统 */
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-handwrite: 'ZCOOL XiaoWei', 'Caveat', cursive;

  /* 字号阶梯 */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-4xl: 2.25rem;

  /* 兼容旧变量 */
  --shadow-sm: 0 1px 3px rgba(62, 54, 64, 0.06);
  --shadow-md: 0 4px 12px rgba(62, 54, 64, 0.1);
  --shadow-lg: 0 8px 30px rgba(62, 54, 64, 0.15);
  --radius: 12px;
  --transition: all 0.3s ease;
}

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

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

body {
  font-family: var(--font-serif);
  color: var(--night-brown);
  background-color: var(--twilight-white);
  line-height: 1.75;
  min-height: 100vh;
}

a {
  color: var(--dusk-rose);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--rose-deep);
}

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

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--dusk-rose);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--rose-deep);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--dusk-rose) transparent;
}

/* ---------- 毛玻璃效果 ---------- */
.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ---------- Pjax 内容过渡 ---------- */
.pjax-fade-in {
  animation: fadeInUp 0.3s ease;
}

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

.pjax-fade-out {
  animation: fadeOut 0.15s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}

/* ---------- 卡片通用 ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
}

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

/* ---------- 文章卡片 ---------- */
.article-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.article-card__cover {
  flex-shrink: 0;
  width: 200px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  object-fit: cover;
}

.article-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.article-card__title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--night-brown);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.article-card__excerpt {
  font-size: 0.9rem;
  color: var(--age-gray);
  line-height: 1.7;
  position: relative;
  max-height: 4.8em;
  overflow: hidden;
}

.article-card__excerpt::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2em;
  background: linear-gradient(to bottom, transparent, #fff);
  pointer-events: none;
}

.article-card__meta {
  font-size: 0.8rem;
  color: var(--age-gray);
  margin-top: 8px;
}

/* ---------- 气泡样式 .whisper-bubble ---------- */
.whisper-bubble {
  position: relative;
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 75%;
  background: var(--haze-gray);
  color: var(--night-brown);
}

.whisper-bubble::before {
  content: '';
  position: absolute;
  bottom: 12px;
  left: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 10px 8px 0;
  border-color: transparent var(--haze-gray) transparent transparent;
}

/* 随机柔和背景色变体 */
.whisper-bubble--rose { background: rgba(221, 184, 184, 0.25); }
.whisper-bubble--rose::before { border-right-color: rgba(221, 184, 184, 0.25); }

.whisper-bubble--blue { background: rgba(168, 197, 218, 0.25); }
.whisper-bubble--blue::before { border-right-color: rgba(168, 197, 218, 0.25); }

.whisper-bubble--green { background: rgba(135, 168, 120, 0.2); }
.whisper-bubble--green::before { border-right-color: rgba(135, 168, 120, 0.2); }

.whisper-bubble--orange { background: rgba(224, 169, 109, 0.2); }
.whisper-bubble--orange::before { border-right-color: rgba(224, 169, 109, 0.2); }

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

.timeline__line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(62, 54, 64, 0.12);
  transform: translateX(-50%);
}

.timeline__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin-bottom: 48px;
}

.timeline__item:nth-child(odd) {
  flex-direction: row-reverse;
}

.timeline__item:nth-child(odd) .timeline__content {
  text-align: right;
  padding-right: 48px;
  padding-left: 0;
}

.timeline__item:nth-child(even) .timeline__content {
  padding-left: 48px;
}

.timeline__node {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 12px;
  height: 12px;
  background: var(--dusk-rose);
  border-radius: 50%;
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 0 0 4px rgba(221, 184, 184, 0.3);
}

.timeline__content {
  width: 50%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.timeline__date {
  font-size: 0.8rem;
  color: var(--age-gray);
  margin-bottom: 6px;
}

.timeline__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.timeline__desc {
  font-size: 0.9rem;
  color: var(--age-gray);
}

/* ---------- 打字机光标 ---------- */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--dusk-rose);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---------- 滚动动画基类 ---------- */
.scroll-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .article-card {
    flex-direction: column;
  }

  .article-card__cover {
    width: 100%;
    height: 180px;
  }

  /* 时间轴：移动端单列 */
  .timeline__line {
    left: 16px;
  }

  .timeline__item,
  .timeline__item:nth-child(odd) {
    flex-direction: column;
    padding-left: 40px;
  }

  .timeline__node {
    left: 16px;
    transform: translateX(-50%);
  }

  .timeline__item:nth-child(odd) .timeline__content,
  .timeline__item:nth-child(even) .timeline__content {
    width: 100%;
    text-align: left;
    padding: 0;
  }

  .whisper-bubble {
    max-width: 90%;
  }
}

@media (max-width: 1024px) {
  .container {
    padding: 0 20px;
  }
}

/* ---------- 工具类 ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.text-center { text-align: center; }
.text-muted { color: var(--age-gray); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ---------- 移动端底部安全区 ---------- */
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- 背景纹理噪点 ---------- */
.bg-noise {
    position: relative;
}
.bg-noise::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ---------- 加载指示器 ---------- */
@keyframes bounce-dot {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
}
.loading-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dusk-rose);
    margin: 0 3px;
    animation: bounce-dot 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

/* ---------- Toast 通知 ---------- */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: var(--text-sm);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}
.toast.show { transform: translateX(0); }
.toast.success { background: var(--fog-green); }
.toast.error { background: var(--bean-red); }
.toast.warning { background: var(--warm-orange); }

/* ---------- 滚动淡入 ---------- */
.scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 行截断 ---------- */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- 渐变淡出摘要 ---------- */
.text-fade-out {
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
