* {
    box-sizing: border-box;
}

#wrapper {
    width: 400px;
    margin: 0 auto;
}

.envelope {
    width: 200px;
    height: 100px;
    margin: 130px auto 0;
    background: #ddd;
    box-shadow: 0 0 1px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.25);
    position: relative;
    perspective: 800px;
}

.envelope:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border: 0 solid rgba(0,0,0,0.25);
    border-width: 45px 100px;
    border-top-color: transparent;
    z-index: 2;
}

.envelope .flap {
    position: absolute;
    width: 100%;
    height: 0;
    border: 0 solid transparent;
    border-width: 50px 100px;
    z-index: 3;
}

.envelope .flap.front {
    border-left-color: #eee;
    border-right-color: #eee;
    border-bottom-color: #ccc;
    z-index: 3;
}

.envelope .flap.front:after {
    content: '';
    width: 100%;
    height: 0;
    position: absolute;
    left: -100px;
    bottom: -50px;
    border: 0 solid transparent;
    border-width: 49px 100px;
    border-bottom-color: #eee;
}

.envelope .flap.top {
    border-top-width: 55px;
    border-top-color: #aaa;
    z-index: 3;
    animation-duration: 1s;
    animation-fill-mode: forwards;
    -webkit-transform-origin-y: top;
    transform-origin-y: top;
    perspective: 800;
    transform-style: preserve-3d;
}

.envelope.open .flap.top {
    animation-name: flip;
}

.envelope .flap.top:after {
    content: '';
    position: absolute;
    left: -100px; /* border-left-width */
    top: -55px; /* border-top-width */
    width: 100%;
    height: 0;
    border: 0 solid transparent;
    border-width: 54px 100px;
    border-top-color: #eee;
}

.envelope .letter {
    position: absolute;
    width: 194px;
    height: 84px;
    background: #fff;
    top: 8px;
    left: 3px;
    border: 1px solid #ccc;
    z-index: 1;
    animation-duration: 2s;
    animation-delay: 1.5s;
    animation-fill-mode: forwards;
    transform-style: preserve-3d;
}

.envelope.open .letter {
    animation-name: remove;
}

.envelope .letter:before,
.envelope .letter:after {
    content: '';
    position: absolute;
    width: 192px;
    height: 75%;
    left: -1px;
    background: #fff;
    border: 1px solid #ccc;
    animation-duration: 1s;
    animation-delay: 4s;
    animation-fill-mode: forwards;
    -webkit-transform-origin-y: top;
    transform-origin-y: top;
    transform-style: preserve-3d;
    transform: rotateX(10deg);
}

.envelope .letter:before {
    z-index: 1;
}

.envelope.open .letter:before {
    animation-name: fold-up;
}

.envelope .letter:after {
    animation-delay: 5s;
    animation-fill-mode: forwards;
    -webkit-transform-origin-y: bottom;
    transform-origin-y: bottom;
    transform: rotateX(-5deg);
    bottom: 0;
}

.envelope.open .letter:after {
    animation-name: fold-down;
}

@keyframes flip {
    100% {
        transform: rotateX(180deg);
        z-index: 1;
    }
}

@keyframes remove {
    50% {
        top: -120px;
    }

    100% {
        top: 8px;
        z-index: 3;
    }
}

@keyframes fold-up {
    from {

    }

    to {
        transform: rotateX(140deg);
    }
}

@keyframes fold-down {
    from {

    }

    to {
        transform: rotateX(-140deg);
    }
}

/** My CSS Below **/
.hidden {
    display: none;
}

.centered {
    text-align: center;
}

p.message {
    display: block;
    font-family: Consolas, monospace;
    padding-left: 5px;
}

p.signature {
    display: block;
    text-align: right;
    font-family: Consolas, monospace;
    padding-right: 20px;
}

#mailbag {
    margin-top: 200px;
    position: relative;
    z-index: 999;
}

