:root {
  --ink: #21141a;
  --ink-soft: #35212a;
  --plum: #592337;
  --wine: #8d344d;
  --rose: #d87a8f;
  --rose-soft: #eab8c0;
  --blush: #f5dcd7;
  --paper: #fbf0ea;
  --paper-deep: #f2dfd8;
  --pearl: #fff9f4;
  --gold: #e7bd87;
  --blue: #8b91b8;
  --shadow: rgba(40, 17, 26, 0.28);
  --serif: "STKaiti", "KaiTi", "FangSong", "SimSun", serif;
  --sans: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --page-progress: 0%;
  --thread-progress: 0%;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.page-grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.floating-hearts {
  position: fixed;
  inset: 0;
  z-index: 45;
  overflow: hidden;
  pointer-events: none;
}

.floating-ribbons {
  position: fixed;
  inset: 0;
  z-index: 44;
  overflow: hidden;
  pointer-events: none;
}

.floating-heart {
  position: absolute;
  bottom: -6vh;
  width: var(--heart-size, 12px);
  height: var(--heart-size, 12px);
  opacity: 0;
  animation: heart-drift var(--heart-duration, 18s) linear var(--heart-delay, 0s) infinite;
}

.floating-ribbon {
  position: absolute;
  top: -10vh;
  width: var(--ribbon-width, 7px);
  height: var(--ribbon-height, 20px);
  opacity: 0;
  border-radius: 1px;
  background: var(--ribbon-color, var(--rose));
  box-shadow: 0 0 14px color-mix(in srgb, var(--ribbon-color, var(--rose)) 35%, transparent);
  animation: ribbon-fall var(--ribbon-duration, 14s) linear var(--ribbon-delay, 0s) infinite;
}

.heart-burst {
  position: absolute;
  width: var(--burst-size, 10px);
  height: var(--burst-size, 10px);
  pointer-events: none;
  rotate: -45deg;
  background: var(--rose);
  animation: heart-burst 900ms var(--burst-delay, 0ms) cubic-bezier(0.12, 0.7, 0.2, 1) forwards;
}

.heart-burst::before,
.heart-burst::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.heart-burst::before {
  top: -50%;
  left: 0;
}

.heart-burst::after {
  top: 0;
  left: 50%;
}

.floating-heart::before,
.floating-heart::after {
  content: "";
  position: absolute;
  width: 50%;
  height: 80%;
  left: 50%;
  top: 0;
  border-radius: 999px 999px 0 0;
  background: var(--heart-color, var(--rose));
  transform: translateX(-50%) rotate(-45deg);
  transform-origin: 0 100%;
}

.floating-heart::after {
  left: 0;
  transform: translateX(0) rotate(45deg);
  transform-origin: 100% 100%;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem clamp(1rem, 4vw, 3.25rem);
  color: var(--pearl);
  transition:
    background-color 350ms ease,
    padding 350ms ease,
    box-shadow 350ms ease;
}

body.is-scrolled .site-header {
  padding-block: 0.72rem;
  background: rgba(33, 20, 26, 0.87);
  box-shadow: 0 1px 0 rgba(255, 249, 244, 0.1);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border: 1px solid rgba(255, 249, 244, 0.5);
  border-radius: 50%;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: 0.14em;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.88fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 6rem);
  min-height: 94svh;
  padding: clamp(7rem, 12vh, 9rem) clamp(1.25rem, 7vw, 7rem) clamp(3rem, 7vh, 5rem);
  overflow: hidden;
  color: var(--pearl);
  background:
    linear-gradient(112deg, rgba(33, 20, 26, 0.38), transparent 42%),
    repeating-linear-gradient(
      116deg,
      transparent 0,
      transparent 58px,
      rgba(255, 249, 244, 0.025) 59px,
      transparent 60px
    ),
    linear-gradient(135deg, #21141a 0%, #3c1d2b 52%, #6b3040 100%);
}

.hero::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 8rem;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(33, 20, 26, 0.48));
}

