:root {
  --bg: #fffaf7;
  --bg-soft: #fff7f5;
  --bg-lilac: #f7f3f5;
  --surface: rgba(255, 255, 255, 0.68);
  --surface-solid: #fffdfb;
  --text: #3f3738;
  --muted: #8b7d80;
  --line: rgba(150, 110, 120, 0.15);
  --rose: #d89aa5;
  --rose-deep: #c68f99;
  --rose-soft: #f3dfe3;
  --lavender: #e7e0f0;
  --shadow: 0 12px 40px rgba(100, 70, 80, 0.08);
  --shadow-hover: 0 18px 52px rgba(100, 70, 80, 0.12);
  --radius: 20px;
  color-scheme: light only;
}

* {
  box-sizing: border-box;
}

html {
  background: #fffaf7;
  color: #40383a;
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: #40383a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: #fffaf7;
  background:
    linear-gradient(135deg, #fffaf7 0%, #fff7f5 40%, #fdf6f8 68%, #f7f3f5 100%);
  background-color: #fffaf7;
}

body::before,
body::after {
  content: none;
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(48px);
  opacity: 0.32;
}

body::before {
  width: 28rem;
  height: 28rem;
  left: -8rem;
  top: 8vh;
  background: #f3dfe3;
}

body::after {
  width: 30rem;
  height: 30rem;
  right: -9rem;
  top: 4vh;
  background: #e7e0f0;
}

button {
  font: inherit;
}

#light-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: transparent !important;
  opacity: 0.34;
}

main,
.music-button,
.secret-trigger,
.secret-modal,
.image-preview {
  position: relative;
  z-index: 1;
}

.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 28%, rgba(243, 223, 227, 0.5), transparent 18rem),
    radial-gradient(circle at 76% 24%, rgba(231, 224, 240, 0.44), transparent 20rem),
    radial-gradient(circle at 50% 82%, rgba(255, 253, 251, 0.72), transparent 22rem);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(36px);
  opacity: 0.28;
  pointer-events: none;
}

.hero::before {
  width: 12rem;
  height: 12rem;
  left: 16%;
  bottom: 18%;
  background: #fff0ea;
}

.hero::after {
  width: 10rem;
  height: 10rem;
  right: 18%;
  top: 22%;
  background: #efe8f7;
}

.hero-content {
  position: relative;
  text-align: center;
  transform: translateY(-2vh);
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  color: var(--text);
  font-size: clamp(4.6rem, 12vw, 8.6rem);
  line-height: 0.95;
}

.hero p {
  margin-top: 1.25rem;
  color: rgba(139, 125, 128, 0.82);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
}

.start-button {
  min-width: 8.8rem;
  min-height: 3.05rem;
  margin-top: 2.5rem;
  border: 1px solid rgba(216, 154, 165, 0.22);
  border-radius: 999px;
  color: var(--text);
  background: #f3dfe3;
  box-shadow: 0 10px 28px rgba(100, 70, 80, 0.07);
  cursor: pointer;
  transition: transform 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.start-button:hover {
  transform: translateY(-3px);
  background: #edcfd6;
  box-shadow: 0 14px 34px rgba(100, 70, 80, 0.1);
}

.content-section {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(4.5rem, 10vw, 7.5rem) 0;
  background-color: transparent;
}

.compact-section {
  width: min(900px, calc(100% - 2rem));
}

#together {
  width: min(980px, calc(100% - 2rem));
  margin-top: 1rem;
  padding: clamp(4rem, 8vw, 6rem) clamp(1rem, 4vw, 3rem);
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(255, 248, 246, 0.8), rgba(253, 242, 246, 0.72)),
    radial-gradient(circle at 20% 15%, rgba(243, 223, 227, 0.58), transparent 18rem);
}

#letter {
  width: min(980px, calc(100% - 2rem));
  margin-bottom: 3rem;
  padding-inline: clamp(0rem, 4vw, 3rem);
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255, 248, 244, 0.4), rgba(255, 250, 247, 0.74));
}

