@charset "utf-8";
.gallery {
	text-align: center;
	color: #333;
}
.gallery div {
	display: inline-block;
	position: relative;
	margin: 3px 5px;
	width: 32%;
	max-width: 640px;
	text-align: center;
	padding: 0;
}
.gallery div:nth-child(3n+1) {
	margin-left: 0;
}
.gallery div:nth-child(3n+3) {
	margin-right: 5px;
}
.gallery h4 {
	position: absolute;
	left: 1px;
	bottom: 5px;	/* 7px */
	width: 100%;
	max-width: 640px;
	padding-top: 2px;
	font-size: 1.2em;
	text-align: center;
	background-color: rgba(255,255,255,.7);
	transition: color,background-color .3s ease-out;
}
.gallery div:hover h4 {	/* transition to white on black */
	color: rgb(253,250,240);
	background-color: rgba(0,0,0,.6);
}
.gallery div a {
	text-decoration: none;
	color: #333;
}
.gallery img {
	width: 100%;
	height: 100%;
	max-width: 640px;
	border: 1px solid #777;
	box-shadow: 1px 1px 6px rgba(0,0,0,.3);
}

@media (max-width: 1023px) {
	.gallery {
		margin-left: -3px;
		margin-right: -4px;
	}
	.gallery div {
		margin: 3px 4px;
		width: 31.5%;
	}
}
@media (max-width: 669px) {	/* 640 */
	.gallery {
		margin-top: 15px;
	}
	.gallery div {
		margin: 1px 3px;
		width: 30%;
	}
	.gallery h4 {
		font-size: 0.75em;
	}
}
@media (max-width: 379px) {
	.gallery h4 {
		font-size: 0.64em;
	}
}
@media (max-width: 334px) {
	.gallery div {
		margin: 0 1px;
	}
	.gallery h4 {
		font-size: 0.60em;
	}
}
@media (max-width: 319px) {
	.gallery h4 {
		font-size: 0.46em;
	}
}
@media (max-height: 399px) {	/* landscape */
	.gallery {
		margin-top: 0;
	}
}