.hero::after {
  content: "WJ";
  position: absolute;
  right: -0.04em;
  bottom: -0.24em;
  color: rgba(255, 249, 244, 0.035);
  font-family: Georgia, serif;
  font-size: clamp(15rem, 34vw, 31rem);
  line-height: 0.75;
  letter-spacing: -0.08em;
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 4;
  max-width: 48rem;
  animation: hero-copy-in 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero-origin {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 1.6rem;
  color: var(--rose-soft);
  font-family: var(--serif);
  font-size: clamp(0.95rem, 1.3vw, 1.14rem);
  letter-spacing: 0.2em;
}

.origin-heart {
  position: relative;
  width: 0.72rem;
  height: 0.72rem;
  rotate: -45deg;
  background: var(--rose);
  box-shadow: 0 0 24px rgba(216, 122, 143, 0.7);
}

.origin-heart::before,
.origin-heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.origin-heart::before {
  top: -50%;
  left: 0;
}

.origin-heart::after {
  top: 0;
  left: 50%;
}

.hero h1 {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.03em 0.12em;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.4rem, 5.5vw, 5.4rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hero h1 span {
  display: inline-block;
}

.hero h1 span:last-child {
  color: var(--rose-soft);
}

.hero h1 em {
  color: var(--gold);
  font-size: 0.28em;
  font-style: normal;
  letter-spacing: 0;
  transform: translateY(-0.15em);
}

.hero-subtitle {
  max-width: 33rem;
  margin: clamp(1.5rem, 4vh, 2.6rem) 0 0;
  color: rgba(255, 249, 244, 0.8);
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.7;
  letter-spacing: 0.08em;
}

.scroll-link {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: clamp(2rem, 5vh, 3.5rem);
  color: var(--gold);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.scroll-link svg {
  width: 1.1rem;
  height: 1.1rem;
  animation: nudge-down 2.2s ease-in-out infinite;
}

.hero-gallery {
  position: relative;
  z-index: 3;
  width: min(100%, 39rem);
  aspect-ratio: 1 / 1.02;
  justify-self: end;
  animation: hero-gallery-in 1.65s 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero-photo {
  position: absolute;
  margin: 0;
  padding: 0.6rem;
  background: var(--pearl);
  box-shadow: 0 1.3rem 4rem var(--shadow);
}

.hero-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(0.98);
}

.hero-photo-back {
  top: 1.5%;
  right: 0;
  width: 45%;
  height: 50%;
  rotate: 7deg;
}

.hero-photo-side {
  bottom: 3%;
  left: 0;
  width: 51%;
  height: 39%;
  rotate: -6deg;
}

.hero-photo-main {
  top: 15%;
  left: 23%;
  width: 54%;
  height: 69%;
  rotate: -1.6deg;
  animation: photo-breathe 7s ease-in-out infinite;
}

.hero-photo-main figcaption {
  position: absolute;
  right: 0.7rem;
  bottom: 0.65rem;
  left: 0.7rem;
  color: var(--wine);
  font-family: var(--serif);
  font-size: clamp(0.75rem, 1vw, 0.9rem);
  line-height: 1.4;
  text-align: center;
}

.photo-tape {
  position: absolute;
  top: -0.6rem;
  left: 50%;
  width: 4.6rem;
  height: 1.35rem;
  translate: -50% 0;
  rotate: -2deg;
  background: rgba(237, 192, 143, 0.65);
  box-shadow: 0 2px 5px rgba(45, 23, 30, 0.1);
  backdrop-filter: blur(1px);
}

.hero-scribble {
  position: absolute;
  right: 3%;
  bottom: 0;
  z-index: 5;
  width: 28%;
  color: var(--gold);
  opacity: 0.72;
  transform: rotate(-8deg);
}

.hero-scribble svg {
  display: block;
  width: 100%;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.prologue {
  position: relative;
  display: grid;
  min-height: 72svh;
  place-items: center;
  padding: clamp(5rem, 10vw, 9rem) clamp(1.25rem, 7vw, 7rem);
  overflow: hidden;
  color: var(--plum);
  background:
    linear-gradient(90deg, transparent 0 88%, rgba(141, 52, 77, 0.045) 88% 88.18%, transparent 88.18%),
    var(--paper);
}

.prologue::before {
  content: "";
  position: absolute;
  top: 0;
  left: clamp(1.25rem, 7vw, 7rem);
  right: clamp(1.25rem, 7vw, 7rem);
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(89, 35, 55, 0.35), transparent);
}

.prologue-inner {
  width: min(100%, 68rem);
  text-align: center;
}

.prologue-year {
  margin: 0 0 1.5rem;
  color: #74253d;
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.5vw, 1.28rem);
  font-weight: 600;
  letter-spacing: 0.2em;
}

.prologue h2 {
  max-width: 56rem;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(2.35rem, 5.2vw, 5rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.memory-counts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 4.5rem);
  margin-top: clamp(3.5rem, 9vh, 6rem);
}

.memory-count {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.memory-count strong {
  color: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 6vw, 5.7rem);
  font-weight: 400;
  line-height: 1;
}

.memory-count span {
  color: rgba(89, 35, 55, 0.9);
  font-family: var(--serif);
  font-size: clamp(0.98rem, 1.4vw, 1.18rem);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.count-divider {
  width: 1px;
  height: 3.4rem;
  background: rgba(89, 35, 55, 0.18);
}

.prologue-heart {
  position: absolute;
  right: clamp(1rem, 8vw, 8rem);
  bottom: clamp(1.5rem, 6vw, 5rem);
  color: var(--rose);
  opacity: 0.52;
  rotate: -8deg;
}

.prologue-heart svg {
  width: clamp(3rem, 6vw, 6.4rem);
  height: auto;
  stroke-width: 0.8;
}

.story {
  position: relative;
  padding: clamp(6rem, 11vw, 10rem) 0 clamp(8rem, 14vw, 13rem);
  overflow: clip;
  color: var(--plum);
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 47px,
      rgba(89, 35, 55, 0.028) 48px,
      transparent 49px
    ),
    linear-gradient(115deg, var(--paper) 0%, #f8e8e2 47%, #f2ddd8 100%);
}

.story-header {
  position: relative;
  z-index: 3;
  width: min(100% - 2.5rem, 67rem);
  margin: 0 auto clamp(6rem, 12vw, 10rem);
  text-align: center;
}

.story-intro {
  margin: 0 0 1.1rem;
  color: #74253d;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.5vw, 1.32rem);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.story-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5.6vw, 5.5rem);
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: 0.01em;
}

.memory-thread {
  position: absolute;
  z-index: 1;
  top: clamp(21rem, 28vw, 30rem);
  bottom: clamp(6rem, 9vw, 9rem);
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
}

.thread-base,
.thread-progress {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
}

.thread-base {
  height: 100%;
  background: rgba(141, 52, 77, 0.13);
}

.thread-progress {
  height: var(--thread-progress);
  max-height: 100%;
  background: linear-gradient(to bottom, var(--rose), var(--wine));
  box-shadow: 0 0 20px rgba(141, 52, 77, 0.2);
  transition: height 100ms linear;
}

.thread-tip {
  position: absolute;
  top: var(--thread-progress);
  left: 50%;
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid rgba(141, 52, 77, 0.25);
  border-radius: 50%;
  color: var(--wine);
  background: var(--paper);
  translate: -50% -50%;
  transition: top 100ms linear;
}

.thread-tip svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: currentColor;
  stroke-width: 1.5;
}

.chapter-list {
  position: relative;
  z-index: 2;
  width: min(100% - 2.5rem, 78rem);
  margin: 0 auto;
}

.chapter {
  --accent: var(--rose);
  --accent-deep: var(--wine);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: clamp(3rem, 7vw, 8rem);
  align-items: center;
  min-height: 34rem;
  margin-bottom: clamp(8rem, 15vw, 13rem);
  scroll-margin-top: 4.5rem;
}

.chapter:last-child {
  margin-bottom: 0;
}

.chapter[data-phase="dawn"] {
  --accent: #bf7184;
  --accent-deep: #7f354c;
}

.chapter[data-phase="bloom"] {
  --accent: #c96d7f;
  --accent-deep: #8b3149;
}

.chapter[data-phase="promise"] {
  --accent: #b94e68;
  --accent-deep: #74253d;
}

.chapter::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.56rem;
  height: 0.56rem;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(141, 52, 77, 0.09);
  transform: translate(-50%, -50%);
}

.chapter-node {
  position: absolute;
  top: calc(50% - 3.25rem);
  left: 50%;
  z-index: 3;
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  place-items: center;
  border: 1px solid rgba(141, 52, 77, 0.22);
  border-radius: 50%;
  color: var(--accent-deep);
  background: rgba(251, 240, 234, 0.9);
  box-shadow: 0 0 0 8px rgba(251, 240, 234, 0.65);
  font-family: Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  transform: translateX(-50%);
  backdrop-filter: blur(7px);
}

.chapter:nth-child(even) .chapter-media {
  order: 2;
}

.chapter:nth-child(even) .chapter-copy {
  order: 1;
}

.chapter-media {
  position: relative;
  width: min(100%, var(--media-width, 33rem));
  min-width: 0;
  justify-self: center;
}

.photo-main {
  position: relative;
  margin: 0;
  padding: 0.78rem 0.78rem 4.2rem;
  border: 1px solid rgba(89, 35, 55, 0.06);
  background: var(--pearl);
  box-shadow:
    0 1.6rem 4rem rgba(67, 31, 43, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.65) inset;
  rotate: var(--tilt, -1.2deg);
  transition:
    rotate 500ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 500ms ease;
}

.chapter:hover .photo-main {
  rotate: 0deg;
  box-shadow:
    0 2rem 5rem rgba(67, 31, 43, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset;
}

.photo-main::before {
  content: "";
  position: absolute;
  top: -0.62rem;
  left: 50%;
  width: 5.2rem;
  height: 1.3rem;
  background: rgba(231, 189, 135, 0.58);
  box-shadow: 0 3px 9px rgba(67, 31, 43, 0.08);
  rotate: var(--tape-tilt, 1deg);
  translate: -50% 0;
}

.photo-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: var(--pearl);
  background: var(--ink-soft);
  cursor: zoom-in;
}

.photo-open img {
  display: block;
  width: 100%;
  aspect-ratio: var(--ratio, 4 / 3);
  object-fit: cover;
  filter: saturate(0.92) contrast(0.98);
  scale: 1;
  transition:
    scale 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 220ms ease;
}

.chapter:hover .photo-open img {
  scale: 1.012;
  filter: saturate(1) contrast(1);
}

.photo-open::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(33, 20, 26, 0.18), transparent 35%);
  opacity: 0;
  transition: opacity 350ms ease;
}

.chapter:hover .photo-open::after {
  opacity: 1;
}

.photo-zoom {
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
  z-index: 2;
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 1px solid rgba(255, 249, 244, 0.45);
  border-radius: 50%;
  color: var(--pearl);
  background: rgba(33, 20, 26, 0.54);
  opacity: 0;
  transform: translateY(5px);
  transition:
    opacity 300ms ease,
    transform 300ms ease;
  backdrop-filter: blur(6px);
}

.photo-zoom svg {
  width: 1rem;
  height: 1rem;
}

.chapter:hover .photo-zoom,
.photo-open:focus-visible .photo-zoom {
  opacity: 1;
  transform: translateY(0);
}

.photo-main figcaption {
  position: absolute;
  right: 1rem;
  bottom: 1.1rem;
  left: 1rem;
  color: #6d2038;
  font-family: var(--serif);
  font-size: clamp(0.98rem, 1.2vw, 1.08rem);
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
}

.photo-caption {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chapter-snaps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.7rem, 1.5vw, 1.05rem);
  margin-top: 1.35rem;
  padding-left: 0.8rem;
}

.snap-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 0.92;
  padding: 0.45rem;
  border: 0;
  background: var(--pearl);
  box-shadow: 0 0.7rem 1.8rem rgba(67, 31, 43, 0.15);
  cursor: zoom-in;
  transition:
    translate 220ms ease,
    rotate 220ms ease,
    box-shadow 220ms ease;
}

.snap-button:nth-child(3n + 1) {
  rotate: -3deg;
}

.snap-button:nth-child(3n + 2) {
  rotate: 2deg;
}

.snap-button:hover {
  z-index: 2;
  translate: 0 -0.55rem;
  rotate: 0deg;
  box-shadow: 0 1.1rem 2.2rem rgba(67, 31, 43, 0.22);
}

.snap-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
  transition: scale 220ms ease;
}

.snap-button:hover img {
  scale: 1.018;
}

.snap-more {
  display: grid;
  width: 100%;
  aspect-ratio: 0.92;
  place-items: center;
  border: 1px dashed rgba(141, 52, 77, 0.35);
  color: var(--wine);
  background: rgba(255, 249, 244, 0.4);
  font-family: Georgia, serif;
  font-size: 1rem;
}

