:root {
  --paper: #f8f3e9;
  --paper-2: #fffdf7;
  --ink: #253433;
  --teal: #2c6b67;
  --teal-soft: #dcebe7;
  --coral: #e2635f;
  --coral-soft: #fbe4df;
  --amber: #e5a44c;
  --line: #e7ddcd;
  --shadow: rgba(60, 50, 40, 0.14);
  --font-body: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-display: "Kaiti SC", "STKaiti", "KaiTi", "楷体", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  letter-spacing: 0;
}

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

button {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(250, 246, 238, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
}

.nav-brand svg {
  width: 20px;
  height: 20px;
  fill: var(--coral);
}

.nav-links {
  display: flex;
  gap: 18px;
  font-size: 14px;
  color: #5b625f;
}

.nav-links a {
  position: relative;
  padding: 6px 2px;
  white-space: nowrap;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 2px;
  height: 2px;
  background: var(--coral);
  transition: right 0.25s ease;
}

.nav-links a:hover::after {
  right: 0;
}

.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 32px 72px;
  background:
    linear-gradient(160deg, #fdfaf3 0%, #f7eee1 58%, #eef3ef 100%);
}

.hero-copy {
  max-width: 560px;
}

.hero-eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 14px;
  border: 1px solid var(--coral);
  border-radius: 999px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 700;
}

.hero h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 96px;
  line-height: 1.1;
}

.hero-sub {
  margin: 0 0 14px;
  color: var(--teal);
  font-size: 22px;
  font-weight: 600;
}

.hero-intro {
  max-width: 480px;
  margin: 0;
  color: #5f6a66;
  font-size: 16px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 34px;
}

.stat-tile {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.03);
}

.stat-tile span {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.25;
  color: var(--coral);
}

.stat-tile small {
  color: #6b736f;
  font-size: 12px;
}

.hero-photos {
  position: relative;
  height: 520px;
}

.hero-pic {
  position: absolute;
  width: 210px;
  margin: 0;
  padding: 10px 10px 36px;
  background: #fff;
  border: 1px solid #f0e5d6;
  border-radius: 4px;
  box-shadow: 0 14px 30px var(--shadow);
  cursor: pointer;
  transition: transform 0.3s ease;
}

.hero-pic img {
  aspect-ratio: 3 / 4;
  width: 100%;
  object-fit: cover;
  border-radius: 2px;
}

.hero-pic figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  text-align: center;
  color: #7a7064;
  font-size: 12px;
}

.pic-a {
  left: 6%;
  top: 8%;
  z-index: 3;
  transform: rotate(-6deg);
}

.pic-b {
  left: 38%;
  top: 16%;
  z-index: 4;
  transform: rotate(3deg);
}

.pic-c {
  left: 18%;
  top: 52%;
  z-index: 2;
  transform: rotate(-2deg);
}

.hero-pic:hover {
  z-index: 5;
  transform: rotate(0) translateY(-4px);
}

.section {
  max-width: 1160px;
  margin: 0 auto;
  padding: 96px 24px;
}

.section-head {
  max-width: 640px;
  margin-bottom: 48px;
}

.section-eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.section-head h2,
.letter-paper h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1.25;
}

.section-intro {
  margin: 0;
  color: #66706c;
  font-size: 16px;
}

.timeline {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 0;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    to bottom,
    var(--teal) 0 8px,
    transparent 8px 16px
  );
  opacity: 0.5;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 64px 1fr;
  align-items: center;
  margin: 30px 0;
}

.tl-dot {
  grid-column: 2;
  justify-self: center;
  position: relative;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: 4px solid var(--paper);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 2px var(--coral);
}

.tl-card {
  grid-column: 1;
  position: relative;
  z-index: 1;
  padding: 22px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(60, 50, 40, 0.08);
}

.timeline-item:nth-child(even) .tl-card {
  grid-column: 3;
}

.tl-date {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.tl-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.3;
}