#mailbtn {
	display: inline-block;
	text-decoration: none;
	color: #fff;
	font-weight: bold;
	background-color: #538fbe;
	padding: 20px 70px;
	font-size: 24px;
	border: 1px solid #2d6898;
	background-image: linear-gradient(bottom, rgb(73,132,180) 0%, rgb(97,155,203) 100%);
	background-image: -o-linear-gradient(bottom, rgb(73,132,180) 0%, rgb(97,155,203) 100%);
	background-image: -moz-linear-gradient(bottom, rgb(73,132,180) 0%, rgb(97,155,203) 100%);
	background-image: -webkit-linear-gradient(bottom, rgb(73,132,180) 0%, rgb(97,155,203) 100%);
	background-image: -ms-linear-gradient(bottom, rgb(73,132,180) 0%, rgb(97,155,203) 100%);

	background-image: -webkit-gradient(
		linear,
		left bottom,
		left top,
		color-stop(0, rgb(73,132,180)),
		color-stop(1, rgb(97,155,203))
	);
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	text-shadow: 0px -1px 0px rgba(0,0,0,.5);
	-webkit-box-shadow: 0px 6px 0px #2b638f, 0px 3px 15px rgba(0,0,0,.4), inset 0px 1px 0px rgba(255,255,255,.3), inset 0px 0px 3px rgba(255,255,255,.5);
	-moz-box-shadow: 0px 6px 0px #2b638f, 0px 3px 15px rgba(0,0,0,.4), inset 0px 1px 0px rgba(255,255,255,.3), inset 0px 0px 3px rgba(255,255,255,.5);
	box-shadow: 0px 6px 0px #2b638f, 0px 3px 15px rgba(0,0,0,.4), inset 0px 1px 0px rgba(255,255,255,.3), inset 0px 0px 3px rgba(255,255,255,.5);
	-webkit-transition: all .1s ease-in-out;
	-moz-transition: all .2s ease-in-out;
	transition: all .2s ease-in-out;
	-webkit-transform: rotateX(20deg);
}

#mailbtn.btn-disabled {
    color: #ccc;
}

#mailbtn:hover:not(.btn-disabled) {
	background-image: linear-gradient(bottom, rgb(79,142,191) 0%, rgb(102,166,214) 100%);
	background-image: -o-linear-gradient(bottom, rgb(79,142,191) 0%, rgb(102,166,214) 100%);
	background-image: -moz-linear-gradient(bottom, rgb(79,142,191) 0%, rgb(102,166,214) 100%);
	background-image: -webkit-linear-gradient(bottom, rgb(79,142,191) 0%, rgb(102,166,214) 100%);
	background-image: -ms-linear-gradient(bottom, rgb(79,142,191) 0%, rgb(102,166,214) 100%);

    cursor: pointer;

	background-image: -webkit-gradient(
		linear,
		left bottom,
		left top,
		color-stop(0, rgb(79,142,191)),
		color-stop(1, rgb(102,166,214))
	);
}

#mailbtn:active:not(.btn-disabled) {
-webkit-box-shadow: 0px 2px 0px #2b638f, 0px 1px 6px rgba(0,0,0,.4), inset 0px 1px 0px rgba(255,255,255,.3), inset 0px 0px 3px rgba(255,255,255,.5);
-moz-box-shadow: 0px 2px 0px #2b638f, 0px 1px 6px rgba(0,0,0,.4), inset 0px 1px 0px rgba(255,255,255,.3), inset 0px 0px 3px rgba(255,255,255,.5);
box-shadow: 0px 2px 0px #2b638f, 0px 1px 6px rgba(0,0,0,.4), inset 0px 1px 0px rgba(255,255,255,.3), inset 0px 0px 3px rgba(255,255,255,.5);
	background-image: linear-gradient(bottom, rgb(88,154,204) 0%, rgb(90,150,199) 100%);
	background-image: -o-linear-gradient(bottom, rgb(88,154,204) 0%, rgb(90,150,199) 100%);
	background-image: -moz-linear-gradient(bottom, rgb(88,154,204) 0%, rgb(90,150,199) 100%);
	background-image: -webkit-linear-gradient(bottom, rgb(88,154,204) 0%, rgb(90,150,199) 100%);
	background-image: -ms-linear-gradient(bottom, rgb(88,154,204) 0%, rgb(90,150,199) 100%);

	background-image: -webkit-gradient(
		linear,
		left bottom,
		left top,
		color-stop(0, rgb(88,154,204)),
		color-stop(1, rgb(90,150,199))
	);
    -webkit-transform: translate(0, 4px) rotateX(20deg);
    -moz-transform: translate(0, 4px);
    transform: translate(0, 4px);
}
