:root {
  --bg: #faf7f2;
  --bg-card: #fffdf9;
  --ink: #2c2623;
  --ink-muted: #786e66;
  --accent: #b86b52;
  --accent-soft: rgba(184, 107, 82, 0.12);
  --border: rgba(44, 38, 35, 0.09);
  --shadow: 0 18px 45px rgba(44, 38, 35, 0.08);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(184, 107, 82, 0.05), transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(212, 163, 115, 0.06), transparent 45%),
    var(--bg);
  overflow-x: hidden;
}

/* 顶部进度条 */
.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(44, 38, 35, 0.06);
  z-index: 100;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #d4a373, var(--accent));
  transition: width 0.12s linear;
}

/* 封面 Hero */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  position: relative;
}

.hero-inner {
  max-width: 680px;
}

.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--accent);
  margin: 0 0 18px;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0 0 22px;
  line-height: 1.25;
}

.hero-subtitle {
  font-size: 16px;
  line-height: 1.9;
  color: var(--ink-muted);
  margin: 0 0 28px;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-muted);
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.scroll-cue {
  position: absolute;
  bottom: 34px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.08em;
  transition: color 0.3s;
}

.scroll-cue:hover {
  color: var(--accent);
}

.scroll-cue svg {
  animation: floatDown 2s ease-in-out infinite;
}

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

/* 正文容器 */
.memoir-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* 章节分隔标题 */
.chapter-header {
  text-align: center;
  margin: 96px auto 56px;
  max-width: 560px;
}

.chapter-header:first-child {
  margin-top: 32px;
}

.chapter-badge {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.chapter-title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
  margin: 0 0 10px;
}

.chapter-desc {
  font-size: 14px;
  color: var(--ink-muted);
  line-height: 1.8;
  margin: 0;
}

/* 故事卡片通用 */
.story-block {
  margin-bottom: 110px;
}

/* 布局 A / B：左图右文 & 右图左文 */
.story-split {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 52px;
  align-items: center;
}

.story-split.reverse .photo-wrap {
  order: 2;
}

.story-split.reverse .text-wrap {
  order: 1;
}

.photo-frame {
  background: var(--bg-card);
  padding: 12px 12px 18px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform 0.5s var(--ease-out-expo), box-shadow 0.5s var(--ease-out-expo);
}

.photo-frame:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 55px rgba(44, 38, 35, 0.12);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 540px;
  object-fit: cover;
  border-radius: 3px;
}

.photo-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 0 4px;
  font-size: 12px;
  color: var(--ink-muted);
}

.text-wrap {
  padding: 8px 4px;
}

.story-date {
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 0 0 10px;
}

.story-heading {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  margin: 0 0 18px;
  line-height: 1.4;
}

.story-body {
  font-size: 15.5px;
  line-height: 1.95;
  color: #463f3b;
  margin: 0;
  white-space: pre-line;
}

/* 布局 C：全宽沉浸大图 */
.story-wide {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.story-wide .photo-frame img {
  max-height: 580px;
}

.story-wide .text-wrap {
  max-width: 620px;
  margin: 28px auto 0;
}

/* 布局 D：双图并排 */
.story-duo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.story-duo .text-wrap {
  max-width: 640px;
  margin: 28px auto 0;
  text-align: center;
}

/* 布局 E：多图拼图网格（3 / 4 / 6 张） */
.story-multi-grid {
  display: grid;
  gap: 20px;
  align-items: stretch;
}

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

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

.story-multi-grid .photo-frame img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.story-grid .text-wrap {
  max-width: 660px;
  margin: 28px auto 0;
  text-align: center;
}

/* 布局 E：纯文字信笺插页 */
.story-quote {
  max-width: 660px;
  margin: 90px auto 110px;
  padding: 42px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(44, 38, 35, 0.04);
  text-align: center;
  position: relative;
}

.story-quote::before {
  content: "“";
  font-family: var(--serif);
  font-size: 56px;
  line-height: 1;
  color: var(--accent-soft);
  display: block;
  margin-bottom: -14px;
}

.story-quote blockquote {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.9;
  margin: 0 0 14px;
}

.story-quote cite {
  font-style: normal;
  font-size: 13px;
  color: var(--ink-muted);
}

/* 结尾 */
.memoir-footer {
  padding: 80px 24px 110px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer-quote {
  font-family: var(--serif);
  font-size: 1.35rem;
  margin: 0 0 12px;
}

.footer-note {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 28px;
}

.back-top-btn {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, transform 0.25s;
}

.back-top-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* 核心：平滑浮现动效 */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  filter: blur(4px);
  transition:
    opacity 0.95s var(--ease-out-expo),
    transform 0.95s var(--ease-out-expo),
    filter 0.95s var(--ease-out-expo);
  will-change: opacity, transform, filter;
}

.reveal.reveal-photo {
  transform: translateY(42px) scale(0.97);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 15, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: 90vw;
  max-height: 88vh;
  text-align: center;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.lightbox-figure figcaption {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lightbox-close {
  top: 20px;
  right: 24px;
  width: 42px;
  height: 42px;
  font-size: 26px;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 28px;
}

.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }

/* 响应式 */
@media (max-width: 860px) {
  .story-split,
  .story-duo-grid,
  .story-multi-grid.cols-2,
  .story-multi-grid.cols-3 {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .story-split.reverse .photo-wrap,
  .story-split.reverse .text-wrap {
    order: initial;
  }

  .story-block {
    margin-bottom: 76px;
  }
}

/* 尊重系统“减少动态效果”设置 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal,
  .reveal.reveal-photo {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
  .scroll-cue svg {
    animation: none;
  }
}