.tl-place {
  margin-bottom: 10px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
}

.tl-story {
  margin: 0 0 16px;
  color: #59645f;
  font-size: 15px;
}

.tl-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.photo-thumb {
  padding: 5px;
  background: #fff;
  border: 1px solid #eee3d5;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(60, 50, 40, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.photo-thumb img {
  aspect-ratio: 3 / 4;
  width: 100%;
  object-fit: cover;
  border-radius: 2px;
}

.photo-thumb:hover {
  transform: translateY(-3px);
}

.journey-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr);
  align-items: start;
  gap: 28px;
}

.journey-map {
  position: relative;
  padding: 12px;
  background: #f2f6f2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#journeySvg {
  display: block;
  width: 100%;
  height: auto;
}

.route-line {
  fill: none;
  stroke: var(--coral);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 7 7;
  opacity: 0.55;
}

.journey-map.drawn .route-line {
  animation: dashMove 6s linear infinite;
}

@keyframes dashMove {
  to {
    stroke-dashoffset: -56;
  }
}

.city-node circle {
  fill: #fff;
  stroke: var(--teal);
  stroke-width: 2;
}

.city-node.heart circle {
  fill: var(--coral);
  stroke: var(--coral);
}

.city-node .city-label {
  font-size: 15px;
  font-weight: 700;
  fill: var(--ink);
}

.city-node .city-note {
  font-size: 11px;
  fill: #6b736f;
}

.city-node.home .city-label {
  fill: #a06a1c;
}

.journey-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.legend-icon {
  display: grid;
  width: 26px;
  height: 26px;
  flex: none;
  place-items: center;
  border-radius: 50%;
}

.legend-icon svg {
  width: 14px;
  height: 14px;
  fill: #fff;
}

.legend-icon.home {
  background: var(--amber);
}

.legend-icon.heart {
  background: var(--coral);
}

.legend-icon.school {
  background: var(--teal);
}

.legend-icon.trip {
  background: #7d93c9;
}

.legend-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.4;
}

.legend-item small {
  color: #6b736f;
  font-size: 12px;
}

.photo-wall {
  display: grid;
  gap: 56px;
}

.pw-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.pw-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.3;
}

.pw-date {
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.pw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}

.polaroid {
  position: relative;
  margin: 0;
  padding: 8px 8px 30px;
  background: #fff;
  border: 1px solid #f0e5d6;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(60, 50, 40, 0.12);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.polaroid:nth-child(3n + 1) {
  transform: rotate(-1.5deg);
}

.polaroid:nth-child(3n + 2) {
  transform: rotate(1deg);
}

.polaroid:nth-child(3n) {
  transform: rotate(-0.6deg);
}

.polaroid:hover {
  z-index: 2;
  transform: rotate(0) translateY(-5px);
  box-shadow: 0 14px 28px rgba(60, 50, 40, 0.18);
}

.polaroid img {
  aspect-ratio: 3 / 4;
  width: 100%;
  object-fit: cover;
  border-radius: 2px;
}

.polaroid figcaption {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  text-align: center;
  color: #8a8072;
  font-size: 11px;
}

.letter-section {
  padding-top: 64px;
  padding-bottom: 120px;
  background:
    linear-gradient(180deg, transparent 0%, rgba(44, 107, 103, 0.05) 100%);
}

.letter-paper {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 64px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(60, 50, 40, 0.12);
}

.letter-paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 64px;
  right: 64px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--coral), var(--amber), var(--teal));
}

.letter-body p {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 2.1;
  color: #3f4a46;
}

.letter-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}

