:root {
  --ink: #543c42;
  --ink-soft: #80646a;
  --rose: #b95d72;
  --rose-dark: #8e3e54;
  --rose-light: #eed1d5;
  --cream: #fffaf7;
  --paper: rgba(255, 252, 249, 0.88);
  --gold: #b68a5a;
  --shadow: 0 22px 70px rgba(111, 69, 79, 0.16);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f7ebe6;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.9), transparent 30%),
    linear-gradient(135deg, #f9efea 0%, #f4dedf 55%, #edcfd4 100%);
  font-family: var(--sans);
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.background-glow {
  position: fixed;
  z-index: 0;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  opacity: 0.42;
  filter: blur(20px);
  pointer-events: none;
}

.background-glow-one {
  top: -12rem;
  right: -8rem;
  background: #f7b7c1;
}

.background-glow-two {
  bottom: -14rem;
  left: -10rem;
  background: #f4c9b4;
}

.floating-hearts {
  position: fixed;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  color: rgba(185, 93, 114, 0.22);
  font-family: var(--serif);
  font-size: 2rem;
  pointer-events: none;
}

.floating-hearts span {
  position: absolute;
  bottom: -4rem;
  animation: rise 18s linear infinite;
}

.floating-hearts span:nth-child(1) {
  left: 8%;
  animation-delay: -4s;
}

.floating-hearts span:nth-child(2) {
  left: 24%;
  font-size: 3rem;
  animation-delay: -13s;
  animation-duration: 24s;
}

.floating-hearts span:nth-child(3) {
  left: 47%;
  animation-delay: -8s;
  animation-duration: 16s;
}

.floating-hearts span:nth-child(4) {
  left: 66%;
  font-size: 2.8rem;
  animation-delay: -18s;
  animation-duration: 22s;
}

.floating-hearts span:nth-child(5) {
  left: 82%;
  animation-delay: -11s;
  animation-duration: 20s;
}

.floating-hearts span:nth-child(6) {
  left: 92%;
  font-size: 2.5rem;
  animation-delay: -2s;
  animation-duration: 25s;
}

.experience {
  position: relative;
  z-index: 2;
}

.scene {
  display: none;
  min-height: 100vh;
  padding: 1.5rem;
  align-items: center;
  justify-content: center;
}

.scene.is-active {
  display: flex;
  animation: scene-in 700ms ease both;
}

.scene-card {
  width: min(100%, 44rem);
  padding: clamp(2rem, 7vw, 4.5rem);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 2rem;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(16px);
}

.eyebrow,
.signature-note,
.countdown {
  margin: 0;
  color: var(--rose-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.6;
  text-transform: uppercase;
}

.countdown {
  min-height: 1.2rem;
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.62rem;
  letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 1rem;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 700;
  line-height: 0.98;
}

h1 {
  font-size: clamp(3.3rem, 11vw, 5.9rem);
}

h2 {
  font-size: clamp(3rem, 9vw, 5rem);
}

h3 {
  margin-bottom: 0.35rem;
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1;
}

em {
  color: var(--rose);
  font-weight: 600;
}

.intro-heart {
  width: 4.4rem;
  height: 4.4rem;
  margin: 1.4rem auto 1.7rem;
  border: 1px solid var(--rose-light);
  border-radius: 50%;
  color: var(--rose);
  font-family: var(--serif);
  font-size: 3.25rem;
  line-height: 3.82rem;
}

.intro-copy,
.memory-copy,
.final-card > p {
  max-width: 31rem;
  margin-right: auto;
  margin-bottom: 1.6rem;
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.8;
}

.primary-button {
  display: inline-flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
  min-height: 3.4rem;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  color: #fffaf8;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  box-shadow: 0 12px 24px rgba(142, 62, 84, 0.22);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  box-shadow: 0 16px 28px rgba(142, 62, 84, 0.3);
  transform: translateY(-3px);
}

.primary-button:focus-visible,
.text-button:focus-visible {
  outline: 3px solid rgba(185, 93, 114, 0.26);
  outline-offset: 4px;
}

.signature-note {
  margin-top: 1.5rem;
  color: var(--ink-soft);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.envelope-card {
  overflow: hidden;
}

.envelope-wrap {
  display: grid;
  height: 18rem;
  margin: 1.25rem 0 0.2rem;
  place-items: center;
  perspective: 70rem;
}

.envelope {
  position: relative;
  width: min(23rem, 82vw);
  height: min(15rem, 53vw);
  filter: drop-shadow(0 18px 18px rgba(111, 69, 79, 0.2));
  transition: transform 700ms ease;
}

.envelope-wrap.is-open .envelope {
  transform: translateY(3.3rem);
}

.envelope-back,
.envelope-left,
.envelope-right,
.envelope-bottom,
.envelope-flap {
  position: absolute;
  inset: 0;
}

.envelope-back {
  border-radius: 0.35rem;
  background: #eebec3;
}

.letter-preview {
  position: absolute;
  right: 7%;
  bottom: 3%;
  left: 7%;
  height: 87%;
  padding-top: 2.5rem;
  border-radius: 0.25rem;
  color: var(--rose-dark);
  background: #fffdfa;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  transition: transform 900ms ease 450ms;
}

.letter-preview small {
  display: block;
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.envelope-wrap.is-open .letter-preview {
  transform: translateY(-9rem);
}

.envelope-left {
  background: #e3a5ad;
  clip-path: polygon(0 0, 56% 50%, 0 100%);
}

.envelope-right {
  background: #dfa0a9;
  clip-path: polygon(100% 0, 44% 50%, 100% 100%);
}

.envelope-bottom {
  background: #efbdc3;
  clip-path: polygon(0 100%, 50% 42%, 100% 100%);
}

.envelope-flap {
  z-index: 2;
  background: #f4ccd0;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  transform-origin: top;
  transition:
    transform 650ms ease,
    z-index 1ms linear 640ms;
}

.envelope-wrap.is-open .envelope-flap {
  z-index: 0;
  transform: rotateX(180deg);
}

.wax-seal {
  position: absolute;
  z-index: 4;
  top: 43%;
  left: 50%;
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  border: 3px double rgba(255, 243, 231, 0.54);
  border-radius: 50%;
  color: rgba(255, 247, 239, 0.9);
  background: var(--rose-dark);
  font-family: var(--serif);
  font-size: 2rem;
  place-items: center;
  transform: translate(-50%, -50%);
  transition:
    opacity 350ms ease,
    transform 500ms ease;
}

.envelope-wrap.is-open .wax-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.5);
}

.photo-frame {
  width: min(100%, 22rem);
  margin: 1.5rem auto 1.25rem;
  padding: 0.7rem 0.7rem 1.6rem;
  background: #fffdf9;
  box-shadow: 0 16px 38px rgba(111, 69, 79, 0.18);
  transform: rotate(-2deg);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: min(48vh, 29rem);
  object-fit: cover;
  object-position: center 42%;
}

.photo-frame figcaption {
  padding-top: 0.85rem;
  color: var(--rose-dark);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-style: italic;
}

.wish-grid {
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0;
  text-align: left;
}

.wish {
  position: relative;
  overflow: hidden;
  padding: 1.2rem 1.3rem;
  border: 1px solid rgba(185, 93, 114, 0.13);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.52);
}

.wish p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.83rem;
  line-height: 1.65;
}

