@import "../../../common.scss";

/**
 * Post grid styles
 * Loads on front end and back end
 */

.gb-block-post-grid {
	margin: 0 0 1.2em 0;
	position: relative;

	.is-grid,
	.gb-is-grid {
		display: -ms-grid;
		display: grid;
		-ms-grid-columns: 1fr 1fr;
		grid-template-columns: 1fr 1fr;
		grid-template-rows: 1fr;
		grid-gap: 0 2em;

		@media all and (-ms-high-contrast: none) {
			display: block;
		}

		article {
			margin-bottom: 2.5em;
			min-width: 0;

			@media all and (-ms-high-contrast: none) {
				padding-left: 10px;
				padding-right: 10px;
				display: inline-block;
				vertical-align: top;
			}
		}
	}

	.is-grid.columns-1,
	.gb-is-grid.gb-columns-1 {
		-ms-grid-columns: 1fr;
		grid-template-columns: 1fr;

		@media all and (-ms-high-contrast: none) {

			article {
				width: 100%;
			}
		}
	}

	.is-grid.columns-2,
	.gb-is-grid.gb-columns-2 {
		-ms-grid-columns: 1fr 1fr;
		grid-template-columns: 1fr 1fr;

		@media all and (-ms-high-contrast: none) {

			article {
				width: 48%;
			}
		}
	}

	.is-grid.columns-3,
	.gb-is-grid.gb-columns-3 {
		-ms-grid-columns: 1fr 1fr 1fr;
		grid-template-columns: 1fr 1fr 1fr;

		@media all and (-ms-high-contrast: none) {

			article {
				width: 32%;
			}
		}
	}

	.is-grid.columns-4,
	.gb-is-grid.gb-columns-4 {
		-ms-grid-columns: 1fr 1fr 1fr 1fr;
		grid-template-columns: 1fr 1fr 1fr 1fr;

		@media all and (-ms-high-contrast: none) {

			article {
				width: 24%;
			}
		}
	}

	div[class*="columns"].is-grid,
	div[class*="columns"].gb-is-grid {

		@media only screen and (max-width: 600px) {
			-ms-grid-columns: 1fr;
			grid-template-columns: 1fr;
		}
	}

	.gb-post-grid-section-title {
		text-align: left;
	}

	.gb-block-post-grid-image {
		margin-bottom: 1.2em;

		img {
			display: block;
			width: 100%;
		}
	}

	.gb-block-post-grid-text {
		text-align: left;
	}

	a {
		text-decoration: none;
	}

	header .gb-block-post-grid-title {
		margin-top: 0;
		margin-bottom: 15px;
		font-size: 28px;
		line-height: 1.2;

		a {
			color: $black;
			text-decoration: none;

			&:hover {
				text-decoration: underline;
				color: inherit;
			}
		}
	}

	.gb-block-post-grid-byline {
		font-size: 14px;
		color: $lightgray;
		margin-bottom: 15px;
	}

	.gb-block-post-grid-author,
	.gb-block-post-grid-date {
		display: inline-block;

		&:not(:last-child)::after {
			content: "\B7";
			vertical-align: middle;
			margin: 0 5px;
			line-height: 1;
		}
	}

	.gb-block-post-grid-author a {
		color: inherit;
		text-decoration: none;

		&:hover {
			color: inherit;
			text-decoration: underline;
		}
	}

	.gb-block-post-grid-text p {
		margin: 0 0 15px 0;
		font-size: inherit;

		&:last-of-type {
			margin-bottom: 0;
		}
	}

	.gb-block-post-grid-more-link {
		display: inline-block;
		box-shadow: none;
		transition: 0.3s ease;
		font-weight: bold;
		color: $black;
		text-decoration: none;

		&:hover {
			text-decoration: underline;
		}
	}

	.gb-block-post-grid-excerpt div + p {
		margin-top: 15px;
	}

	.is-list,
	.gb-is-list {

		article {
			display: -ms-grid;
			display: grid;
			-ms-grid-columns: 30% 1fr;
			grid-template-columns: 30% 1fr;
			grid-template-rows: 1fr;
			grid-gap: 0 2em;

			@media all and (-ms-high-contrast: none) {
				display: block;
			}

			&::before {
				display: none;
			}

			&:not(:last-child) {
				margin-bottom: 5%;
				padding-bottom: 5%;
			}

			@media only screen and (min-width: 600px) {

				&:not(:last-child) {
					border-bottom: solid 1px #eee;
				}
			}

			@media only screen and (max-width: 600px) {
				-ms-grid-columns: 1fr;
				grid-template-columns: 1fr;
			}
		}

		article:not(.has-post-thumbnail),
		article.hide-featured-image {
			-ms-grid-columns: 1fr;
			grid-template-columns: 1fr;
		}

		.gb-block-post-grid-image {
			margin-bottom: 0;

			@media all and (-ms-high-contrast: none) {
				width: 30%;
				display: inline-block;
				vertical-align: top;
			}

			@media only screen and (max-width: 600px) {
				margin-bottom: 5%;
			}
		}


		@media all and (-ms-high-contrast: none) {

			.gb-block-post-grid-text {
				width: 65%;
				padding-left: 5%;
				display: inline-block;
				vertical-align: top;
			}

			.post:not(.has-post-thumbnail) .gb-block-post-grid-text {
				width: 100%;
				padding-left: 0;
			}
		}

		.gb-block-post-grid-title {

			@media only screen and (min-width: 600px) {
				font-size: 34px;
			}
		}

		.no-thumb .gb-block-post-grid-text {
			grid-column: span 2;
		}
	}
}

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	height: 1px;
	overflow: hidden;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}
