
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: #57384a;
  font-family: Georgia, "Times New Roman", serif;
  background: #fff0f5;
}

.opening {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 30px 18px;
  overflow: hidden;
  transition: min-height 1s ease;
}

.eyebrow {
  color: #c75f8b;
  letter-spacing: 3px;
  text-transform: uppercase;
  font: 12px Arial, sans-serif;
}

h1 {
  font-size: clamp(32px, 7vw, 54px);
  font-weight: normal;
}

h1 span {
  color: #df76a0;
}

.envelope-button {
  width: min(320px, 85vw);
  height: 220px;
  position: relative;
  border: 0;
  background: transparent;
  cursor: pointer;
  margin: 20px 0;
}

.envelope {
  position: absolute;
  width: 100%;
  height: 180px;
  bottom: 0;
  filter: drop-shadow(0 15px 15px #d58aa633);
  transition: transform 1s ease, opacity 1s ease;
}

.back {
  position: absolute;
  inset: 0;
  background: #eaa0bc;
  border-radius: 8px;
}

.paper {
  position: absolute;
  width: 82%;
  height: 145px;
  left: 9%;
  bottom: 20px;
  background: #fffdfd;
  border-radius: 5px;
  transition: transform 1s ease 0.2s;
}

.front {
  position: absolute;
  inset: 0;
  background: #f3b4cb;
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  border-radius: 8px;
}

.flap {
  position: absolute;
  inset: 0;
  background: #f8d0df;
  clip-path: polygon(0 0, 100% 0, 50% 65%);
  transform-origin: top center;
  transition: transform 0.8s ease, opacity 0.5s ease;
}

.heart {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 40px;
  transition: opacity 0.3s ease;
  text-shadow: 0 2px 8px #bc5981;
}

.hint {
  color: #a77c91;
  font: 14px Arial, sans-serif;
}

.opening.opened .flap {
  transform: rotateX(180deg);
  opacity: 0;
}

.opening.opened .paper {
  transform: translateY(-90px);
}

.opening.opened .heart {
  opacity: 0;
}

.opening.opened .envelope {
  transform: translateY(25px) scale(0.9);
  opacity: 0.2;
}

main {
  padding: 10px 15px 60px;
  animation: appear 1s ease;
}

[hidden] {
  display: none !important;
}

.letter-card {
  max-width: 760px;
  margin: auto;
  padding: clamp(24px, 6vw, 60px);
  background: #fffdfd;
  border: 1px solid #f4d4e0;
  border-radius: 20px;
  box-shadow: 0 20px 60px #c77b9918;
}

.letter-card > h2,
.letter-card > .eyebrow,
.date {
  text-align: center;
}

.letter-card h2 {
  font-size: clamp(30px, 6vw, 44px);
  font-weight: normal;
}

.date {
  color: #a77c91;
  font: 14px Arial, sans-serif;
}

.letter-text {
  max-width: 590px;
  margin: 35px auto;
  font-size: 18px;
  line-height: 1.9;
}

.letter-text p {
  margin-bottom: 22px;
}

.signature {
  color: #c75f8b;
  font-style: italic;
  font-size: 22px;
}

.music {
  padding: 22px;
  border-radius: 14px;
  background: #fff0f5;
  text-align: center;
}

.music h3 {
  font-size: 24px;
  font-weight: normal;
}

.music p,
.memories > p {
  color: #a77c91;
  font: 14px Arial, sans-serif;
}

audio {
  display: block;
  width: 100%;
  margin-top: 20px;
}

.memories {
  padding-top: 35px;
  text-align: center;
}

.memories h2 {
  font-size: 32px;
  font-weight: normal;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin-top: 25px;
}

figure {
  margin: 0;
  padding: 8px 8px 15px;
  background: white;
  box-shadow: 0 6px 20px #c77b9918;
}

figure:nth-child(2) {
  transform: rotate(2deg);
}

figure img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #f5d5e1;
}

figcaption {
  padding-top: 12px;
  font-size: 14px;
  font-style: italic;
}

.ending {
  text-align: center;
  color: #c75f8b;
  font-size: 22px;
  margin-top: 40px;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .gallery {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin-inline: auto;
    gap: 22px;
  }

  figure img {
    aspect-ratio: 4 / 3;
  }

  .letter-text {
    font-size: 16px;
  }
}