.reader-related-card__heading {
	color: var(--color-text-subtle);
	font-size: $font-body-small;
	font-weight: 600;
	margin-bottom: 20px;
	display: -webkit-box;
	max-height: 14px * 1.6;
	overflow: hidden;
	position: relative;
	text-transform: uppercase;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;

	&::after {
		@include long-content-fade( $size: 35px );
	}
}

.reader-related-card__link,
.reader-related-card__link:visited {
	color: var(--color-primary);
	font-family: $sans;

	&:hover,
	&:active {
		color: var(--color-text-subtle);
	}

	&:focus {
		color: var(--color-text-subtle);
	}
}

.reader-related-card__list {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;

	@include breakpoint-deprecated( ">480px" ) {
		flex-direction: row;
	}
}

.reader-related-card__list-item {
	flex: 1 1 0;
	// Ensures flex items can shrink properly and prevents overflow in flexbox layouts.
	min-width: 0;
	list-style-type: none;
	margin-top: -3px;

	&:first-child {
		margin-right: 10px;

		@include breakpoint-deprecated( "<660px" ) {
			margin-right: 10px;
		}
	}

	&:last-child {
		margin-left: 10px;

		@include breakpoint-deprecated( "<660px" ) {
			margin-left: 10px;
		}
	}

	&:first-child,
	&:last-child {
		@include breakpoint-deprecated( "<480px" ) {
			margin: 0 0 20px;
		}
	}

	&:only-child {
		margin: 0;
	}
}

// Generic recommended card styles
.reader-related-card.card.is-compact {
	box-shadow: none;
	flex: 1 1 auto;

	@include breakpoint-deprecated( "<480px" ) {
		display: flex;
		flex-direction: column;
	}
}

.reader-related-card.card {
	z-index: z-index("root", ".reader-related-card.card");
	padding: 16px;
	border-radius: 6px; /* stylelint-disable-line scales/radii */

	.reader-related-card__meta {
		display: grid;
		grid-template-columns: auto 1fr auto;
		height: 38px;
		margin-bottom: 13px;
		z-index: z-index(".reader-related-card.card", ".reader-related-card__meta");
		width: 100%;

		&:last-child {
			justify-content: flex-end;
		}
	}

	.reader-featured-image {
		position: relative;
		&::after {
			content: "";
			position: absolute;
			pointer-events: none;
			top: 0;
			left: 0;
			bottom: 0;
			right: 0;
			box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
			border-radius: 6px; /* stylelint-disable-line scales/radii */
		}

		img {
			height: 300px;
		}
	}

	.reader-related-card__meta > a {
		display: flex;
		flex: 0 0 auto;
	}

	.reader-related-card__post {
		display: block;
		overflow: hidden;

		&::after {
			@include long-content-fade( $size: 35px );
			bottom: 0;
			height: 23px;
			top: inherit;
			visibility: visible;
		}
	}

	&.has-thumbnail {
		.reader-related-card__title {
			font-size: 17px;
		}

		.reader-related-card__excerpt {
			font-size: $font-body;
		}
	}

	.reader-related-card__title {
		margin-bottom: 7px;
	}
}

.reader-related-card__blocks {
	border-top: 1px solid var(--color-neutral-10);
	margin-top: 30px;
	padding-top: 11px;

	@include breakpoint-deprecated( "<480px" ) {
		margin-top: 0;
	}

	.reader-related-card__post::after {
		@include long-content-fade( $size: 35px );
		bottom: 0;
		height: 22px;
		top: auto;
		visibility: visible;
	}

	&.is-same-site {
		.reader-related-card__meta {
			display: none !important; // Hides meta info from "More In Site"
		}

		.reader-related-card__featured-image {
			margin: 0 0 14px;
		}

		.has-thumbnail .reader-related-card__post {
			max-height: 17px * 1.6 * 4;
		}
	}

	&.is-other-site {
		.reader-related-card__post {
			max-height: 17px * 1.6 * 4;

			@include breakpoint-deprecated( ">480px" ) {
				max-height: 17px * 1.6 * 7.5;
			}
		}

		.has-thumbnail {
			.reader-related-card__post {
				max-height: 17px * 1.6 * 4;
			}
		}

		.reader-related-card__featured-image {
			margin: 0 0 14px;
		}
	}

	// Wrapper for site title and excerpt
	.reader-related-card__post {
		max-height: 17px * 1.6 * 4;
	}
}

.reader-related-card__meta .gravatar {
	height: 40px;
	margin: 5px 8px 0 0;
	vertical-align: middle;
	width: 40px;
}