.chapter-copy {
  min-width: 0;
  padding: clamp(0.5rem, 2vw, 1.8rem) 0;
}

.chapter-kicker {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1rem;
  color: #6f1f39;
  font-family: var(--serif);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  font-weight: 600;
  letter-spacing: 0.16em;
}

.chapter-kicker::before {
  content: "";
  width: 2.3rem;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.chapter h2 {
  margin: 0;
  color: var(--accent-deep);
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4.3vw, 4.5rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: 0.02em;
}

.chapter-note {
  max-width: 31rem;
  margin: 1.25rem 0 0;
  color: rgba(89, 35, 55, 0.78);
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.5vw, 1.32rem);
  line-height: 1.8;
  letter-spacing: 0.03em;
}

.chapter-captions {
  display: grid;
  gap: 0.8rem;
  margin-top: 2rem;
}

.memory-caption {
  position: relative;
  margin: 0;
  padding-left: 1.15rem;
  color: rgba(67, 31, 43, 0.86);
  font-size: clamp(1rem, 1.08vw, 1.1rem);
  line-height: 1.9;
}

.memory-caption::before {
  content: "♥";
  position: absolute;
  top: 0.08em;
  left: 0;
  color: #ad2448;
  font-family: serif;
  font-size: 1.05em;
  line-height: 1;
}

.photo-main,
.snap-button,
.chapter-copy {
  opacity: 1;
}

.js-reveal .photo-main {
  clip-path: inset(0 0 100% 0);
  filter: saturate(0.35);
  opacity: 0.35;
  scale: 1.045;
  transition:
    clip-path 520ms cubic-bezier(0.16, 0.84, 0.2, 1),
    filter 420ms ease,
    opacity 260ms ease,
    scale 520ms cubic-bezier(0.16, 0.84, 0.2, 1),
    rotate 500ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 500ms ease;
}

.js-reveal .chapter-copy,
.js-reveal .chapter-snaps {
  opacity: 0;
  transform: translateY(1.5rem);
  transition:
    opacity 700ms 180ms ease,
    transform 700ms 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.js-reveal .chapter.is-visible .photo-main {
  clip-path: inset(0);
  filter: saturate(0.92);
  opacity: 1;
  scale: 1;
}

.js-reveal .chapter.is-visible .chapter-copy,
.js-reveal .chapter.is-visible .chapter-snaps {
  opacity: 1;
  transform: translateY(0);
}

.ending {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  gap: clamp(4rem, 9vw, 9rem);
  align-items: center;
  min-height: 100svh;
  padding: clamp(7rem, 13vw, 12rem) clamp(1.25rem, 8vw, 9rem);
  overflow: hidden;
  color: var(--pearl);
  background:
    linear-gradient(125deg, rgba(255, 249, 244, 0.025), transparent 45%),
    repeating-linear-gradient(
      70deg,
      transparent 0,
      transparent 70px,
      rgba(255, 249, 244, 0.02) 71px,
      transparent 72px
    ),
    var(--ink);
}

.ending::before {
  content: "余生";
  position: absolute;
  right: -0.08em;
  bottom: -0.2em;
  color: rgba(255, 249, 244, 0.035);
  font-family: var(--serif);
  font-size: clamp(10rem, 30vw, 28rem);
  line-height: 0.8;
  pointer-events: none;
}

.ending-collage {
  position: relative;
  z-index: 2;
  width: min(100%, 38rem);
  aspect-ratio: 0.96;
  justify-self: end;
}

.ending-collage img {
  position: absolute;
  display: block;
  padding: 0.62rem 0.62rem 2.8rem;
  object-fit: cover;
  background: var(--pearl);
  box-shadow: 0 1.8rem 4.5rem rgba(0, 0, 0, 0.35);
}

.ending-collage img:first-child {
  top: 5%;
  left: 5%;
  width: 54%;
  height: 72%;
  rotate: -4deg;
}

.ending-collage img:last-child {
  right: 0;
  bottom: 2%;
  width: 55%;
  height: 55%;
  rotate: 5deg;
}

.ending-copy {
  position: relative;
  z-index: 3;
  max-width: 41rem;
}

.ending h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 6.2vw, 6.4rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.02em;
}

.ending-copy > p {
  max-width: 34rem;
  margin: 2rem 0 0;
  color: rgba(255, 249, 244, 0.7);
  font-family: var(--serif);
  font-size: clamp(1.04rem, 1.5vw, 1.28rem);
  line-height: 2;
  letter-spacing: 0.03em;
}

.ending-signature {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2.5rem;
  color: var(--rose-soft);
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: 0.18em;
}

.ending-signature svg {
  width: 1rem;
  height: 1rem;
  fill: var(--rose);
  stroke: var(--rose);
}

.replay-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 3.2rem;
  color: var(--gold);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.replay-link svg {
  width: 1rem;
  height: 1rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem clamp(1.25rem, 4vw, 3rem);
  color: rgba(255, 249, 244, 0.7);
  background: var(--ink);
  font-family: var(--serif);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
}

.story-toolbar {
  position: fixed;
  right: clamp(1rem, 3vw, 2.25rem);
  bottom: clamp(1rem, 3vw, 2.25rem);
  z-index: 70;
  display: flex;
  gap: 0.5rem;
  padding: 0.38rem;
  border: 1px solid rgba(255, 249, 244, 0.16);
  border-radius: 8px;
  background: rgba(33, 20, 26, 0.86);
  box-shadow: 0 0.75rem 2.7rem rgba(20, 9, 13, 0.3);
  backdrop-filter: blur(14px);
}

.control-button {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.72rem;
  border: 0;
  border-radius: 5px;
  color: rgba(255, 249, 244, 0.74);
  background: transparent;
  cursor: pointer;
  transition:
    color 250ms ease,
    background-color 250ms ease;
}

.control-button:hover {
  color: var(--pearl);
  background: rgba(255, 249, 244, 0.08);
}

.control-button[aria-pressed="true"] {
  color: var(--gold);
}

.control-button svg {
  width: 1rem;
  height: 1rem;
}

