/* Common style */
.grid {
	margin: 40px auto 120px;
	max-width: 1000px;
	width: 90%;
}

.grid a {
	float: left;
	max-width: 250px;
	width: 25%;
	color: #333;
}

.grid a:nth-child(odd) {
	margin: 30px 0 -30px 0;
}

.grid figure {
	position: relative;
	overflow: hidden;
	margin: 5px;
	background: #333;
}

.grid a span {
	display: block;
	color: #fff;
	padding: 5px 45px 7px;
	font: bold 18px/24px 'Open Sans Condensed', sans-serif;
	border: 2px solid #fff;
	position: absolute;
	overflow: hidden;
	left: 50%;
	top: 50%;
	margin-top: 9px;
	z-index: 999;
	margin-left: -65px;
	transition: 0.5s ease;
	-o-transition: 0.5s ease;
	-webkit-transition: 0.5s ease;
	transform: scale(0);
    -webkit-transform: scale(0);
    -o-transform: scale(0);
    -moz-transform: scale(0);
    -ms-transform: scale(0);
}

.grid a:hover span {
	transform: scale(1);
    -webkit-transform: scale(1);
    -o-transform: scale(1);
    -moz-transform: scale(1);
    -ms-transform: scale(1);
}


.grid figure img {
	position: relative;
	display: block;
	width: 100%;
	opacity: 0.7;
	-webkit-transition: opacity 0.3s;
	transition: opacity 0.3s;
}

.grid figcaption {
	position: absolute;
	top: 0;
	z-index: 11;
	padding: 10px;
	width: 100%;
	height: 100%;
	text-align: center;
}

.grid figcaption h2 {
	margin: 0 0 20px 0;
	color: #3498db;
	text-transform: uppercase;
	letter-spacing: 1px;
	font-weight: 300;
	font-size: 130%;
	-webkit-transition: -webkit-transform 0.3s;
	transition: transform 0.3s;
}

.grid figcaption p {
	padding: 0 20px;
	color: #aaa;
	font-weight: 300;
	-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
	transition: opacity 0.3s, transform 0.3s;
}

.grid figcaption h2,
.grid figcaption p {
	-webkit-transform: translateY(50px);
	transform: translateY(50px);
}

.grid figure button {
	position: absolute;
	padding: 4px 20px;
	border: none;
	text-transform: uppercase;
	letter-spacing: 1px;
	font-weight: bold;
	-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
	transition: opacity 0.3s, transform 0.3s;
}

.grid figcaption,
.grid figcaption h2,
.grid figcaption p,
.grid figure button {
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

/* Style for SVG */
.grid svg {
	position: absolute;
	top: -1px; /* fixes rendering issue in FF */
	z-index: 10;
	width: 100%;
	height: 100%;
}

.grid svg path {
	fill: #fff;
}

/* Hover effects */
.grid a:hover figure img {
	opacity: 1;
}

.grid a:hover figcaption h2,
.grid a:hover figcaption p {
	-webkit-transform: translateY(0);
	transform: translateY(0);
}

.grid a:hover figcaption p {
	opacity: 0;
}

.clearfix:before,
.clearfix:after {
	content: " ";
	display: table;
}
 
.clearfix:after {
	clear: both;
}

/* Media Queries */
/* Let's redefine the width of each anchor and the margins */

@media screen and (max-width: 58em) {
	.grid a {
		width: 33.333%;
	}

	.grid a:nth-child(odd) {
		margin: 0;
	}

	.grid a:nth-child(3n-1) {
		margin: 30px 0 -30px 0;
	}
}

@media screen and (max-width: 45em) {
	.grid {
		max-width: 500px;
	}

	.grid a {
		width: 50%;
	}

	.grid a:nth-child(3n-1) {
		margin: 0;
	}

	.grid a:nth-child(even) {
		margin: 30px 0 -0px 0;
	}


	.grid figcaption h2 {
		margin-bottom: 0px;
		-webkit-transform: translateY(30px);
		transform: translateY(30px);
	}

	.grid figcaption p {
		margin: 0;
		padding: 0 10px;
	}
}

@media screen and (max-width: 27em) {
	.grid {
		max-width: 250px;
	}

	.grid a {
		width: 100%;
	}

	.grid a:nth-child(even) {
		margin: 0;
	}
}