.letter-tool-btn {
  padding: 7px 14px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: transparent;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.letter-tool-btn:hover {
  background: var(--teal);
  color: #fff;
}

.letter-edit textarea {
  display: block;
  width: 100%;
  min-height: 280px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 2;
  resize: vertical;
}

.letter-edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.letter-status {
  margin: 0 auto 0 0;
  color: var(--teal);
  font-size: 13px;
}

.letter-btn {
  padding: 8px 18px;
  border: 1px solid var(--coral);
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}

.letter-btn:hover {
  background: #cf524e;
}

.letter-btn.ghost {
  background: transparent;
  color: var(--coral);
}

.letter-btn.ghost:hover {
  background: var(--coral-soft);
}

.letter-signature {
  margin: 28px 0 0;
  text-align: right;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--coral);
}

.hidden {
  display: none !important;
}

.site-footer {
  padding: 40px 20px;
  background: var(--ink);
  color: #f3efe6;
  text-align: center;
}

.site-footer p {
  margin: 6px 0;
}

.site-footer .footer-sub {
  opacity: 0.75;
  font-size: 13px;
}

.music-player {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(600px, calc(100vw - 32px));
  padding: 10px 16px 10px 10px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(60, 50, 40, 0.18);
  transform: translateX(-50%);
}

.music-player[hidden] {
  display: none;
}

.music-play-btn {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.music-play-btn:hover {
  background: #cf524e;
}

.music-play-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-pause {
  display: none;
}

.music-player.playing .icon-play {
  display: none;
}

.music-player.playing .icon-pause {
  display: block;
}

.music-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.3;
}

.music-info strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-info small {
  color: #6b736f;
  font-size: 11px;
}

.music-track {
  display: flex;
  min-width: 140px;
  flex: 1;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.music-bar {
  height: 6px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: var(--teal-soft);
}

.music-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
}

.music-time {
  color: #6b736f;
  font-size: 11px;
  white-space: nowrap;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 32, 31, 0.94);
}

.lb-figure {
  max-width: min(880px, 92vw);
  margin: 0;
  text-align: center;
}

.lb-figure img {
  width: auto;
  height: auto;
  max-width: 92vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lb-figure figcaption {
  margin-top: 16px;
  color: #f3efe6;
  font-size: 15px;
}

.lb-btn {
  position: absolute;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lb-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lb-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lb-close {
  top: 24px;
  right: 24px;
}

.lb-prev {
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
}

.lb-next {
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
}

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 110px;
    gap: 36px;
  }

  .hero-photos {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    height: auto;
  }

  .hero-pic {
    position: static;
    width: 100%;
    transform: none;
  }

  .journey-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .top-nav {
    padding: 10px 14px;
  }

  .nav-links {
    gap: 10px;
    font-size: 13px;
  }

  .hero {
    padding: 104px 18px 56px;
  }

  .hero h1 {
    font-size: 64px;
  }

  .hero-sub {
    font-size: 18px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-photos {
    gap: 10px;
  }

  .hero-pic {
    padding: 6px 6px 26px;
  }

  .hero-pic figcaption {
    bottom: 7px;
    font-size: 10px;
  }

  .section {
    padding: 72px 18px;
  }

  .section-head h2,
  .letter-paper h2 {
    font-size: 36px;
  }

  .timeline::before {
    left: 16px;
  }

  .timeline-item {
    grid-template-columns: 34px 1fr;
    gap: 8px;
  }

  .timeline-item .tl-card,
  .timeline-item:nth-child(even) .tl-card {
    grid-column: 2;
  }

  .tl-photos {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  }

  .pw-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .letter-paper {
    padding: 40px 24px;
  }

  .letter-paper::before {
    left: 24px;
    right: 24px;
  }

  .lb-btn {
    width: 40px;
    height: 40px;
  }

  .lb-prev {
    left: 10px;
  }

  .lb-next {
    right: 10px;
  }
}

@media (max-width: 480px) {
  .nav-links {
    gap: 8px;
    font-size: 12px;
  }

  .music-player {
    left: 12px;
    right: 12px;
    border-radius: 16px;
    transform: none;
  }

  .music-time {
    display: none;
  }

  .hero h1 {
    font-size: 56px;
  }

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

  .tl-card {
    padding: 16px;
  }
}