.control-button span {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.chapter-rail {
  position: fixed;
  top: 50%;
  right: clamp(0.9rem, 2.2vw, 1.8rem);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  color: var(--wine);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(10px);
  transition:
    opacity 350ms ease,
    transform 350ms ease;
}

body.story-in-view .chapter-rail {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.rail-index,
.rail-total {
  font-family: Georgia, serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.rail-index {
  color: var(--wine);
  font-size: 0.9rem;
}

.rail-dots {
  display: grid;
  gap: 0.45rem;
}

.rail-dot {
  width: 0.44rem;
  height: 0.44rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(141, 52, 77, 0.23);
  cursor: pointer;
  transition:
    background-color 250ms ease,
    scale 250ms ease;
}

.rail-dot:hover {
  background: rgba(141, 52, 77, 0.55);
  scale: 1.3;
}

.rail-dot.is-active {
  background: var(--wine);
  scale: 1.55;
}

.back-to-top {
  position: fixed;
  bottom: clamp(1rem, 3vw, 2.25rem);
  left: clamp(1rem, 3vw, 2.25rem);
  z-index: 69;
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  border: 1px solid rgba(255, 249, 244, 0.16);
  border-radius: 8px;
  color: var(--pearl);
  background: rgba(33, 20, 26, 0.82);
  box-shadow: 0 0.75rem 2.7rem rgba(20, 9, 13, 0.26);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 250ms ease,
    transform 250ms ease;
  backdrop-filter: blur(12px);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top svg {
  width: 1.08rem;
  height: 1.08rem;
}

.lightbox {
  width: min(94vw, 76rem);
  max-width: none;
  max-height: 94svh;
  padding: 3rem clamp(3.7rem, 6vw, 5.5rem) 2rem;
  border: 1px solid rgba(255, 249, 244, 0.16);
  border-radius: 8px;
  color: var(--pearl);
  background: rgba(28, 15, 21, 0.97);
  box-shadow: 0 2rem 7rem rgba(0, 0, 0, 0.55);
}

.lightbox::backdrop {
  background: rgba(18, 9, 13, 0.88);
  backdrop-filter: blur(10px);
}

.lightbox[open] {
  animation: lightbox-in 220ms cubic-bezier(0.16, 0.84, 0.2, 1) both;
}

.lightbox-topbar {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lightbox-topbar > span {
  color: rgba(255, 249, 244, 0.76);
  font-family: var(--serif);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.lightbox-topbar form {
  margin: 0;
}

.icon-button,
.lightbox-nav {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 249, 244, 0.16);
  border-radius: 50%;
  color: var(--pearl);
  background: rgba(255, 249, 244, 0.05);
  cursor: pointer;
  transition:
    background-color 250ms ease,
    border-color 250ms ease;
}

.lightbox-nav[hidden] {
  display: none;
}

.icon-button:hover,
.lightbox-nav:hover {
  border-color: rgba(255, 249, 244, 0.35);
  background: rgba(255, 249, 244, 0.11);
}

.icon-button {
  width: 2.35rem;
  height: 2.35rem;
}

.icon-button svg,
.lightbox-nav svg {
  width: 1.1rem;
  height: 1.1rem;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 2.8rem;
  height: 2.8rem;
  transform: translateY(-50%);
}

.lightbox-prev {
  left: 0.75rem;
}

.lightbox-next {
  right: 0.75rem;
}

.lightbox-figure {
  display: flex;
  max-height: calc(94svh - 6rem);
  margin: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: calc(94svh - 11rem);
  object-fit: contain;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.3);
}

.lightbox-figure figcaption {
  width: min(100%, 48rem);
  margin: 1.25rem auto 0;
  color: rgba(255, 249, 244, 0.75);
  font-family: var(--serif);
  font-size: clamp(0.92rem, 1.3vw, 1.08rem);
  line-height: 1.8;
  text-align: center;
}

.lightbox-counter {
  position: absolute;
  bottom: 0.8rem;
  left: 50%;
  margin: 0;
  color: rgba(255, 249, 244, 0.72);
  font-family: Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
}

.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;
}

noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: var(--pearl);
  background: var(--ink);
  font-family: var(--serif);
  font-size: 1.2rem;
  text-align: center;
}

@keyframes hero-copy-in {
  from {
    opacity: 0;
    transform: translateY(2.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-gallery-in {
  from {
    opacity: 0;
    transform: translateY(2rem) rotate(2deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes photo-breathe {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -0.45rem;
  }
}

@keyframes nudge-down {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(0.35rem);
  }
}

@keyframes heart-drift {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  12% {
    opacity: var(--heart-opacity, 0.24);
  }
  80% {
    opacity: var(--heart-opacity, 0.24);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--heart-drift-x, 3rem), -112vh, 0) rotate(26deg);
  }
}

@keyframes ribbon-fall {
  0% {
    opacity: 0;
    translate: 0 0;
    rotate: 0deg;
  }
  10% {
    opacity: 0.62;
  }
  78% {
    opacity: 0.54;
  }
  100% {
    opacity: 0;
    translate: var(--ribbon-drift, 4rem) 118vh;
    rotate: var(--ribbon-spin, 480deg);
  }
}

@keyframes heart-burst {
  0% {
    opacity: 0;
    translate: 0 0;
    scale: 0.4;
  }
  18% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    translate: var(--burst-x, 0) var(--burst-y, -8rem);
    scale: 1.15;
    rotate: calc(-45deg + var(--burst-rotate, 40deg));
  }
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: scale(0.985) translateY(0.4rem);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 1020px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(310px, 0.8fr);
    gap: 1.5rem;
  }

  .chapter-list {
    width: min(100% - 2rem, 46rem);
  }

  .memory-thread {
    left: 2.2rem;
  }

  .chapter {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    min-height: 0;
    padding-left: 5.1rem;
    margin-bottom: 9rem;
  }

  .chapter::after {
    top: 7rem;
    left: 0;
  }

  .chapter-node {
    top: 5.2rem;
    left: 0;
  }

  .chapter:nth-child(even) .chapter-media,
  .chapter:nth-child(even) .chapter-copy {
    order: initial;
  }

  .chapter-copy {
    padding: 0;
  }

  .ending {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
    gap: 3.5rem;
  }
}

@media (max-width: 760px) {
  .site-header {
    padding: 0.9rem 1rem;
  }

  body.is-scrolled .site-header {
    padding-block: 0.55rem;
  }

  .brand-name {
    font-size: 0.98rem;
  }

  .brand-mark {
    width: 1.9rem;
    height: 1.9rem;
  }

  .hero {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 2rem;
    min-height: 100svh;
    padding: 6.6rem 1.2rem 2.6rem;
  }

  .hero-copy {
    text-align: center;
  }

  .hero-origin {
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 0.98rem;
  }

  .hero h1 {
    display: grid;
    justify-items: center;
    justify-content: center;
    gap: 0;
    font-size: clamp(3.15rem, 13.5vw, 4.4rem);
    line-height: 0.94;
    white-space: normal;
  }

  .hero h1 em {
    font-size: 0.22em;
    line-height: 1;
    margin: 0.1em 0;
    transform: none;
  }

  .hero-subtitle {
    margin-inline: auto;
    font-size: 1.08rem;
  }

  .scroll-link {
    margin-top: 1.5rem;
    font-size: 0.9rem;
  }

  .hero-gallery {
    width: min(100%, 25rem);
    height: min(43svh, 23rem);
    aspect-ratio: auto;
    justify-self: center;
  }

  .hero-photo-main {
    top: 8%;
    left: 24%;
    width: 52%;
    height: 78%;
  }

  .hero-photo-back {
    top: 1%;
    width: 44%;
    height: 52%;
  }

  .hero-photo-side {
    bottom: 0;
    width: 49%;
    height: 43%;
  }

  .hero-photo-main figcaption {
    display: none;
  }

  .hero-scribble {
    right: 5%;
    bottom: 1%;
    width: 29%;
  }

  .prologue {
    min-height: 66svh;
    padding: 4.8rem 1.2rem;
  }

  .prologue h2 {
    font-size: clamp(2rem, 9.2vw, 3.05rem);
    line-height: 1.43;
  }

  .memory-counts {
    gap: 1.1rem;
    margin-top: 3rem;
  }

  .memory-count {
    display: grid;
    gap: 0.2rem;
    text-align: center;
  }

  .memory-count strong {
    font-size: 2.7rem;
  }

  .memory-count span {
    font-size: 0.98rem;
  }

  .count-divider {
    height: 2.7rem;
  }

  .prologue-heart {
    right: 1rem;
    bottom: 1rem;
    opacity: 0.25;
  }

  .story {
    padding-top: 5.5rem;
  }

  .story-header {
    width: calc(100% - 2rem);
    margin-bottom: 5.5rem;
    text-align: left;
  }

  .story-header h2 {
    font-size: clamp(2.25rem, 10vw, 3.6rem);
  }

  .memory-thread {
    top: 18rem;
    bottom: 3rem;
    left: 1.45rem;
  }

  .thread-tip {
    width: 1.65rem;
    height: 1.65rem;
  }

  .chapter-list {
    width: calc(100% - 1.5rem);
  }

  .chapter {
    gap: 2rem;
    padding-left: 3.1rem;
    margin-bottom: 7.2rem;
  }

  .chapter::after {
    top: 5rem;
    left: -0.75rem;
  }

  .chapter-node {
    top: 3.25rem;
    left: -0.75rem;
    width: 2.9rem;
    height: 2.9rem;
    font-size: 0.72rem;
  }

  .photo-main {
    padding: 0.55rem 0.55rem 3.5rem;
    rotate: var(--tilt-mobile, -0.8deg);
  }

  .photo-main figcaption {
    right: 0.6rem;
    bottom: 0.85rem;
    left: 0.6rem;
    font-size: 1rem;
  }

  .chapter-snaps {
    gap: 0.7rem;
    padding-left: 0;
  }

  .chapter h2 {
    font-size: clamp(2.35rem, 11vw, 3.7rem);
  }

  .chapter-note {
    font-size: 1.03rem;
    line-height: 1.75;
  }

  .memory-caption {
    font-size: 1rem;
  }

  .ending {
    grid-template-columns: 1fr;
    gap: 4rem;
    min-height: 0;
    padding: 6.5rem 1.2rem 7rem;
  }

  .ending-collage {
    width: min(100%, 26rem);
    justify-self: center;
  }

  .ending-copy {
    text-align: center;
  }

  .ending h2 {
    font-size: clamp(2.75rem, 12vw, 4.5rem);
  }

  .ending-copy > p {
    margin-inline: auto;
    font-size: 1rem;
  }

  .ending-signature {
    justify-content: center;
  }

  .site-footer {
    padding-bottom: 5.3rem;
    font-size: 0.9rem;
  }

  .story-toolbar {
    right: 0.8rem;
    bottom: 0.8rem;
  }

  .back-to-top {
    bottom: 0.8rem;
    left: 0.8rem;
  }

  .chapter-rail {
    display: none;
  }

  .lightbox {
    width: 100vw;
    height: 100svh;
    max-height: none;
    padding: 3.5rem 1rem 2.5rem;
    border: 0;
    border-radius: 0;
  }

  .lightbox-figure {
    height: 100%;
    max-height: none;
  }

  .lightbox-figure img {
    max-height: calc(100svh - 13rem);
  }

  .lightbox-nav {
    top: auto;
    bottom: 1.2rem;
    width: 2.6rem;
    height: 2.6rem;
    transform: none;
  }

  .lightbox-prev {
    left: 1rem;
  }

  .lightbox-next {
    right: 1rem;
  }

  .lightbox-counter {
    bottom: 2.35rem;
  }
}

@media (max-width: 390px) {
  .control-button {
    padding-inline: 0.58rem;
  }

  .control-button span {
    font-size: 0.82rem;
  }

  .story-toolbar {
    gap: 0.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .floating-hearts,
  .floating-ribbons {
    display: none;
  }

  .js-reveal .photo-main,
  .js-reveal .chapter-copy,
  .js-reveal .chapter-snaps {
    clip-path: none;
    filter: none;
    opacity: 1;
    transform: none;
    scale: 1;
  }
}

/* Winding river timeline */
.story-body {
  position: relative;
  width: min(calc(100% - 2.5rem), 84rem);
  margin: 0 auto;
}

.story-body .chapter-list {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0;
}

.story-river {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.river-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.river-bed,
.river-flow,
.river-progress {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.river-bed {
  stroke: rgba(141, 52, 77, 0.13);
  stroke-width: 9;
}

.river-flow {
  stroke: rgba(216, 122, 143, 0.36);
  stroke-width: 1.5;
  stroke-dasharray: 10 18;
  animation: river-flow 3.1s linear infinite;
}

.river-progress {
  stroke: #b43f5e;
  stroke-width: 3.2;
  filter: drop-shadow(0 0 5px rgba(180, 63, 94, 0.28));
  transition: stroke-dashoffset 75ms linear;
}

.river-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  place-items: center;
  border: 1px solid rgba(141, 52, 77, 0.28);
  border-radius: 50%;
  color: #ad2448;
  background: rgba(251, 240, 234, 0.94);
  box-shadow: 0 0 0 7px rgba(251, 240, 234, 0.72);
  will-change: transform;
}

.river-tip svg {
  width: 0.78rem;
  height: 0.78rem;
  fill: currentColor;
  stroke-width: 1.5;
}

.story-body .chapter {
  display: block;
  min-height: 0;
  margin-bottom: clamp(4.5rem, 7vw, 7rem);
  padding: 0;
  scroll-margin-top: 4.5rem;
}

.story-body .chapter:last-child {
  margin-bottom: 0;
}

.story-body .chapter::after {
  display: none;
}

.chapter-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.15rem;
  width: min(36rem, 40%);
  align-items: start;
  margin-bottom: clamp(2.2rem, 4vw, 3.5rem);
}

.chapter:nth-child(odd) .chapter-header {
  margin-right: auto;
  margin-left: 1.5rem;
  text-align: left;
}

.chapter:nth-child(even) .chapter-header {
  margin-right: 1.5rem;
  margin-left: auto;
  text-align: right;
}

.chapter-number {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 1px solid rgba(141, 52, 77, 0.24);
  border-radius: 50%;
  color: var(--accent-deep);
  background: rgba(251, 240, 234, 0.88);
  box-shadow: 0 0 0 6px rgba(251, 240, 234, 0.66);
  font-family: Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

.chapter-heading {
  min-width: 0;
}

.chapter:nth-child(even) .chapter-number {
  order: 2;
}

.chapter-header .chapter-kicker {
  margin: 0 0 0.55rem;
  color: #76223c;
  font-size: clamp(0.95rem, 1.08vw, 1.05rem);
  letter-spacing: 0.14em;
}

.chapter:nth-child(even) .chapter-kicker {
  justify-content: flex-end;
}

.chapter-header h2 {
  margin: 0;
  color: #672039;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  font-weight: 400;
  line-height: 1.08;
}

.chapter-header .chapter-note {
  max-width: 30rem;
  margin: 0.9rem 0 0;
  color: rgba(89, 35, 55, 0.8);
  font-size: clamp(1.02rem, 1.28vw, 1.18rem);
  line-height: 1.75;
}

.chapter:nth-child(even) .chapter-note {
  margin-left: auto;
}

.memory-pairs {
  position: relative;
}

.memory-pair {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(6.5rem, 11vw, 11rem);
  align-items: center;
  margin-bottom: clamp(3rem, 5.2vw, 5.5rem);
}

.memory-pair:last-child {
  margin-bottom: 0;
}

.memory-photo {
  position: relative;
  width: min(100%, var(--photo-max-width, 34rem));
  margin: 0;
  padding: 0.68rem;
  background: var(--pearl);
  box-shadow:
    0 1.3rem 3.4rem rgba(67, 31, 43, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.65) inset;
  rotate: var(--tilt, -0.5deg);
  transition:
    rotate 240ms ease,
    box-shadow 240ms ease,
    scale 400ms cubic-bezier(0.16, 0.84, 0.2, 1),
    opacity 240ms ease;
}

.memory-photo::before {
  content: "";
  position: absolute;
  top: -0.56rem;
  left: 50%;
  width: 4.8rem;
  height: 1.15rem;
  background: rgba(231, 189, 135, 0.55);
  box-shadow: 0 3px 8px rgba(67, 31, 43, 0.08);
  rotate: 0.6deg;
  translate: -50% 0;
}

.memory-photo:hover {
  rotate: 0deg;
  box-shadow:
    0 1.7rem 4.2rem rgba(67, 31, 43, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset;
}

.memory-pair[data-side="left"] .memory-photo {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.memory-pair[data-side="right"] .memory-photo {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
}

.memory-photo .photo-open {
  width: 100%;
  overflow: hidden;
  background: var(--ink-soft);
}

.memory-photo .photo-open img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: var(--photo-ratio);
  object-fit: contain;
  scale: 1;
  filter: saturate(0.94) contrast(0.99);
  transition:
    scale 210ms ease,
    filter 210ms ease;
}

.chapter:hover .memory-photo .photo-open img {
  scale: 1;
  filter: saturate(0.94) contrast(0.99);
}

.chapter .memory-photo:hover .photo-open img {
  scale: 1.015;
  filter: saturate(1) contrast(1);
}

.chapter .memory-photo .photo-zoom {
  opacity: 0;
  transform: translateY(5px);
}

.chapter .memory-photo:hover .photo-zoom,
.chapter .memory-photo .photo-open:focus-visible .photo-zoom {
  opacity: 1;
  transform: translateY(0);
}

.chapter:hover .memory-photo .photo-open::after {
  opacity: 0;
}

.chapter .memory-photo:hover .photo-open::after {
  opacity: 1;
}

.memory-words {
  width: min(100%, 27rem);
  padding-block: 0.8rem;
}

.memory-pair[data-side="left"] .memory-words {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  text-align: left;
}

.memory-pair[data-side="right"] .memory-words {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  text-align: right;
}

.memory-heart {
  display: block;
  margin-bottom: 0.85rem;
  color: #ad2448;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  line-height: 1;
}

.memory-text {
  margin: 0;
  color: #4e2633;
  font-family: var(--serif);
  font-size: clamp(1.14rem, 1.45vw, 1.42rem);
  line-height: 1.95;
  letter-spacing: 0.025em;
  text-wrap: pretty;
}

.js-reveal .memory-photo {
  clip-path: inset(0 0 100% 0);
  opacity: 0.25;
  scale: 1.03;
}

.js-reveal .memory-words {
  opacity: 0;
  transform: translateY(1rem);
}

.js-reveal .chapter.is-visible .memory-photo {
  clip-path: inset(0);
  opacity: 1;
  scale: 1;
  transition:
    clip-path 480ms cubic-bezier(0.16, 0.84, 0.2, 1),
    opacity 260ms ease,
    scale 480ms cubic-bezier(0.16, 0.84, 0.2, 1),
    rotate 240ms ease,
    box-shadow 240ms ease;
}

.js-reveal .chapter.is-visible .memory-words {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 500ms 90ms ease,
    transform 500ms 90ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes river-flow {
  to {
    stroke-dashoffset: -56;
  }
}

@media (max-width: 900px) {
  .story-body {
    width: calc(100% - 1.5rem);
  }

  .story-body .chapter {
    margin-bottom: 5.25rem;
  }

  .chapter-header,
  .chapter:nth-child(odd) .chapter-header,
  .chapter:nth-child(even) .chapter-header {
    width: calc(100% - 3.6rem);
    margin-right: 0;
    margin-left: 3.6rem;
    text-align: left;
  }

  .chapter:nth-child(even) .chapter-number {
    order: 0;
  }

  .chapter:nth-child(even) .chapter-kicker {
    justify-content: flex-start;
  }

  .chapter:nth-child(even) .chapter-note {
    margin-left: 0;
  }

  .chapter-header h2 {
    font-size: clamp(2.15rem, 9vw, 3.45rem);
  }

  .memory-pair {
    grid-template-columns: 1fr;
    gap: 1.15rem;
    margin-bottom: 3.4rem;
    padding-left: 3.6rem;
  }

  .memory-pair[data-side="left"] .memory-photo,
  .memory-pair[data-side="right"] .memory-photo {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .memory-pair[data-side="left"] .memory-words,
  .memory-pair[data-side="right"] .memory-words {
    grid-column: 1;
    grid-row: 2;
    width: min(100%, 30rem);
    padding: 0;
    justify-self: start;
    text-align: left;
  }

  .memory-heart {
    margin-bottom: 0.65rem;
  }

  .memory-text {
    font-size: clamp(1.04rem, 4.2vw, 1.22rem);
    line-height: 1.85;
  }

  .river-tip {
    width: 1.55rem;
    height: 1.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js-reveal .memory-photo,
  .js-reveal .memory-words {
    clip-path: none;
    opacity: 1;
    scale: 1;
    transform: none;
  }
}

/* Small decorations and celebration effects */
.river-dog {
  position: absolute;
  z-index: 4;
  width: 54px;
  height: 54px;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(89, 35, 55, 0.14));
  transform: translate(-50%, -50%);
  animation: dog-bob 3.8s var(--dog-delay, 0s) ease-in-out infinite;
}

.river-dog svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dog-tail {
  transform-box: fill-box;
  transform-origin: 8% 88%;
  animation: dog-tail-wag 0.62s ease-in-out infinite alternate;
}

.praise-word {
  position: relative;
  display: inline-block;
  color: #a51f47;
  font-weight: 600;
  animation: praise-word-glow 2.6s ease-in-out infinite;
}

.praise-word::before,
.praise-word::after {
  content: "♥";
  position: absolute;
  z-index: 1;
  color: #d87a8f;
  font-family: Georgia, serif;
  font-size: 0.62em;
  font-weight: 400;
  line-height: 1;
  pointer-events: none;
  text-shadow:
    1.3em -0.3em 0 #e7bd87,
    -1em 0.55em 0 #eab8c0,
    1.8em 0.9em 0 #8b91b8;
  animation: praise-heart-hop 2.1s ease-in-out infinite;
}

.praise-word::before {
  top: -0.75em;
  left: -0.25em;
}

.praise-word::after {
  right: -0.15em;
  bottom: -0.8em;
  animation-delay: -1s;
}

.effect-layer {
  position: fixed;
  inset: 0;
  z-index: 48;
  overflow: hidden;
  pointer-events: none;
}

.rising-heart {
  position: absolute;
  bottom: -12vh;
  font-family: Georgia, serif;
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 4px 8px rgba(141, 52, 77, 0.2));
  animation: rising-heart var(--rise-duration, 4s) var(--rise-delay, 0s) cubic-bezier(0.16, 0.7, 0.24, 1) forwards;
}

.meteor {
  position: absolute;
  width: var(--meteor-length, 220px);
  height: 2px;
  opacity: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--meteor-color, #e7bd87), #fff8eb);
  filter: drop-shadow(0 0 6px var(--meteor-color, #e7bd87));
  transform: rotate(28deg);
  transform-origin: right center;
  animation: meteor-flight var(--meteor-duration, 1.3s) var(--meteor-delay, 0s) ease-in forwards;
}

.meteor::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: 0 0 12px #fffaf0;
  transform: translateY(-50%);
}

.party-piece {
  position: absolute;
  bottom: -3vh;
  width: var(--party-width, 7px);
  height: var(--party-height, 16px);
  border-radius: 2px;
  opacity: 0;
  background: var(--party-color, var(--rose));
  animation: party-cannon 2.2s var(--party-delay, 0s) cubic-bezier(0.12, 0.7, 0.22, 1) forwards;
}

.fireworks-layer {
  z-index: 49;
}

.firework {
  position: absolute;
  width: 1px;
  height: 1px;
}

.firework::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: rgba(255, 248, 235, 0.9);
  box-shadow:
    0 0 10px rgba(255, 248, 235, 0.9),
    0 0 24px rgba(255, 210, 122, 0.65);
  animation: firework-flash 1.15s ease-out forwards;
}

.firework.is-grand::before {
  inset: -12px;
  box-shadow:
    0 0 18px rgba(255, 248, 235, 0.95),
    0 0 38px rgba(255, 210, 122, 0.8),
    0 0 64px rgba(255, 127, 159, 0.45);
}

.firework-spark {
  position: absolute;
  width: var(--spark-size, 4px);
  height: var(--spark-size, 4px);
  border-radius: 50%;
  background: var(--spark-color, #ffd27a);
  box-shadow:
    0 0 8px var(--spark-color, #ffd27a),
    0 0 16px color-mix(in srgb, var(--spark-color, #ffd27a) 55%, transparent);
  will-change: transform, opacity;
  animation: firework-spark 1.55s var(--spark-delay, 0s) cubic-bezier(0.12, 0.72, 0.22, 1) forwards;
}

@keyframes dog-bob {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(-2deg);
  }
  50% {
    transform: translate(-50%, calc(-50% - 6px)) rotate(2deg);
  }
}

@keyframes dog-tail-wag {
  from {
    rotate: -12deg;
  }
  to {
    rotate: 18deg;
  }
}

@keyframes praise-word-glow {
  0%,
  100% {
    text-shadow: 0 0 0 rgba(216, 122, 143, 0);
  }
  50% {
    text-shadow: 0 0 12px rgba(216, 122, 143, 0.3);
  }
}

@keyframes praise-heart-hop {
  0%,
  100% {
    translate: 0 0;
    opacity: 0.55;
  }
  50% {
    translate: 0 -5px;
    opacity: 1;
  }
}

@keyframes rising-heart {
  0% {
    opacity: 0;
    transform: translate3d(0, 8vh, 0) scale(0.55) rotate(-8deg);
  }
  14% {
    opacity: 0.9;
  }
  68% {
    opacity: 0.88;
    transform: translate3d(var(--rise-drift, 0), -54vh, 0) scale(1.05) rotate(5deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--rise-fly, 3rem), -108vh, 0) scale(1.2) rotate(-14deg);
  }
}

@keyframes meteor-flight {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(28deg);
  }
  12% {
    opacity: 1;
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(145vw, 100vh, 0) rotate(28deg);
  }
}

@keyframes party-cannon {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0);
  }
  38% {
    opacity: 1;
    transform: translate3d(var(--party-x, 35vw), var(--party-y, -45vh), 0) rotate(var(--party-spin, 720deg));
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--party-end-x, 10vw), 110vh, 0) rotate(calc(var(--party-spin, 720deg) + 300deg));
  }
}

@keyframes firework-flash {
  0% {
    opacity: 1;
    scale: 1;
  }
  100% {
    opacity: 0;
    scale: 0.1;
  }
}

@keyframes firework-spark {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.4);
  }
  10% {
    opacity: 1;
  }
  72% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--spark-x, 0), var(--spark-y, 0), 0) scale(0.15);
  }
}

