:root {
  --blush: #f4d4cd;
  --blush-deep: #e7b7b0;
  --rose: #c45c6a;
  --rose-dark: #9a3b4a;
  --ink: #4a342e;
  --ink-soft: #6d534b;
  --paper: #fffaf3;
  --paper-edge: #f0e2cf;
  --envelope: #f6e4c8;
  --envelope-dark: #e6cc9f;
  --flap: #edd6ae;
  --seal: #c23b4a;
  --cream: #fbf1ea;
  --gold: #d7b15a;
  --shadow: 0 24px 50px rgba(122, 62, 68, 0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  font-family: "Nunito", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 700px at 10% -10%, #ffe7e1 0%, transparent 55%),
    radial-gradient(900px 600px at 110% 10%, #f7d6c8 0%, transparent 50%),
    linear-gradient(180deg, #f8e7e1 0%, var(--cream) 48%, #f3d8d2 100%);
  overflow-x: hidden;
}

.visually-hidden {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#petals {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
}

.glow-one {
  width: 220px;
  height: 220px;
  background: #ffd3c9;
  top: 8%;
  right: -40px;
}

.glow-two {
  width: 280px;
  height: 280px;
  background: #f5c1c8;
  bottom: 4%;
  left: -70px;
}

main {
  position: relative;
  z-index: 1;
}

.landing {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(28px + var(--safe-top)) 20px calc(36px + var(--safe-bottom));
  text-align: center;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.landing.is-leaving {
  opacity: 0;
  transform: translateY(-24px) scale(0.98);
  pointer-events: none;
}

.corner-flowers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.flower {
  position: absolute;
  width: 78px;
  height: 78px;
  opacity: 0.88;
  filter: drop-shadow(0 8px 10px rgba(150, 70, 80, 0.12));
}

.f-tl {
  top: calc(10px + var(--safe-top));
  right: 6px;
  transform: rotate(18deg) scale(0.95);
}

.f-tr {
  top: calc(18px + var(--safe-top));
  left: 4px;
  width: 70px;
  height: 80px;
  transform: rotate(-22deg);
}

.f-bl {
  bottom: 18px;
  right: 0;
  transform: rotate(-16deg);
}

.f-br {
  bottom: 28px;
  left: 6px;
  transform: rotate(12deg) scale(0.9);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--rose);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.landing-title {
  margin: 0 0 28px;
  font-family: "Great Vibes", cursive;
  font-size: clamp(3.4rem, 14vw, 5.2rem);
  font-weight: 400;
  color: var(--rose-dark);
  line-height: 1;
}

.envelope {
  appearance: none;
  border: 0;
  background: transparent;
  position: relative;
  width: min(82vw, 340px);
  height: 220px;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 18px 24px rgba(122, 62, 68, 0.2));
  perspective: 1100px;
  touch-action: manipulation;
  animation: floaty 3.6s ease-in-out infinite;
}

.envelope.open {
  animation: none;
}

.envelope:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 8px;
  border-radius: 16px;
}

.envelope-shadow {
  display: none;
}

.letter-peek {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 42px;
  height: 132px;
  background: linear-gradient(#fffdf8, #fff6ea);
  border-radius: 4px 4px 0 0;
  box-shadow: 0 8px 18px rgba(90, 50, 40, 0.08);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 18px;
  gap: 8px;
  transition: transform 0.85s cubic-bezier(0.22, 0.9, 0.3, 1) 0.28s;
}

.peek-line,
.peek-line.short {
  display: block;
  height: 4px;
  width: 58%;
  background: #ead7c2;
  border-radius: 99px;
}

.peek-line.short {
  width: 38%;
}

.peek-heart {
  color: var(--rose);
  font-size: 1.1rem;
  margin-top: 4px;
}

.flap {
  position: absolute;
  inset: 0 0 auto;
  height: 118px;
  z-index: 5;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.22, 0.75, 0.3, 1);
}

.flap-front,
.flap-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.flap-front {
  background: linear-gradient(180deg, #f8e6c4 0%, #e7c898 100%);
  box-shadow: inset 0 -6px 12px rgba(160, 110, 60, 0.08);
}

.flap-back {
  background: linear-gradient(180deg, #f3d7a8, #e8c48b);
  transform: rotateX(180deg);
}

.pocket {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 148px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 30%),
    linear-gradient(180deg, #f4ddb6 0%, #e8c894 100%);
  clip-path: polygon(0 38%, 50% 0, 100% 38%, 100% 100%, 0 100%);
  border-radius: 0 0 14px 14px;
  z-index: 4;
  box-shadow: inset 0 -18px 20px rgba(140, 90, 40, 0.08);
}

.address {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  color: var(--ink-soft);
}

.address strong {
  font-family: "Great Vibes", cursive;
  font-size: 1.85rem;
  font-weight: 400;
  color: var(--ink);
}

.seal {
  position: absolute;
  left: 50%;
  top: 96px;
  width: 62px;
  height: 62px;
  margin-left: -31px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #e86774, #b72236 58%, #8e1728 100%);
  box-shadow:
    0 8px 0 #7a1422,
    0 14px 18px rgba(120, 20, 40, 0.28),
    inset 0 2px 8px rgba(255, 255, 255, 0.25);
  z-index: 6;
  display: grid;
  place-items: center;
  animation: pulse 2.2s ease-in-out infinite;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.seal-heart {
  color: #fff5f4;
  font-size: 1.45rem;
  transform: translateY(1px);
}

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

.envelope.open .letter-peek {
  transform: translateY(-108px);
}

.envelope.open .seal {
  opacity: 0;
  transform: scale(0.6);
  animation: none;
}

.hint {
  margin: 28px 0 0;
  color: var(--rose-dark);
  font-weight: 600;
  animation: bob 1.8s ease-in-out infinite;
}

.letter-scene {
  display: none;
  width: min(560px, calc(100% - 28px));
  margin: 0 auto;
  padding: calc(28px + var(--safe-top)) 0 calc(160px + var(--safe-bottom));
  animation: rise 0.9s ease both;
}

.letter-scene.is-visible {
  display: block;
}

.paper {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 18%),
    repeating-linear-gradient(
      180deg,
      var(--paper) 0 38px,
      #fff6ea 38px 39px
    );
  border-radius: 18px 22px 16px 20px;
  padding: 34px 24px 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.65);
  transform: rotate(-0.6deg);
}

.paper::before,
.paper::after {
  content: "";
  position: absolute;
  background: #f4e4cf;
}

.paper::before {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  top: 16px;
  left: 16px;
  box-shadow: inset 0 0 0 5px #d9b48a;
}

.pressed-flower {
  position: absolute;
  top: -18px;
  right: -8px;
  left: auto;
  width: 72px;
  height: 72px;
  transform: rotate(18deg);
  filter: drop-shadow(0 8px 8px rgba(140, 70, 80, 0.16));
}

.pressed-flower svg {
  width: 100%;
  height: 100%;
}

.paper-date {
  margin: 0 0 18px;
  padding-right: 40px;
  color: var(--rose);
  font-size: 0.92rem;
  font-weight: 600;
}

.paper-hello {
  margin: 0 0 18px;
  font-family: "Great Vibes", cursive;
  font-size: 2.6rem;
  font-weight: 400;
  color: var(--rose-dark);
}

.paper-body {
  font-family: "Lora", serif;
  font-size: 1.12rem;
  line-height: 1.85;
  color: var(--ink);
}

.paper-body p {
  margin: 0 0 0.85em;
}

.paper-body .emphasis {
  font-family: "Great Vibes", cursive;
  font-size: 2.6rem;
  color: var(--rose-dark);
  line-height: 1.2;
  margin: 0.25em 0 0.55em;
  text-align: center;
}

.darija {
  font-style: italic;
  color: var(--rose-dark);
  font-weight: 600;
}

.cuz {
  margin: 1.1em 0 0.35em;
  font-family: "Great Vibes", cursive;
  font-size: 2.3rem;
  color: var(--rose-dark);
  text-align: center;
}

.because {
  list-style: none;
  margin: 0 0 0.4em;
  padding: 8px 0 4px;
  text-align: center;
}

.because li {
  position: relative;
  padding: 0.28em 0;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.because li::before {
  content: "♡";
  margin-right: 8px;
  color: var(--rose);
  font-weight: 400;
}

.sign-off {
  margin: 22px 0 0;
  font-family: "Great Vibes", cursive;
  font-size: 2.1rem;
  color: var(--rose-dark);
}

.closing-love {
  margin: 28px 0 12px;
  text-align: center;
  font-family: "Great Vibes", cursive;
  font-size: clamp(2.4rem, 10vw, 3.6rem);
  color: var(--rose-dark);
  line-height: 1.25;
}

.music-btn {
  position: fixed;
  z-index: 8;
  right: 16px;
  left: auto;
  bottom: calc(16px + var(--safe-bottom));
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 249, 244, 0.94);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(120, 50, 60, 0.16);
  backdrop-filter: blur(10px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.music-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--rose);
  color: white;
}

.music-btn.is-muted .music-icon {
  background: #c7b1ad;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 720px) {
  .paper {
    padding: 42px 40px 34px;
  }

  .flower {
    width: 110px;
    height: 110px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
