* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #8b9150; display: grid; place-items: center; }

.stage{
  position: relative;
  width: min(900px, 96vw);
  aspect-ratio: 1428 / 2000; /* matches your image proportions */
  overflow: hidden;
  border-radius: 10px;
}

/* final board image */
.board{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit: cover;
}

/* overlay layer */
.layer{
  position:absolute; inset:0;
  pointer-events: none; /* allow hotspots to still work (they re-enable pointer-events) */
}

/* --- ENVELOPE (simple CSS version) --- */
/* Place this envelope exactly where it is in the image (tweak % if needed) */
.envelope{
  cursor: pointer;
}

/* Open me text */
.open-label{
  position:absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  font-family: "Georgia", "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(14px, 1.8vw, 20px);
  letter-spacing: .4px;
  color: rgba(0,0,0,.65);
  pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
}

/* subtle hover hint (desktop only) */
@media (hover: hover){
  .envelope:hover .open-label{
    transform: translateX(-50%) translateY(-2px);
    opacity: .85;
  }
}

/* once opened, hide the label */
.layer.play .open-label{
  opacity: 0;
}


/* body */
.env-body{
  position:absolute; inset: 18% 8% 8% 8%;
  background: #f3f3f3;
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
}

/* liner (the floral inside) */
.env-liner{
  position:absolute; left: 18%; right: 18%; top: 5%; height: 48%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.8), rgba(0,0,0,0)),
              linear-gradient(135deg, #8ca06d, #d2d8a1);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  border-radius: 8px;
  opacity: .9;
}

/* flap */
.env-flap{
  position:absolute; left: 8%; right: 8%; top: 18%; height: 38%;
  background: #ececec;
  clip-path: polygon(0 0, 50% 70%, 100% 0, 100% 100%, 0 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  border-radius: 10px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.08);
}

/* when opened */
.layer.play .env-flap{
  animation: flapOpen 900ms cubic-bezier(.2,.9,.2,1) 650ms forwards;
}

/* --- FALLING PIECES --- */
/* These are placeholders (simple cards). Later we swap them to PNG cutouts. */
.piece{
  position:absolute;
  opacity: 0;
  transform: translateY(-40px) rotate(-2deg);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}

/* date card target area (tweak as needed) */
.date-card{
  left: 62%;
  top: 30%;
  width: 26%;
  height: 28%;
  background: #efe9dd;
  z-index: 6;
}

/* monogram card target area (tweak as needed) */
.monogram-card{
  left: 18%;
  top: 33%;
  width: 30%;
  height: 26%;
  background: #efe9dd;
  z-index: 5;
}

/* trigger fall animations */
.layer.play .date-card{
  animation: fallIn 900ms cubic-bezier(.2,.9,.2,1) 1100ms forwards;
}
.layer.play .monogram-card{
  animation: fallIn2 980ms cubic-bezier(.2,.9,.2,1) 1250ms forwards;
}

/* --- CLICKABLE HOTSPOTS (invisible) --- */
.hotspot{
  position:absolute;
  pointer-events: auto;  /* re-enable clicks */
  background: rgba(255,255,255,0); /* invisible */
}

/* Q&A circle location */
.hotspot-qa{
  left: 6%;
  top: 50%;
  width: 30%;
  height: 18%;
  border-radius: 50%;
}

/* RSVP card location */
.hotspot-rsvp{
  left: 12%;
  top: 62%;
  width: 56%;
  height: 18%;
}

/* --- KEYFRAMES --- */
@keyframes envDrop{
  0% { transform: translateY(-14%); }
  100% { transform: translateY(0%); }
}

@keyframes flapOpen{
  0% { transform: rotateX(0deg); }
  100% { transform: rotateX(180deg); }
}

@keyframes fallIn{
  0% { opacity:0; transform: translateY(-55px) rotate(2deg) scale(.98); }
  100% { opacity:1; transform: translateY(0) rotate(0deg) scale(1); }
}

@keyframes fallIn2{
  0% { opacity:0; transform: translateY(-65px) rotate(-3deg) scale(.98); }
  100% { opacity:1; transform: translateY(0) rotate(0deg) scale(1); }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce){
  .envelope, .env-flap, .piece { animation: none !important; opacity: 1; transform: none; }
}