@media (max-width: 900px) {
  .river-dog {
    display: none;
  }

  .praise-word::before,
  .praise-word::after {
    font-size: 0.54em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .effect-layer {
    display: none;
  }

  .river-dog {
    animation: none;
  }
}

/* Deep night-sky theme */
body {
  color: #f8ebe5;
  background: #050817;
}

main,
.site-footer {
  position: relative;
  z-index: 2;
}

.night-stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 120%, rgba(95, 50, 100, 0.18), transparent 54%),
    linear-gradient(180deg, #03050f 0%, #080b1e 48%, #100a1d 100%);
}

.night-star {
  position: absolute;
  border-radius: 50%;
  box-shadow:
    0 0 var(--star-glow, 7px) rgba(255, 244, 219, 0.9),
    0 0 calc(var(--star-glow, 7px) + 8px) rgba(255, 225, 183, 0.35);
  opacity: var(--star-opacity, 0.8);
  animation: star-twinkle var(--star-duration, 4s) var(--star-delay, 0s) ease-in-out infinite;
}

.hero {
  background:
    radial-gradient(circle at 14% 20%, rgba(255, 244, 216, 0.55) 0 1px, transparent 1.7px),
    radial-gradient(circle at 72% 34%, rgba(255, 198, 220, 0.4) 0 1.2px, transparent 1.9px),
    radial-gradient(circle at 39% 78%, rgba(194, 210, 255, 0.46) 0 1px, transparent 1.7px),
    repeating-linear-gradient(
      116deg,
      transparent 0,
      transparent 74px,
      rgba(255, 249, 244, 0.018) 75px,
      transparent 76px
    ),
    linear-gradient(135deg, rgba(3, 6, 20, 0.98) 0%, rgba(15, 11, 34, 0.94) 54%, rgba(42, 19, 46, 0.9) 100%);
  background-size:
    210px 210px,
    330px 330px,
    470px 470px,
    auto,
    auto;
}

