/**
 * Cassette Tape UI Prototype (09/2012)
 * ALPHA build / experimental state, unsupported; use at own risk
 * Requires CSS3 border-radius + <canvas> support
 * --------------------------------------------------
 * http://www.schillmania.com/projects/soundmanager2/
 *
 * Tape UI elements (spokes, reels, textures) by Brian Scates
 * http://sxates.com/
 */

html {
 position: relative;
 width: 100%;
 height: 100%;
 /* prevent scrollbars within the draggable case. */
 overflow: hidden;
 background: #000 url(../image/demo_backgrounds/sfatnight_1600.jpg) no-repeat 0px 0px;
}

body {
 color: #fff;
}

.tape.draggable {
 position: absolute;
 display: inline-block;
 margin: 0px;
 box-shadow: 0px 0px 16px rgba(0,0,0,0.1);
 border-color: rgba(0,0,0,0.25);
 background: transparent;
 border: 1px solid rgba(0,0,0,0.1);
}

.tape.draggable .rail-left,
.tape.draggable .rail-right {
 /* hack: would reuse metal texture, but not dark enough due to dynamically-applied gradient. */
 display: none;
}

.tape.draggable .reel-mask {
 background-color: rgba(255,255,255,0.1);
 background-color: transparent;
}

.tape.draggable .blur-image-wrapper {
 position: absolute;
 left: 0px;
 top: 0px;
 width: 100%;
 border-radius: 12px;
 overflow: hidden;
 z-index: -1;
}

.tape.draggable .blur-image {
 position: absolute;
 left: 0px;
 top: 0px;
 width: 100%;
 height: 100%;
 border-radius: 12px;
 /* hack for now */
 margin-left: 100%;
 margin-right: 100%;
}

.tape.draggable .transparency-sheet {
 /* wash out everything slightly */
 position: absolute;
 left: 0px;
 top: 0px;
 width: 100%;
 background: rgba(255,255,255,0.25);
 border-radius: 12px;
}

.tape.draggable .blur-image-wrapper,
.tape.draggable .transparency-sheet {
 /* fade and blur, same height */
 height: 81%;
}

.tape.draggable .tape-shell {
 background: transparent url(../image/ma-r90-metal-pattern-v2.png);
 background-size: normal;
}

.tape.draggable .tape-gradient {
 background: transparent url(../image/gradient.png) no-repeat 0px 0px;
 /* TODO: use a native CSS gradient. Save 2 KB image request, but maybe slower to draw? */
 /* display: none; */
}

.tape.draggable .tape-shell,
.tape.draggable .tape-gradient {
 position: absolute;
 left: 0px;
 top: 0px;
 width: 100%;
 height: 100%;
 border-radius: 12px;
 /**
  * TODO: consider using webkit-mask-box-image where supported, and canvas otherwise?
  */
 /*
 -webkit-mask-box-image: url(../image/ma-r90-mask.png);
 -moz-mask-image: url(../image/ma-r90-mask.png);
 -moz-mask-image: -moz-linear-gradient(bottom, rgba(255,0,0,1), rgba(0,255,0,1), rgba(0,0,255,0), rgba(128,0,128,0));
 -moz-mask-size: 480px 300px;
 */
}

.tape.draggable .tape-pad-holder {
 background: transparent;
 bottom: 0px;
 height: 7px;
}

.tape.draggable .tape-pad {
 background: rgba(96,48,0,0.9);
 height: 100%;
 top: -1px;
}

.tape.draggable .tape-pad-line {
 display: block;
 border-top: 1px solid rgba(64,32,0,0.5);
 bottom: auto;
 top: 0px;
 margin-left: -46%;
 width: 188%;
}

.tape.draggable .controls {
 top: 0px;
}

/* a few loading transition bits */

.tape.draggable {
 opacity: 0;
}

.tape.draggable.ready {
 opacity: 1;
}

.tape.draggable.dropin {
 animation: dropin 0.75s;
}

@keyframes dropin {
 0% {
  opacity: 0;
  transform: scale3d(2, 2, 1);
  animation-timing-function: ease-out;
 }
 33% {
  opacity: 0.5;
  transform: scale3d(0.85, 0.85, 1);
  animation-timing-function: ease-in-out;
 }
 55% {
  opacity: 1;
  transform: scale3d(1.05, 1.05, 1);
  animation-timing-function: ease-in-out;
 }
 77% {
  opacity: 1;
  transform: scale3d(0.98, 0.98, 1);
  animation-timing-function: ease-in-out;
 }
 100% {
  opacity: 1;
  transform: scale3d(1, 1, 1);
  animation-timing-function: ease-in-out;
 }
}

.tape.draggable .blur-image-wrapper {
 opacity: 0;
 transition: opacity 0.1s ease-out;
}

.tape.draggable.ready .blur-image-wrapper {
 opacity: 1;
}

.tape.draggable {
 transform: scale3d(1, 1, 1);
}

.tape.draggable.dragging {
 transition: transform 0.1s ease-out; /* slight pick-up effect */
 transform: scale3d(1.025, 1.025, 1);
}

.tape.draggable.dropping {
 animation: dragdrop 0.5s;
}

@keyframes dragdrop {
 0% {
  transform: scale3d(1.025, 1,025, 1);
  animation-timing-function: ease-in-out;
 }
 33% {
  transform: scale3d(0.99, 0.99, 1);
  animation-timing-function: ease-in-out;
 }
 55% {
  transform: scale3d(1.005, 1.005, 1);
  animation-timing-function: ease-in-out;
 }
 77% {
  transform: scale3d(0.997, 0.997, 1);
  animation-timing-function: ease-in-out;
 }
 100% {
  transform: scale3d(1, 1, 1);
  animation-timing-function: ease-in-out;
 }
}