/* ============================================================
 * 给湘如的第五年 · 视觉
 * 暖色系 / 移动端优先 / 克制有质感
 * ============================================================ */

:root {
  --bg: #faf6f0;
  --bg-soft: #f3ecdf;
  --card: #fffdf9;
  --text: #3a3430;
  --text-soft: #7a6f64;
  --accent: #d06b4f;      /* 珊瑚砖红 */
  --accent-soft: #e8b7a6;
  --line: #e8dfd2;
  --serif: Georgia, "Songti SC", "Noto Serif SC", "STSong", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  overflow-x: hidden;
}

/* ---------- 通用 ---------- */
.section {
  padding: 72px 24px;
  max-width: 720px;
  margin: 0 auto;
}
.section-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 40px;
  letter-spacing: 2px;
}
.section-title::after {
  content: "";
  display: block;
  width: 36px; height: 2px;
  background: var(--accent);
  margin: 14px auto 0;
}

/* 滚动入场动画 */
.fade {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s ease, transform .8s ease;
}
.fade.visible { opacity: 1; transform: none; }

/* ---------- Act 0 · 加载页 ---------- */
#loading {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
  z-index: 100;
  transition: opacity .6s ease, visibility .6s ease;
}
#loading.done { opacity: 0; visibility: hidden; }
.bing-wrap { position: relative; width: 140px; height: 140px; }
.bing { width: 140px; height: 140px; transform: rotate(-90deg); }
.bing-track { fill: none; stroke: var(--line); stroke-width: 8; }
.bing-fill {
  fill: none; stroke: var(--accent); stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 540;          /* 2πr ≈ 540 */
  stroke-dashoffset: 540;
  animation: bake 2.4s ease forwards;
}
@keyframes bake { to { stroke-dashoffset: 0; } }
.bing-emoji {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  animation: pop 2.4s ease forwards;
}
@keyframes pop {
  0% { transform: scale(.6); opacity: .4; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.loading-text { color: var(--text-soft); letter-spacing: 3px; }

/* ---------- Act 1 · Hero ---------- */
#hero {
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 48px 24px;
}
.hero-kicker { color: var(--text-soft); letter-spacing: 6px; font-size: .9rem; }
.hero-title {
  font-family: var(--serif);
  font-size: 2.4rem; font-weight: 700;
  margin: 14px 0 8px;
  letter-spacing: 3px;
}
.hero-sub { color: var(--text-soft); margin-bottom: 48px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; width: 100%; max-width: 520px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 12px;
  opacity: 0; transform: translateY(16px);
  transition: opacity .7s ease, transform .7s ease;
}
.stat.visible { opacity: 1; transform: none; }
.stat .num { font-family: var(--serif); font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat .num.dog-num img { width: 64px; height: 64px; display: block; margin: 0 auto; }
.stat .label { color: var(--text-soft); font-size: .82rem; margin-top: 4px; letter-spacing: 1px; }
.scroll-hint { margin-top: 48px; color: var(--text-soft); font-size: .85rem; letter-spacing: 2px; animation: float 2s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

/* ---------- Act 2 · 时间轴 ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line);
}
.tl-item { position: relative; margin-bottom: 44px; }
.tl-dot {
  position: absolute; left: -28px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
}
.tl-meta { font-size: .8rem; color: var(--accent); letter-spacing: 1px; font-weight: 600; }
.tl-month { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; margin: 2px 0; }
.tl-city { color: var(--text-soft); font-size: .85rem; }
.tl-title { font-size: 1.05rem; margin: 8px 0 2px; font-weight: 600; }
.tl-couplet { color: var(--text-soft); font-style: italic; font-family: var(--serif); margin-bottom: 10px; }
.tl-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag {
  font-size: .72rem; color: var(--text-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}
.tl-photos { margin-top: 4px; }
.tl-photos-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  margin: 0 -4px;
}
.tl-photo {
  flex: 0 0 80%;
  max-width: 360px;
  scroll-snap-align: start;
  aspect-ratio: 4/3;
  background: var(--bg-soft);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-size: .8rem;
  overflow: hidden;
}
.tl-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-photo-empty { width: 100%; max-width: none; flex-basis: 100%; }
.tl-photos-count {
  margin-top: 8px;
  font-size: .72rem;
  color: var(--text-soft);
  letter-spacing: 1px;
}

/* ---------- Act 3 · 仪式线 ---------- */
.ritual-line { margin-bottom: 40px; }
.ritual-line h3 { font-family: var(--serif); font-size: 1.2rem; margin-bottom: 14px; }
.ritual-line h3 .icon { margin-right: 6px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.ritual-scroll {
  display: flex; gap: 12px;
  overflow-x: auto; padding: 4px 4px 14px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.ritual-card {
  flex: 0 0 150px; scroll-snap-align: start;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 14px;
  text-align: center;
}
.ritual-card .r-date { color: var(--accent); font-size: .75rem; font-weight: 600; letter-spacing: 1px; }
.ritual-card .r-text { font-size: .88rem; margin-top: 6px; }
.ritual-card .r-photo {
  width: 100%; aspect-ratio: 1/1; border-radius: 10px; margin-top: 10px;
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-size: .7rem; overflow: hidden;
}
.ritual-card .r-photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Act 4 · 前传 ---------- */
.prologue { text-align: center; }
.pro-item { margin-bottom: 22px; }
.pro-item .p-date { color: var(--accent); font-weight: 600; letter-spacing: 1px; }
.pro-item .p-text { font-size: 1rem; margin-top: 2px; }

/* ---------- Act 5 · 成长 ---------- */
.growth-text { text-align: center; color: var(--text-soft); font-family: var(--serif); font-size: 1.05rem; margin-bottom: 12px; }
.growth-text.strong { color: var(--text); font-size: 1.3rem; font-weight: 600; }
.chat-title {
  text-align: center;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--text-soft);
  margin: 40px 0 20px;
  letter-spacing: 1px;
}
.chat-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.chat-stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 12px;
  text-align: center;
}
.chat-stat .cs-num {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}
.chat-stat .cs-label {
  color: var(--text-soft);
  font-size: .78rem;
  margin-top: 4px;
  letter-spacing: 1px;
}

/* ---------- Act 5.5 · 写给你的信 ---------- */
#letter { max-width: 780px; }
.letter-card {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 48px 34px 44px;
  box-shadow: 0 12px 32px rgba(138, 90, 68, .10);
}
.letter-stamp {
  position: absolute; top: 24px; right: 24px;
  width: 60px; height: 74px;
  border: 2px dashed var(--accent-soft);
  border-radius: 6px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  color: var(--accent);
  font-size: .68rem;
  letter-spacing: 2px;
  transform: rotate(5deg);
  opacity: .9;
}
.letter-stamp .s-num {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
}
.letter-body p {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", var(--serif);
  font-size: 1.08rem;
  line-height: 2.05;
  margin-bottom: 1.3em;
  letter-spacing: .3px;
  color: var(--text);
}
.letter-body p:first-child {
  font-size: 1.18rem;
  font-weight: 600;
  margin-bottom: 1em;
}
.letter-divider {
  text-align: center;
  font-size: .85rem;
  letter-spacing: 6px;
  margin: 1.6em 0 .6em;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.letter-body p.letter-close {
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  line-height: 2.1 !important;
  margin-bottom: 0 !important;
}
@media (max-width: 600px) {
  .letter-card { padding: 40px 22px 36px; }
  .letter-stamp { top: 18px; right: 18px; width: 52px; height: 64px; }
  .letter-body p { font-size: 1.02rem; line-height: 2; }
}

/* ---------- Act 6 · 揭晓 ---------- */
#reveal { text-align: center; padding-bottom: 120px; }
.reveal-headline { font-family: var(--serif); font-size: 1.3rem; color: var(--text-soft); letter-spacing: 2px; }
.countdown {
  font-family: var(--serif); font-size: 6rem; font-weight: 700;
  color: var(--accent); line-height: 1; margin-top: 12px;
}
.countdown-unit { color: var(--text-soft); letter-spacing: 4px; margin-top: 4px; }
.reveal-lines { margin: 36px auto; max-width: 420px; }
.reveal-lines p { font-family: var(--serif); font-size: 1.08rem; margin-bottom: 10px; color: var(--text); }
.gift-hint { color: var(--text-soft); font-size: .8rem; }
.bing-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }

/* ---------- Act 2.5 · 旅行地图 ---------- */
#map-container {
  height: 420px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.map-pin {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.leaflet-popup-content-wrapper {
  border-radius: 12px;
  font-family: var(--sans);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.leaflet-popup-content {
  font-size: .82rem; line-height: 1.6;
  margin: 12px 14px;
}
.leaflet-container { font-family: var(--sans); }

/* ---------- Lightbox 图片预览 ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.lightbox.show { opacity: 1; visibility: visible; }
.lb-img {
  max-width: 94vw; max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
  -webkit-user-drag: none;
}
.lb-close {
  position: absolute; top: 16px; right: 16px;
  width: 42px; height: 42px;
  background: rgba(255,255,255,.16);
  border: none; border-radius: 50%;
  color: #fff; font-size: 26px; line-height: 1;
  cursor: pointer;
}
.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  background: rgba(255,255,255,.16);
  border: none; border-radius: 50%;
  color: #fff; font-size: 24px; line-height: 1;
  cursor: pointer;
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
@media (max-width: 600px) {
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
}

/* ---------- 彩蛋 ---------- */
#dog {
  position: fixed; right: 18px; bottom: 18px;
  width: 54px; height: 54px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; cursor: pointer; z-index: 90;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  transition: transform .2s ease;
}
#dog:active { transform: scale(.9); }
#dog img { width: 74%; height: 74%; }
#egg-toast {
  position: fixed; left: 50%; bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 12px 20px; border-radius: 999px;
  font-size: .88rem; max-width: 80%;
  opacity: 0; pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
  z-index: 95;
}
#egg-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 桌面增强 ---------- */
@media (min-width: 768px) {
  .hero-title { font-size: 3.2rem; }
  .stats { grid-template-columns: repeat(3, 1fr); max-width: 620px; }
  .section { padding: 96px 32px; }
  .tl-photo { aspect-ratio: 16/10; }
  .ritual-card { flex: 0 0 180px; }
}
