body {
  --width-evelope: 160px;
  --heght-evelope: 240px;
  --heght-evelope-flap: 100px;
  --jump-voucher: calc(var(--heght-evelope) * -0.8);
  --time-animation-open-envelope: 2s;
  --time-animation-flip-cover: calc(0.3* var(--time-animation-open-envelope));
}

.envelope {
  width: var(--width-evelope);
  height: var(--heght-evelope);
  margin-top: 54px;
  background-size: var(--width-evelope) var(--heght-evelope);
  position: relative;

  .envelope-cape {
    z-index: 1000;
    position: relative;
    width: inherit;
    height: inherit;
  }

  .envelope-cover {
    content: '';
    position: absolute;
    width: var(--width-evelope);
    height: calc(var(--heght-evelope) * 0.4);
    top: calc(var(--heght-evelope) * -0.1);
    background-color: #5f0707;
    border-radius: 8%;
  }

  .envelope-cover-img {
    position: relative;
    z-index: 1001;
    width: 100%;
    height: 100%;
  }

  .envelope-flap {
    content: '';
    position: relative;
    top: calc((-0.92 * var(--heght-evelope-flap)));
    width: calc(var(--width-evelope) * 2);
    border-top: solid var(--heght-evelope-flap) #5f0707;
    border-left: solid calc(var(--width-evelope) / 2) transparent;
    border-right: solid calc(var(--width-evelope) / 2) transparent;
    width: inherit;
    transform-origin: top;
  }


  .envelope:after {
    transform-origin: top;
  }

  .envelope-flap.is-open  {
    animation-delay: var(--time-animation-flip-cover);
    animation: open-envelope var(--time-animation-flip-cover) forwards;
  }

  .envelope-cover-img.is-open {
    animation: open-envelope-cover-img var(--time-animation-flip-cover) forwards;
  }

  .voucher {
    background-size: inherit;
    background-repeat: no-repeat;
    position: relative;
    top: calc(-1* var(--heght-evelope));
    width: inherit;
    height: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    transition: opacity 1s 0.4s, transform 1s 0.6s;
    z-index: 2;
  }

  .voucher.is-visible {
    transform: translateY(0);
    opacity: 1;
    animation: ticket-rise-and-rotate var(--time-animation-open-envelope) forwards;

  }

  .text_color {
    color: black;
    font-weight: 900;
    font-family: Verdana, Geneva, Tahoma, sans-serif;

  }

}

@keyframes open-envelope {
  0% {
    transform: rotateX(0);
  }
  20% {
    transform: rotateX(0);
  }

  100% {
    transform: rotateX(180deg);
  }
}

@keyframes open-envelope-cover-img {
  0% {
    transform-origin: top;
    transform: scaleY(1);
  }

  100% {
    transform-origin: top;
    transform: scaleY(0);
  }

}

@keyframes ticket-rise-and-rotate {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  20% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(var(--jump-voucher)) rotate(0deg);
  }

  80% {
    transform: translateY(var(--jump-voucher)) rotate(-90deg);
    z-index: 1002;
  }

  100% {
    transform: translateY(calc(0.57* var(--jump-voucher))) rotate(-90deg);
    z-index: 1002;
  }
}

@keyframes swing {

  0%,
  100% {
    transform: rotate(0deg);
  }

  25% {
    transform: rotate(3deg);
  }

  75% {
    transform: rotate(-3deg);
  }
}

.swing-fast {
  animation-name: swing;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-duration: 0.2s;
}

.swing-slow {
  animation-name: swing;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-duration: 1s;
}