.prologue {
  color: #f9e9e3;
  background:
    radial-gradient(circle at 16% 24%, rgba(255, 246, 219, 0.42) 0 1px, transparent 1.7px),
    radial-gradient(circle at 82% 67%, rgba(210, 220, 255, 0.34) 0 1.2px, transparent 1.9px),
    linear-gradient(120deg, rgba(4, 7, 19, 0.92), rgba(17, 12, 34, 0.86) 58%, rgba(34, 17, 40, 0.84));
  background-size:
    250px 250px,
    390px 390px,
    auto;
}

.prologue::before {
  background: linear-gradient(to right, transparent, rgba(255, 193, 208, 0.34), transparent);
}

.prologue-year {
  color: #ffc184;
}

.prologue h2 {
  color: #fff0e6;
  text-shadow: 0 0 34px rgba(255, 193, 208, 0.08);
}

.memory-count strong {
  color: #ffcb91;
}

.memory-count span {
  color: rgba(255, 236, 226, 0.76);
}

.count-divider {
  background: rgba(255, 220, 223, 0.22);
}

.prologue-heart {
  color: #ff89a6;
  opacity: 0.72;
}

.story {
  color: #f7e9e3;
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 248, 225, 0.48) 0 1px, transparent 1.7px),
    radial-gradient(circle at 63% 31%, rgba(255, 205, 219, 0.38) 0 1.2px, transparent 1.9px),
    radial-gradient(circle at 27% 74%, rgba(200, 215, 255, 0.38) 0 1px, transparent 1.7px),
    linear-gradient(115deg, rgba(4, 7, 20, 0.94) 0%, rgba(13, 11, 30, 0.9) 48%, rgba(29, 14, 35, 0.88) 100%);
  background-size:
    230px 230px,
    360px 360px,
    510px 510px,
    auto;
}

