/**
 * Styles for Jetpack related posts
 */

/* Container */

div.jp-relatedposts {
	display: none;
	padding-top: 1em;
	margin: 1em 0;
	position: relative;
}

div.jp-relatedposts:after {
	content: '';
	display: block;
	clear: both;
}

/* Headline above related posts section, labeled "Related" */

div.jp-relatedposts .jp-relatedposts-headline {
	margin: 0 0 1em 0;
	display: inline-block;
	float: left;
	font-size: 9pt;
	font-weight: bold;
	font-family: inherit;
}

div.jp-relatedposts .jp-relatedposts-headline em:before {
	content: "";
	display: block;
	width: 100%;
	min-width: 30px;
	border-top: 1px solid #ddd;
	border-top: 1px solid rgba(0,0,0,.2);
	margin-bottom: 1em;
}

div.jp-relatedposts .jp-relatedposts-headline em {
	font-style: normal;
	font-weight: bold;
}

/* Related posts items (wrapping items) */

div.jp-relatedposts .jp-relatedposts-items {
	clear: left;
}

div.jp-relatedposts-items-visual {
	margin-right: -20px;
}

/* Related posts item */

div.jp-relatedposts .jp-relatedposts-post {
	float: left;
	width: 33%;
	margin: 0 0 1em; /* Needs to be same as the main outer wrapper for Related Posts */
	box-sizing: border-box;
	-moz-box-sizing:border-box;
	-webkit-box-sizing:border-box;
}

div.jp-relatedposts-items-visual .jp-relatedposts-post {
	padding-right: 20px;
	/*cursor: pointer;*/
	filter: alpha(opacity=80);
	-moz-opacity: .8;
	opacity: .8;
}

div.jp-relatedposts .jp-relatedposts-post:hover .jp-relatedposts-post-title a {
	text-decoration: underline;
}

div.jp-relatedposts .jp-relatedposts-post:hover {
	filter:alpha(opacity=100);
	-moz-opacity: 1;
	opacity: 1;
}

/* Related posts item content */

div.jp-relatedposts-items-visual h4.jp-relatedposts-post-title,
div.jp-relatedposts p {
	font-size: 14px;
	line-height: 20px;
	margin: 0;
}

div.jp-relatedposts p {
	margin-bottom: 0;
}

div.jp-relatedposts-items-visual h4.jp-relatedposts-post-title {
	text-transform: none;
	margin: 0;
	font-family: inherit;
	display: block;
	max-width: 100%;
}

div.jp-relatedposts .jp-relatedposts-post .jp-relatedposts-post-title a {
	font-weight: normal;
	text-decoration: none;
	filter: alpha(opacity=100);
	-moz-opacity: 1;
	opacity: 1;
}

div.jp-relatedposts .jp-relatedposts-post .jp-relatedposts-post-title a:hover {
	text-decoration: underline;
}

/* Don't let thumbnails get too tall and account for portrait pics
	Todo: replace with single class for the thumbnail anchor only
	 */

div.jp-relatedposts .jp-relatedposts-post > .jp-relatedposts-post-thumb-wrapper:first-child {
	display: block;
	max-height: 96px;
	overflow: hidden;
	margin: 0 0 4px;
	-moz-box-shadow: 0 1px 2px #d9d9d9;
	-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
	-o-box-shadow: 0 1px 2px #d9d9d9;
	-o-box-shadow: 0 1px 2px rgba(0,0,0,.15);
	-webkit-box-shadow: 0 1px 2px #d9d9d9;
	-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
	-ms-box-shadow: 0 1px 2px #d9d9d9;
	-ms-box-shadow: 0 1px 2px rgba(0,0,0,.15);
	box-shadow: 0 1px 2px #d9d9d9;
	box-shadow: 0 1px 2px rgba(0,0,0,.15);
	background: #eee; /* For overflow in the case of Y > X images, untested */
}

div.jp-relatedposts .jp-relatedposts-post img,
div.jp-relatedposts .jp-relatedposts-post span {
	display: block;
	max-width: 90%;
	overflow: hidden;
	text-overflow: ellipsis;
}

div.jp-relatedposts-items-visual .jp-relatedposts-post img,
div.jp-relatedposts-items-visual .jp-relatedposts-post span {
	max-width: 100%;
}

div.jp-relatedposts .jp-relatedposts-post .jp-relatedposts-post-context {
	opacity: .6;
}

/* Behavior when there are thumbnails in visual mode */
div.jp-relatedposts .jp-relatedposts-post-thumbs .jp-relatedposts-post-excerpt {
	display: none;
}

/* Behavior when there are no thumbnails in visual mode */
div.jp-relatedposts .jp-relatedposts-post-nothumbs .jp-relatedposts-post-excerpt {
	overflow: hidden;
}
div.jp-relatedposts .jp-relatedposts-post-nothumbs span {
	margin-bottom: 1em;
}

/**
 * Responsive
 */

@media only screen and (max-width: 640px) {

	div.jp-relatedposts .jp-relatedposts-post {
		width: 50%;
	}

	div.jp-relatedposts .jp-relatedposts-post:nth-child(3n) {
		clear: left;
	}

}

@media only screen and (max-width: 320px) {

	div.jp-relatedposts .jp-relatedposts-post {
		width: auto;
		clear: both;
		margin: 0 0 1em;
	}

}