.wish-number {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  color: rgba(185, 93, 114, 0.2);
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 700;
}

.letter-scene {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.letter-card {
  width: min(100%, 49rem);
}

.letter-body {
  margin: 1.5rem 0 1.8rem;
  padding: clamp(1.35rem, 5vw, 2.5rem);
  border: 1px solid rgba(182, 138, 90, 0.22);
  border-radius: 0.4rem;
  color: #644d50;
  background:
    linear-gradient(rgba(255, 253, 247, 0.92), rgba(255, 253, 247, 0.92)),
    repeating-linear-gradient(
      transparent,
      transparent 1.8rem,
      rgba(185, 93, 114, 0.08) 1.85rem
    );
  box-shadow: 0 12px 32px rgba(111, 69, 79, 0.09);
  font-family: var(--serif);
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  line-height: 1.42;
  text-align: left;
}

.letter-body p {
  margin-bottom: 1rem;
}

.letter-body p:last-child {
  margin-bottom: 0;
}

.inline-heart {
  color: var(--rose);
}

.letter-signature {
  color: var(--rose-dark);
  font-size: 2rem;
  font-style: italic;
  font-weight: 700;
}

.sparkle-ring {
  display: flex;
  gap: 1.15rem;
  align-items: center;
  justify-content: center;
  margin: 2rem 0 1.3rem;
  color: var(--gold);
}

.final-heart {
  display: grid;
  width: 5.2rem;
  height: 5.2rem;
  border: 1px solid rgba(185, 93, 114, 0.25);
  border-radius: 50%;
  color: var(--rose);
  font-size: 2.25rem;
  place-items: center;
  animation: heartbeat 1.8s ease-in-out infinite;
}

.final-signature {
  color: var(--rose-dark) !important;
  font-family: var(--serif);
  font-size: 1.9rem !important;
  font-style: italic;
  font-weight: 700;
}

.text-button {
  padding: 0.5rem;
  color: var(--rose-dark);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: underline;
  text-underline-offset: 0.35rem;
  text-transform: uppercase;
}

#confetti {
  position: fixed;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@keyframes scene-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0) rotate(0deg);
  }

  18% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translateY(-120vh) rotate(70deg);
  }
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1);
  }

  15% {
    transform: scale(1.1);
  }

  28% {
    transform: scale(1);
  }
}

@media (min-width: 700px) {
  .wish-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .wish {
    min-height: 11rem;
  }
}

@media (max-width: 420px) {
  .scene {
    padding: 0.85rem;
  }

  .scene-card {
    padding: 1.8rem 1.1rem;
    border-radius: 1.45rem;
  }

  .envelope-wrap {
    height: 15rem;
  }
}

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