.reader-related-card__byline {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	font-size: $font-body-small;
	margin-top: 4px;
	min-height: 38px;
	overflow: hidden;
	white-space: nowrap;
}

.reader-related-card__byline-site {
	font-family: $sans;
	font-weight: 600;
	overflow: hidden;
	position: relative;
	height: 20px;
	text-overflow: ellipsis;
	width: calc(100% - 25px);
	color: var(--color-primary);

	&::after {
		@include long-content-fade( $size: 10% );
	}
}

.reader-related-card__byline-author {
	cursor: pointer;
	font-size: 12px;
	margin-top: 2px;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;

	&::after {
		@include long-content-fade( $size: 10% );
	}

	a.reader-related-card__link {
		color: var(--color-neutral-40);
	}
}

.reader-related-card__featured-image {
	border: 1px solid var(--color-neutral-0);
	min-height: 78px;
}
.reader-related-card {
	.reader-related-card__link-block {
		margin-bottom: 16px;
	}
	.reader-related-card__title {
		display: -webkit-box;
		overflow: hidden;
		word-wrap: break-word;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}
}

@include breakpoint-deprecated( "<660px" ) {
	.reader-stream__recommended-posts {
		margin: 0 !important;

		.reader-stream__recommended-posts-header {
			margin: 15px;
		}
		.reader-stream__recommended-posts-list {
			margin: 0 15px;
		}
		.reader-related-card__link-block {
			margin-bottom: 0;
		}
	}
}

.reader-stream__recommended-posts {
	.reader-stream__recommended-posts-list-item {
		min-width: 250px;
		display: flex;
		flex-direction: column;

		.card.reader-related-card {
			width: 100%;
		}
	}
}

.reader-related-card__title,
.reader-related-card__excerpt {
	color: var(--color-neutral-70);
	font-family: $serif;
}

.reader-related-card__site-info {
	position: relative;
}

.reader-related-card__title {
	font-size: 17px;
	font-weight: 700;
	line-height: 25px;
	overflow: hidden;
	max-height: 16px * 1.5 * 2;
	word-wrap: break-word;

	&::after {
		@include long-content-fade( $size: 35px );
		top: 16px * 1.4;
		height: 16px * 1.4;
	}

	// Clamp to 3 lines on larger viewports
	@include breakpoint-deprecated( ">660px" ) {
		overflow: hidden;
		max-height: 17px * 1.48 * 3;
		word-wrap: break-word;

		&::after {
			@include long-content-fade( $size: 35px );
			top: 16px * 1.5 * 2;
			height: 16px * 1.5;
		}
	}
}

.reader-related-card__excerpt {
	display: -webkit-box;
	overflow: hidden;
	word-wrap: break-word;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

// Follow buttons in recommended posts
.reader-related-card__meta .follow-button {
	background: transparent;
	border: 0;
	border-radius: 0;
	margin-bottom: 12px;
	margin-top: -4px;
	padding: 0;
	z-index: z-index(".reader-related-card__meta", ".follow-button");

	.reader-follow-feed {
		fill: var(--color-primary);
	}

	@include breakpoint-deprecated( "<960px" ) {
		min-width: 20px;
	}

	.follow-button__label {
		display: none;
	}

	.gridicon {
		@include breakpoint-deprecated( "<960px" ) {
			padding-right: 0;
		}
	}

	&.is-following .follow-button__label {
		color: var(--color-success);
	}
}

// Placeholders
.reader-related-card.is-placeholder {
	.reader-related-card__title,
	.reader-related-card__excerpt,
	.reader-related-card__featured-image {
		@include placeholder();

		// Clobber the long-content-fade
		&::after {
			content: none;
		}
	}

	.reader-related-card__featured-image {
		border: 0;
	}

	.reader-related-card__post {
		// Clobber the long-content-fade
		&::after {
			content: none;
		}
	}
}

.reader-related-card__meta.is-placeholder {
	.reader-related-card__byline-author,
	.reader-related-card__byline-site {
		width: 100%;
		@include placeholder();

		// Clobber the long-content-fade
		&::after {
			content: none;
		}
	}

	.reader-related-card__byline-site {
		margin-top: 4px;
	}
}

// Targets Related Post cards on Devdocs
.is-section-devdocs .reader-related-card__blocks.is-same-site {
	border: 0;
	padding-top: 0;
}

.is-section-devdocs .reader-related-card__blocks.is-other-site {
	margin-top: 20px;
	padding-top: 20px;
}