.story-header h2,
.chapter-header h2 {
  color: #fff0e4;
  text-shadow: 0 0 34px rgba(255, 167, 189, 0.08);
}

.story-intro,
.chapter-header .chapter-kicker {
  color: #ffb2c3;
}

.chapter-header .chapter-note {
  color: rgba(250, 231, 226, 0.76);
}

.chapter-number {
  border-color: rgba(255, 192, 205, 0.3);
  color: #ffd08f;
  background: rgba(7, 10, 25, 0.82);
  box-shadow:
    0 0 0 6px rgba(7, 10, 25, 0.58),
    0 0 22px rgba(255, 154, 180, 0.09);
}

.memory-text {
  color: #f9ece7;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.22);
}

.memory-heart {
  color: #ff6f96;
  text-shadow: 0 0 12px rgba(255, 111, 150, 0.46);
}

.praise-word {
  color: #ff91ad;
  text-shadow: 0 0 11px rgba(255, 111, 150, 0.24);
}

.river-bed {
  stroke: rgba(255, 188, 205, 0.14);
}

.river-flow {
  stroke: rgba(255, 171, 195, 0.58);
}

.river-progress {
  stroke: #ff6f96;
  filter:
    drop-shadow(0 0 5px rgba(255, 111, 150, 0.72))
    drop-shadow(0 0 14px rgba(255, 111, 150, 0.28));
}

.river-tip {
  border-color: rgba(255, 157, 184, 0.42);
  color: #ff789c;
  background: rgba(7, 10, 25, 0.92);
  box-shadow:
    0 0 0 7px rgba(7, 10, 25, 0.72),
    0 0 24px rgba(255, 111, 150, 0.16);
}

.ending {
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 247, 225, 0.5) 0 1px, transparent 1.8px),
    radial-gradient(circle at 73% 58%, rgba(255, 191, 213, 0.38) 0 1.2px, transparent 2px),
    repeating-linear-gradient(
      70deg,
      transparent 0,
      transparent 82px,
      rgba(255, 249, 244, 0.018) 83px,
      transparent 84px
    ),
    linear-gradient(130deg, #03050f 0%, #0b0a20 52%, #1c0d22 100%);
  background-size:
    260px 260px,
    430px 430px,
    auto,
    auto;
}

.site-footer {
  color: rgba(255, 239, 231, 0.62);
  background: #03050f;
}

