/* 🔴 BLOCCA LO SCROLL QUANDO LA BUSTA È ATTIVA */
body.epp-freeze {
  overflow: hidden;
}

/* OVERLAY */
#epp-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent; /* background sarà impostato dal JS */
}

/* CONTENITORE BUSTA */
#epp-envelope {
  position: relative;
  width: min(820px, 94vw);
  aspect-ratio: 1024/768;
  cursor: pointer;
  z-index: 10;
}

/* BUSTA SOPRA L'ANTEPRIMA */
#epp-envelope::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url('busta.png') center/contain no-repeat;
  z-index: 3;
  pointer-events: none;
}

/* ANTEPRIMA DELLA PAGINA (SOTTO LA BUSTA) */
#epp-preview {
  position: absolute;
  top: 15%;                  /* offset verticale iniziale */
  left: 70.5%;               /* offset orizzontale iniziale */
  width: 633px;               /* larghezza del foglio trasparente */
  height: 900px;              /* altezza del foglio trasparente */
  overflow: hidden;           /* ritaglia tutto fuori dal foglio */
  z-index: 2;                 /* sotto la busta */
  background: transparent;    /* solo contenuto, no sfondo */
  transform-origin: top left; /* necessario per il JS */
  pointer-events: none;       /* blocca interazioni finché non clicchi */
}

/* CONTENUTO DELL’ANTEPRIMA */
#epp-preview iframe,
#epp-preview > div {
  width: 100%;
  height: 100%;
  border: 0;
  filter: none !important;
  overflow: hidden;          /* blocco scroll anche interno */
}

/* MANINA PER IL TAP */
#epp-tap {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  z-index: 4;
  animation: pulse 1.4s infinite;
}

/* ANIMAZIONE PULSANTE DEL TAP */
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* EFFETTO DISSOLVE */
.epp-hide {
  opacity: 0;
  transition: opacity 0.8s ease;
}

/* RESPONSIVE: busta mantiene proporzioni, anteprima scalabile */
@media (max-width: 768px) {
  #epp-envelope {
    width: min(600px, 90vw);
    aspect-ratio: 1024/768;
	scale: 2;
  }

  /* L’anteprima verrà ridimensionata via JS in base allo scaling */
  #epp-preview {
    width: 633px; /* base rimane la stessa, JS applicherà scale */
    height: 900px;
    top: 15%;
    left: 70.5%;
	scale: 0.5;
  }
  
  #epp-tap {
    left: 48%;
}
}

#epp-tap img {
  width: 20px; /* dimensione a piacere */
  height: auto;
  display: block;
  margin: 0 auto;
  animation: tap-zoom 1s ease-in-out infinite;
}

@keyframes tap-zoom {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); } /* leggero ingrandimento */
}

@media (max-width: 480px) {
#epp-tap img {
    padding-top: 150px;
}
}