/* ============================================================
   InviteMe-style Envelope Screen
   ============================================================ */

/* Scene: fills the full content area below the navbar */
.env-scene {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fdf8f3 0%, #f5ede3 55%, #ede0d0 100%);
  padding: 2rem 1rem;
}

/* Centered column */
.env-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

/* ---- Envelope container ---- */
.env-envelope {
  position: relative;
  width: 540px;
  height: 330px;
  cursor: pointer;
  perspective: 1200px;
  user-select: none;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.env-envelope:hover:not(.open) {
  transform: translateY(-8px);
  filter: drop-shadow(0 16px 32px rgba(120, 80, 40, 0.18));
}

/* ---- Envelope back body (base rectangle) ---- */
.env-body {
  position: absolute;
  inset: 0;
  background: #faf5ee;
  border-radius: 4px;
  box-shadow:
    0 6px 32px rgba(120, 80, 40, 0.16),
    0 2px 8px rgba(120, 80, 40, 0.10);
  z-index: 1;
}

/* ---- Side wing folds (left & right diagonal triangles) ---- */
.env-left-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: #f0e6d8;
  clip-path: polygon(0 0, 0 100%, 100% 50%);
  z-index: 2;
}

.env-right-flap {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: #f0e6d8;
  clip-path: polygon(100% 0, 100% 100%, 0 50%);
  z-index: 2;
}

/* ---- Bottom V-fold ---- */
.env-bottom-flap {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 52%;
  background: #e8ddd0;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  z-index: 3;
}

/* ---- Card (hidden inside, slides up when opened) ---- */
.env-card {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) translateY(0px);
  width: 82%;
  height: 78%;
  background: #fffcf9;
  border-radius: 3px;
  border: 1px solid #e2d4c2;
  box-shadow: 0 2px 10px rgba(120, 80, 40, 0.10);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition:
    transform 0.85s cubic-bezier(0.2, 0.85, 0.2, 1) 0.55s,
    opacity 0.6s ease 0.55s;
}

.env-card-names {
  font-family: 'Great Vibes', cursive;
  font-size: 2.7rem;
  color: #6b4c2e;
  line-height: 1;
  letter-spacing: 0.02em;
}

.env-card-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  color: #a8876a;
  letter-spacing: 0.28em;
  font-weight: 700;
  text-transform: uppercase;
}

/* ---- Opening flap (V-shape, rotates open) ---- */
.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  background: #e8ddd0;
  /* Triangular flap pointing downward */
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 4;
}

/* ---- Wax seal overlay: rotates with flap, no clip-path ---- */
.env-flap-seal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 6;
  pointer-events: none;
}

/* ---- Wax seal / monogram badge ---- */
.env-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  width: 64px;
  height: 64px;
  background: radial-gradient(circle at 38% 35%, #a07c5e 0%, #83654b 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 8px rgba(100, 60, 20, 0.35),
    0 0 0 3px rgba(200, 160, 100, 0.3);
  z-index: 5;
}

.env-seal span {
  font-family: 'Great Vibes', cursive;
  font-size: 0.85rem;
  color: #fff8ef;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ---- "Deschide invitația" label below envelope ---- */
.env-open-label {
  font-family: 'Great Vibes', cursive;
  font-size: 2.1rem;
  color: #7a5535;
  letter-spacing: 0.04em;
  background: rgba(250, 245, 238, 0.93);
  border: 1.5px solid #d4b592;
  border-radius: 100px;
  padding: 0.3em 2.6em;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(120, 80, 40, 0.12);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
  user-select: none;
}

.env-open-label:hover {
  background: rgba(250, 245, 238, 1);
  box-shadow: 0 4px 22px rgba(120, 80, 40, 0.20);
  transform: translateY(-2px);
}

/* ============================================================
   OPEN STATE
   ============================================================ */

/* Flap rotates backward (up and over) */
.env-envelope.open .env-flap {
  transform: rotateX(-180deg);
}

/* Seal overlay rotates in sync with the flap */
.env-envelope.open .env-flap-seal {
  transform: rotateX(-180deg);
}

/* Card slides up and becomes visible */
.env-envelope.open .env-card {
  transform: translateX(-50%) translateY(-72px);
  opacity: 1;
}

/* ============================================================
   EXIT ANIMATION (slide scene up off screen)
   ============================================================ */

.env-scene.exit {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100vh;
  animation: envSceneExit 1.2s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

/* Freeze the envelope's own hover/open transitions so everything moves as one */
.env-scene.exit .env-envelope {
  transition: none !important;
  transform: none !important;
}

@keyframes envSceneExit {
  0%   { opacity: 1;   transform: translateY(0);       }
  40%  { opacity: 1;   transform: translateY(-6vh);     }
  100% { opacity: 0;   transform: translateY(-105vh);   }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .env-envelope {
    width: 92vw;
    height: calc(92vw * 0.61);
  }

  .env-card-names {
    font-size: 1.9rem;
  }

  .env-card-date {
    font-size: 0.8rem;
    letter-spacing: 0.18em;
  }

  .env-seal {
    width: 52px;
    height: 52px;
  }

  .env-seal span {
    font-size: 0.75rem;
  }

  .env-open-label {
    font-size: 1.6rem;
    padding: 0.3em 1.8em;
  }

  .env-envelope.open .env-card {
    transform: translateX(-50%) translateY(-52px);
  }
}
