// NECESSARY
 
[data-accordion-element-content] {
  height: auto;
  overflow: hidden;
  transition: height .5s;
}

// JUST TO STYLE THIS PEN

* {
  box-sizing: border-box;
}



.card {
  border-radius: 2px;
  background: white;
}
  
.card article {
    margin-bottom: 20px;
    position: relative;
    transition: all .3s;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
  
  &.selected {
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(2, 2, 2, 0.4);
    z-index: 2;
  } 
}
  
.card h4 {
  margin-bottom: 0px;
  position: relative;
  color: #fff;
  overflow: hidden;
  transition: background .3s;
    color: #000;
    display: block;
    font-weight: 600;
    padding: 10px 40px 10px 15px;
    text-decoration: none;
    background: #fff;
    line-height: 25px;
    font-size: 16px;
  
  &:hover,
  .selected & {
    cursor: pointer;
    background: #3949AB;
  }

  &:before,
  &:after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    margin-top: -1px;
    margin-right: 30px;
    width: 20px;
    height: 2px;
    background: #fff;
    transition: transform .3s;
  }

  &:before {
    transform: rotate(0deg);
    animation: close-line-one-in .8s forwards;
    
    .selected & {
      animation: close-line-one-out .8s forwards;
    }
  }
  
  &:after {
    transform: rotate(90deg);
    animation: close-line-two-in .8s forwards;
    
    .selected & {
      animation: close-line-two-out .8s forwards;  
    }
  }

}

.card .content {  
  opacity: 0;
  transform: translateY(20px);
  transition: all ease-out .4s .1s;
  
  .selected & {
    transform: translateY(0);
    opacity: 1;
  }
}

.card p {
  padding: 0px 15px 15px;
  background: #fff;
  font-size: 16px;
  line-height: 24px;
  color: #000;
  box-shadow: 0 5px 3px rgba(0, 0, 0, 0.15)
}


@keyframes close-line-one-out {
    0%, 50% {
      transform: translateX(0);
    }
    75% { 
      transform: translateX(50px);
    }
    76% { 
      transform: translateX(50px) translateY(50px);
    }
    100% { 
      transform: rotate(45deg);
    }
}

@keyframes close-line-one-in {
    0%, 20% {
      transform: rotate(45deg);
    }
    60% { 
      transform: translateX(50px) translateY(50px) rotate(45deg);
    }
    61% { 
      transform: translateX(50px);
    }
    100% { 
      transform: rotate(0deg);
    }
}

@keyframes close-line-two-out {
    0%, 50% { 
      transform: rotate(90deg);
    }
    75% { 
      transform: translateY(-50px) rotate(90deg);
    }
    76% {
      transform: translateY(-50px) translateX(50px) rotate(90deg);
    }
    100% { 
      transform: rotate(135deg);
    }
}

@keyframes close-line-two-in {
    0% { 
      transform: rotate(135deg);
    }
    50% { 
      transform: translateY(-50px) translateX(50px) rotate(135deg);
    }
    51% { 
      transform: translateY(-50px) rotate(90deg);
    }
    100% { 
      transform: rotate(90deg);
    }
}


.selected .content{
  opacity: 1;
  margin-bottom: 40px !important;
}
.card .selected h4 {
    margin-bottom: 0px;
    border-bottom: 1px solid #ddd;
}
.card h4:before {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
    -webkit-animation: close-line-one-in .8s forwards;
    animation: close-line-one-in .8s forwards;
}
.card .selected h4:before {
    -webkit-animation: close-line-one-out .8s forwards;
    animation: close-line-one-out .8s forwards;
}
.card .selected h4:after {
    -webkit-animation: close-line-two-out .8s forwards;
    animation: close-line-two-out .8s forwards;
}
.card h4:after {
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
    -webkit-animation: close-line-two-in .8s forwards;
    animation: close-line-two-in .8s forwards;
}
.card h4:before, .card h4:after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    margin-top: -1px;
    margin-right: 15px;
    width: 14px;
    height: 2px;
    background: #666;
    transition: -webkit-transform .3s;
    transition: transform .3s;
    transition: transform .3s, -webkit-transform .3s;
}