.meteor {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--meteor-color, #ffe7a8) 58%, #fffdf6);
  filter:
    drop-shadow(0 0 10px var(--meteor-color, #ffe7a8))
    drop-shadow(0 0 22px var(--meteor-color, #ffe7a8));
}

.meteor::after {
  width: 9px;
  height: 9px;
  background: #fffdf4;
  box-shadow:
    0 0 14px #fffdf4,
    0 0 32px var(--meteor-color, #ffe7a8);
}

.meteor-glint {
  position: absolute;
  width: var(--glint-size, 3px);
  height: var(--glint-size, 3px);
  border-radius: 50%;
  background: var(--glint-color, #fff7df);
  box-shadow:
    0 0 8px var(--glint-color, #fff7df),
    0 0 18px var(--glint-color, #fff7df);
  opacity: 0;
  animation: meteor-glint 2.8s var(--glint-delay, 0s) ease-in-out infinite;
}

.fireworks-layer {
  mix-blend-mode: screen;
}

.firework-ring {
  position: absolute;
  top: -12px;
  left: -12px;
  width: 24px;
  height: 24px;
  border: 2px solid var(--ring-color, #ffd27a);
  border-radius: 50%;
  opacity: 0;
  box-shadow:
    0 0 10px var(--ring-color, #ffd27a),
    inset 0 0 10px var(--ring-color, #ffd27a);
  animation: firework-ring 1.45s ease-out forwards;
}

.firework-ring.is-inner {
  animation-duration: 1.05s;
  animation-delay: 0.08s;
}

.firework-spark.is-heart {
  background: transparent;
  box-shadow: none;
}

.firework-spark.is-heart::before {
  content: "♥";
  position: absolute;
  inset: 50% auto auto 50%;
  color: var(--spark-color, #ff7f9f);
  font-family: Georgia, serif;
  font-size: calc(var(--spark-size, 4px) + 6px);
  line-height: 1;
  text-shadow: 0 0 10px var(--spark-color, #ff7f9f);
  transform: translate(-50%, -50%);
}

@keyframes star-twinkle {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.8);
  }
  50% {
    opacity: var(--star-opacity, 0.8);
    transform: scale(1.35);
  }
}

@keyframes meteor-glint {
  0%,
  100% {
    opacity: 0.1;
    transform: scale(0.7);
  }
  45% {
    opacity: 1;
    transform: scale(1.4);
  }
}

@keyframes firework-ring {
  0% {
    opacity: 0.9;
    transform: scale(0.2);
  }
  70% {
    opacity: 0.4;
  }
  100% {
    opacity: 0;
    transform: scale(5.8);
  }
}

@media (max-width: 760px) {
  .night-stars {
    background:
      linear-gradient(180deg, #03050f 0%, #080b1e 48%, #100a1d 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .night-star,
  .meteor-glint {
    animation: none;
  }
}

html.auto-scrolling {
  scroll-behavior: auto;
}

.river-progress {
  transition: stroke-dashoffset 140ms linear;
}

.river-tip {
  transition: transform 150ms linear;
}

canvas.fireworks-layer {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: block;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  mix-blend-mode: normal;
  contain: strict;
}

.river-bed {
  stroke: rgba(255, 0, 0, 0.1);
}

.river-flow {
  stroke: rgba(255, 0, 0, 0.42);
}

.river-progress {
  stroke: #ff0000;
  filter:
    drop-shadow(0 0 4px rgba(255, 0, 0, 0.7))
    drop-shadow(0 0 10px rgba(255, 0, 0, 0.22));
}

.river-tip {
  border-color: rgba(255, 0, 0, 0.48);
  color: #ff0000;
  box-shadow:
    0 0 0 7px rgba(7, 10, 25, 0.72),
    0 0 20px rgba(255, 0, 0, 0.22);
}

/* Four-stage glowing thread */
.river-measure {
  fill: none;
  stroke: transparent;
  opacity: 0;
  pointer-events: none;
}

.river-bed {
  stroke: rgba(255, 245, 233, 0.12);
  stroke-width: 7;
}

.river-flow {
  stroke: rgba(255, 246, 232, 0.18);
  stroke-width: 1;
  stroke-dasharray: 4 20;
  mix-blend-mode: normal;
}

.river-stage {
  fill: none;
  stroke: var(--stage-color);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  filter:
    drop-shadow(0 0 3px var(--stage-color))
    drop-shadow(0 0 10px color-mix(in srgb, var(--stage-color) 58%, transparent));
  transition:
    stroke-dasharray 120ms linear,
    opacity 240ms ease;
  mix-blend-mode: screen;
}

.river-stage--meet {
  --stage-color: #a8f57a;
}

.river-stage--heart {
  --stage-color: #ffe3a1;
}

.river-stage--hand {
  --stage-color: #ff9dbb;
}

.river-stage--love {
  --stage-color: #ff3658;
}

.river-highlight {
  fill: none;
  stroke: #fffdf3;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0;
  pointer-events: none;
  filter:
    drop-shadow(0 0 5px #fffdf3)
    drop-shadow(0 0 16px #ff8ba8)
    drop-shadow(0 0 26px #ff3658);
  mix-blend-mode: screen;
}

.river-highlight.is-flashing {
  animation: river-stage-flash 900ms ease-out both;
}

.river-nodes {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.river-node {
  position: absolute;
  width: 0;
  height: 0;
}

.river-node-core {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border: 1px solid rgba(255, 245, 233, 0.16);
  border-radius: 50%;
  color: rgba(255, 245, 233, 0.38);
  background: rgba(4, 8, 22, 0.94);
  box-shadow: 0 0 0 5px rgba(4, 8, 22, 0.65);
  font-family: Georgia, var(--serif);
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.42;
  transform: translate(-50%, -50%) scale(0.82);
  transition:
    opacity 320ms ease,
    transform 420ms cubic-bezier(0.2, 0.85, 0.25, 1),
    box-shadow 420ms ease;
}

.river-node--star .river-node-core {
  font-size: 0.9rem;
}

.river-node-label {
  position: absolute;
  top: 0;
  left: 1.28rem;
  padding: 0.22rem 0.48rem;
  border: 1px solid rgba(255, 245, 233, 0.12);
  border-radius: 999px;
  color: rgba(255, 245, 233, 0.36);
  background: rgba(4, 8, 22, 0.8);
  font-family: var(--serif);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
  opacity: 0.24;
  transform: translateY(-50%);
  transition:
    opacity 300ms ease,
    border-color 300ms ease;
  backdrop-filter: blur(6px);
}

.river-node.is-reached .river-node-core {
  border-color: color-mix(in srgb, var(--node-color, #ff9dbb) 58%, transparent);
  color: var(--node-color, #ff9dbb);
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  box-shadow:
    0 0 0 6px rgba(4, 8, 22, 0.72),
    0 0 14px var(--node-color, #ff9dbb),
    0 0 30px color-mix(in srgb, var(--node-color, #ff9dbb) 48%, transparent);
}

.river-node.is-reached .river-node-label {
  border-color: color-mix(in srgb, var(--node-color, #ff9dbb) 48%, transparent);
  color: var(--node-color, #ff9dbb);
  opacity: 0.92;
}

.river-node.is-new .river-node-core {
  animation: river-node-pop 780ms cubic-bezier(0.16, 0.8, 0.2, 1) both;
}

.river-tip[data-stage="0"] {
  border-color: rgba(168, 245, 122, 0.55);
  color: #a8f57a;
  box-shadow:
    0 0 0 7px rgba(7, 10, 25, 0.72),
    0 0 22px rgba(168, 245, 122, 0.4);
}

.river-tip[data-stage="1"] {
  border-color: rgba(255, 227, 161, 0.58);
  color: #ffe3a1;
  box-shadow:
    0 0 0 7px rgba(7, 10, 25, 0.72),
    0 0 22px rgba(255, 227, 161, 0.42);
}

.river-tip[data-stage="2"] {
  border-color: rgba(255, 157, 187, 0.58);
  color: #ff9dbb;
  box-shadow:
    0 0 0 7px rgba(7, 10, 25, 0.72),
    0 0 22px rgba(255, 157, 187, 0.44);
}

.river-tip[data-stage="3"] {
  border-color: rgba(255, 54, 88, 0.62);
  color: #ff526e;
  box-shadow:
    0 0 0 7px rgba(7, 10, 25, 0.72),
    0 0 24px rgba(255, 54, 88, 0.46);
}

/* Scattered ending memories */
.memory-scatter {
  position: relative;
  z-index: 2;
  width: min(100%, 38rem);
  aspect-ratio: 1 / 1.02;
  justify-self: end;
  isolation: isolate;
}

.moment-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--memory-width, 24%);
  aspect-ratio: var(--memory-aspect, 3 / 4);
  margin: 0;
  padding: 0.34rem 0.34rem 1.2rem;
  border: 1px solid rgba(255, 244, 234, 0.28);
  border-radius: 4px;
  background: #fff8f0;
  box-shadow:
    0 0.75rem 1.8rem rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  opacity: 0;
  filter: blur(5px);
  transform: translate(-50%, -50%) rotate(0deg) scale(0.72);
  transform-origin: center;
  pointer-events: none;
  will-change: left, top, opacity, transform, filter;
}

.moment-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.94) contrast(1.01);
}

.ending.is-visible .moment-card {
  animation: memory-spread 1.18s var(--memory-delay, 0ms) cubic-bezier(0.18, 0.76, 0.2, 1)
    forwards;
}

.ending-wish {
  color: rgba(255, 225, 220, 0.88) !important;
}

.control-button.is-loading svg {
  animation: control-spin 1.1s linear infinite;
}

@keyframes river-stage-flash {
  0% {
    opacity: 0;
    stroke-width: 2;
  }
  24% {
    opacity: 1;
    stroke-width: 12;
  }
  100% {
    opacity: 0;
    stroke-width: 3;
  }
}

@keyframes river-node-pop {
  0% {
    opacity: 0.4;
    transform: translate(-50%, -50%) scale(0.55);
  }
  45% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.35);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes memory-spread {
  0% {
    top: 50%;
    left: 50%;
    opacity: 0;
    filter: blur(5px);
    transform: translate(-50%, -50%) rotate(0deg) scale(0.72);
  }
  20% {
    top: 50%;
    left: 50%;
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, -50%) rotate(0deg) scale(0.9);
  }
  82% {
    top: var(--memory-top);
    left: var(--memory-left);
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, -50%) rotate(var(--memory-rotate)) scale(1.035);
  }
  100% {
    top: var(--memory-top);
    left: var(--memory-left);
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, -50%) rotate(var(--memory-rotate)) scale(1);
  }
}

@keyframes control-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .river-stage {
    stroke-width: 3.6;
  }

  .river-node-core {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.64rem;
  }

  .river-node-label {
    display: none;
  }

  .memory-scatter {
    width: min(100%, 25rem);
    justify-self: center;
  }

  .moment-card {
    padding: 0.22rem 0.22rem 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .river-stage,
  .river-node-core,
  .river-node-label {
    transition: none;
  }

  .river-highlight {
    display: none;
  }

  .river-node.is-new .river-node-core,
  .control-button.is-loading svg {
    animation: none;
  }

  .ending.is-visible .moment-card {
    animation: none;
    top: var(--memory-top);
    left: var(--memory-left);
    opacity: 1;
    filter: none;
    transform: translate(-50%, -50%) rotate(var(--memory-rotate)) scale(1);
  }
}
