title: How to reverse a sequence of CSS transitions and transforms which contain span:nth-child
body: <p>This CSS "animation" in essence consist of several transitions and transforms on span:nth-children which follow each other sequentially using transition delays. It works fine one way, but what is the best way to reverse the animation? Since it is a sequence the solution should reverse the entire sequence. See fiddle for example:
  <a href="http://jsfiddle.net/musicformellons/6nb0wy68/" rel="nofollow">http://jsfiddle.net/musicformellons/6nb0wy68/</a></p>
  
  <pre><code>#Pqb-icon {
    background: white;
    width: 170px;
    height: 100px;
    border-radius: 5px;  
    position: relative;
    overflow: hidden;
    border: 2px solid salmon;
    border-bottom: 20;
    -webkit-transition: .9s ease-in-out;
    -moz-transition: .9s ease-in-out;
    -o-transition: .9s ease-in-out;
    transition: .9s ease-in-out;
  }
  
  #Pqb-icon span {
    display: block;
    position: absolute;
    border: 5px solid black;
    width: 20px;
    height: 20px;
    bottom: 50px;
    left: 12%;
    background: rgba(255, 200, 220, 0.4);
    transition-timing-function: ease;
  }
  
  #Pqb-icon span:nth-child(1) {
    left: 12%;
    border-radius: 25px;
    -webkit-transform-origin: left center;
    -moz-transform-origin: left center;
    -o-transform-origin: left center;
    transform-origin: left center;
  }
  
  #Pqb-icon.open span:nth-child(1) {
    left: 12%;
    border-radius: 25px;
    -webkit-transition: .25s ease-in-out;
    -moz-transition: .25s ease-in-out;
    -o-transition: .25s ease-in-out;
    transition: .25s ease-in-out;
  }
  
  #Pqb-icon.open span:nth-child(3) {
    left: 36%;
    bottom: 50px;
    border-radius: 25px;
    -webkit-transform: translate(-40px,0px);
    -moz-transform: translate(-40px,0px);
    -o-transform: translate(-40px,0px);
    transform: translate(-40px,0px);
    -webkit-transition: .25s ease .7s;
    -moz-transition: .25s ease .7s;
    -o-transition: .25s ease .7s;
    transition: .4s ease .9s;
    opacity: 0;
  }
  
  #Pqb-icon span:nth-child(2) {
    width: 5px;    
    height: 38%;
    bottom: 27%;
    background: black;
    border: 0px solid black;
    -webkit-transform-origin: left center;
    -moz-transform-origin: left center;
    -o-transform-origin: left center;
    transform-origin: left center;
  }
  
  #Pqb-icon.open span:nth-child(2) {
    width: 5px;    
    height: 38%;
    bottom: 27%;
    background: black;
    border: 0px solid black;
    -webkit-transition: .25s ease-in-out;
    -moz-transition: .25s ease-in-out;
    -o-transition: .25s ease-in-out;
    transition: .25s ease;
  }
  
  #Pqb-icon.open span:nth-child(4) {
    width: 5px;    
    height: 38%;
    bottom: 27%;
    left: 15%;
    background: black;
    border: 0px solid black;
    -webkit-transform: rotateZ(-180deg);
    -moz-transform: rotateZ(-180deg);
    -o-transform: rotateZ(-180deg);
    transform: rotate(-180deg) ;
    -webkit-transition: .25s ease-in-out .7s;
    -moz-transition: .25s ease-in-out .7s;
    -o-transition: .25s ease-in-out .65s;
    transition: .4s ease .8s;
    opacity: 0;
  }
  
  #Pqb-icon span:nth-child(3) {
    bottom: 27%;
    left: 28.5%;
    border-radius: 25px;
    -webkit-transform-origin: left center;
    -moz-transform-origin: left center;
    -o-transform-origin: left center;
    transform-origin: left center;
  }
  
  #Pqb-icon.open span:nth-child(5) {
    bottom: 27%;
    left: 46%;
    border-radius: 25px;
    -webkit-transform: rotateZ(-180deg);
    -moz-transform: rotateZ(-180deg);
    -o-transform: rotateZ(-180deg);
    transform: rotateZ(-180deg) ;
    -webkit-transition: .35s ease-in-out;
    -moz-transition: .35s ease-in-out;
    -o-transition: .35s ease-in-out;
    transition: .4s ease .4s;
    opacity: 0;
  }
  
  #Pqb-icon span:nth-child(4) {
    width: 5px; 
    height: 32%;
    bottom: 10%;
    left: 43%;
    background: black;
    border: 0px solid black;
    -webkit-transform-origin: left center;
    -moz-transform-origin: left center;
    -o-transform-origin: left center;
    transform-origin: left center;
  }
  
  #Pqb-icon.open span:nth-child(6) {
    width: 5px; 
    height: 32%;
    bottom: 10%;
    left: 46.5%;
    background: black;
    border: 0px solid black;
    -webkit-transform: rotateZ(-180deg);
    -moz-transform: rotateZ(-180dreg);
    -o-transform: rotateZ(-180deg);
    transform: rotateZ(-180deg) ;
    -webkit-transition: .35s ease-in-out .35s;
    -moz-transition: .35s ease-in-out .35s;
    -o-transition: .35s ease-in-out .35s;
    transition: .4s ease .4s;
    opacity: 0;
  }
  
  #Pqb-icon span:nth-child(5) {
    bottom: 27%;
    left: 51%;
    border-radius: 25px;
    -webkit-transform-origin: left center;
    -moz-transform-origin: left center;
    -o-transform-origin: left center;
    transform-origin: left center;
  }
  
  #Pqb-icon span:nth-child(6) {
    width: 5px; 
    height: 35%;
    bottom: 40%;
    left: 51%;
    background: black;
    border: 0px solid black;
    -webkit-transform-origin: left center;
    -moz-transform-origin: left center;
    -o-transform-origin: left center;
    transform-origin: left center;
  }
  </code></pre>