#moments,
.moments {
  background-color: #fffaf7;
  background-image: linear-gradient(180deg, #fffaf7 0%, #fdf6f8 100%);
}

.section-heading {
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}

.section-heading h2 {
  color: var(--text);
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.05;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 720ms ease, transform 720ms ease;
}

.reveal.section-visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline {
  position: relative;
  display: grid;
  gap: 3.2rem;
  padding: 1rem 0;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(transparent, rgba(200, 150, 160, 0.25), transparent);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.78rem;
  height: 0.78rem;
  border-radius: 50%;
  background: #fffdfb;
  border: 3px solid #efcbd2;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 6px rgba(255, 250, 247, 0.88);
}

.timeline-item:nth-child(even) .timeline-copy {
  order: 2;
}

.timeline-item:nth-child(even) .timeline-media {
  order: 1;
}

.timeline-copy {
  padding: 0.4rem 0;
}

.timeline-date {
  color: var(--rose-deep);
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timeline-copy h3 {
  margin: 0.7rem 0 0.5rem;
  color: #40383a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 400;
}

.timeline-copy p {
  max-width: 28rem;
  color: #8b7f82;
  line-height: 1.8;
}

.image-frame,
.photo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(150, 110, 120, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.photo-card {
  background-color: rgba(255, 255, 255, 0.72);
}

.image-frame {
  aspect-ratio: 4 / 3;
}

.image-frame img,
.photo-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-placeholder,
.photo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  color: rgba(139, 125, 128, 0.66);
  text-align: center;
  line-height: 1.7;
  background-color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 253, 251, 0.76), rgba(250, 246, 247, 0.72)),
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(216, 154, 165, 0.035) 12px 24px);
  background-color: rgba(255, 255, 255, 0.72);
}

.image-placeholder::before,
.photo-placeholder::before {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px dashed rgba(150, 110, 120, 0.16);
  border-radius: calc(var(--radius) - 6px);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
}

.photo-card {
  aspect-ratio: 4 / 5;
  cursor: zoom-in;
  transition: transform 240ms ease, box-shadow 240ms ease, border-color 240ms ease;
}

.photo-card:hover {
  transform: translateY(-4px) scale(1.015);
  border-color: rgba(150, 110, 120, 0.18);
  box-shadow: var(--shadow-hover);
}

.timer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.time-part,
.memory-card,
.letter-card {
  border: 1px solid rgba(150, 110, 120, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.time-part {
  padding: 1.35rem 0.8rem 1.25rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.56);
}

.time-value {
  display: block;
  color: #3f3738;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1;
}

.time-label {
  display: block;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.memory-card {
  min-height: 9rem;
  padding: 1.35rem;
  display: flex;
  align-items: flex-end;
  color: #4c4546;
  line-height: 1.55;
  background: #fffdfb;
}

.memory-card:nth-child(2) {
  transform: rotate(0.8deg);
  background: #fff8f6;
}

.memory-card:nth-child(3) {
  transform: rotate(-0.7deg);
  background: #faf6f7;
}

.memory-card:nth-child(4) {
  transform: rotate(0.5deg);
  background: #fffaf8;
}

.letter-section {
  min-height: 78vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.letter-section .section-heading {
  margin-bottom: clamp(3.4rem, 7vw, 5rem);
}

.envelope {
  position: relative;
  width: min(18rem, 72vw);
  height: 11.5rem;
  margin-top: 0.5rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
}

.envelope-body,
.envelope-flap,
.envelope-paper {
  position: absolute;
  inset: 0;
  border-radius: 0.78rem;
}

.envelope-body {
  background:
    linear-gradient(145deg, transparent 49.5%, rgba(178, 128, 138, 0.2) 50%, transparent 51%),
    linear-gradient(215deg, transparent 49.5%, rgba(178, 128, 138, 0.2) 50%, transparent 51%),
    linear-gradient(180deg, #fffbf5, #f7e7e8);
  border: 1px solid rgba(178, 128, 138, 0.24);
  box-shadow: 0 18px 48px rgba(100, 70, 80, 0.1);
}

.envelope-flap {
  z-index: 3;
  transform-origin: top;
  background: linear-gradient(160deg, #fffdf8 50%, #f5dcdf 51%);
  border: 1px solid rgba(178, 128, 138, 0.2);
  clip-path: polygon(0 0, 100% 0, 50% 62%);
  transition: transform 700ms ease;
}

.envelope-paper {
  z-index: 1;
  inset: 1.1rem 1.2rem auto;
  height: 8.4rem;
  background: #fffdfb;
  border: 1px solid rgba(150, 110, 120, 0.12);
  box-shadow: 0 8px 24px rgba(100, 70, 80, 0.06);
  transform: translateY(2.1rem);
  transition: transform 700ms ease 120ms;
}

.envelope-heart {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 53%;
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #b97884;
  background: #f3dfe3;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 20px rgba(178, 128, 138, 0.14);
}

.envelope.open .envelope-flap {
  transform: rotateX(172deg);
}

.envelope.open .envelope-paper {
  transform: translateY(-2.8rem);
}

.letter-card {
  width: min(680px, 100%);
  margin-top: 3rem;
  padding: clamp(1.6rem, 5vw, 2.7rem);
  opacity: 0;
  background: #fffdfb;
  transform: translateY(1rem);
  transition: opacity 400ms ease, transform 400ms ease;
}

.letter-card.show {
  opacity: 1;
  transform: translateY(0);
}

.letter-card p {
  color: #4a4244;
  line-height: 2;
  white-space: pre-line;
}

.music-button,
.secret-trigger {
  position: fixed;
  border: 1px solid rgba(150, 110, 120, 0.12);
  color: rgba(139, 125, 128, 0.84);
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 10px 28px rgba(100, 70, 80, 0.07);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.music-button {
  top: 1rem;
  right: 1rem;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
}

.music-button.playing {
  color: #a96d79;
  background: rgba(243, 223, 227, 0.8);
}

.secret-trigger {
  right: 1rem;
  bottom: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 0.92rem;
  opacity: 0.52;
  transition: color 180ms ease, background 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.secret-trigger:hover {
  color: #b97884;
  background: rgba(243, 223, 227, 0.72);
  opacity: 0.9;
  transform: translateY(-2px);
}

.secret-modal,
.image-preview {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.secret-modal.show,
.image-preview.show {
  opacity: 1;
  pointer-events: auto;
}

.secret-backdrop,
.image-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(95, 77, 82, 0.16);
  backdrop-filter: blur(8px);
}

.secret-card {
  position: relative;
  width: min(25rem, calc(100% - 2rem));
  min-height: 18rem;
  display: grid;
  place-items: center;
  padding: 3rem 2rem;
  overflow: hidden;
  text-align: center;
  border: 1px solid rgba(150, 110, 120, 0.12);
  border-radius: 24px;
  background: rgba(255, 253, 251, 0.92);
  box-shadow: 0 24px 70px rgba(100, 70, 80, 0.14);
}

.secret-card h2 {
  color: var(--text);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
}

.secret-card p {
  margin-top: 1rem;
  color: var(--muted);
}

.secret-close,
.preview-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  border: 0;
  color: #8b7d80;
  background: transparent;
  font-size: 1.35rem;
  cursor: pointer;
}

.secret-sparkles span {
  position: absolute;
  color: rgba(216, 154, 165, 0.46);
  animation: floatHeart 2.8s ease-in-out infinite;
}

.image-preview img {
  position: relative;
  max-width: min(92vw, 920px);
  max-height: 86vh;
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(100, 70, 80, 0.18);
}

@keyframes floatHeart {
  0%, 100% {
    opacity: 0.28;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 0.72;
    transform: translateY(-1rem) scale(1.06);
  }
}

@media (max-width: 760px) {
  .hero {
    padding-inline: 1.35rem;
  }

  h1 {
    font-size: clamp(4rem, 18vw, 5.6rem);
  }

  .content-section,
  .compact-section,
  #together,
  #letter {
    width: min(100% - 2rem, 38rem);
    padding-top: 4.5rem;
    padding-bottom: 4.5rem;
  }

  #together,
  #letter {
    padding-inline: 1rem;
    border-radius: 26px;
  }

  .timeline::before {
    left: 0.45rem;
  }

  .timeline-item,
  .timeline-item:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-left: 2rem;
  }

  .timeline-item::before {
    left: 0.45rem;
    top: 0.75rem;
    transform: translateX(-50%);
  }

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

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

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

  .memory-card {
    min-height: 7.5rem;
  }
}

@media (max-width: 440px) {
  .content-section,
  .compact-section,
  #together,
  #letter {
    width: min(100% - 1.5rem, 38rem);
  }

  .photo-grid,
  .timer,
  .memory-grid {
    grid-template-columns: 1fr;
  }

  .photo-card {
    aspect-ratio: 5 / 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
