/**
 * Tile grids: blog listing + services grid.
 *
 * Implements the "New Blog Page Layout" comp (Figma FMeBiRwIi1yqGwMqToSMbh,
 * node 151:2): a full-width hero tile at the top of every page (image left /
 * text right), then an equal-height 3-up grid. The services grid reuses the
 * same tile treatment at 3-up. Loads after main.min.css and only overrides the
 * pieces that changed, so the podcast listing (section.news-list.podcast)
 * keeps its original layout.
 *
 * Built to the V2 frame (node 166:4), not V1: serif titles in indigo, tighter
 * card, 20px copy leading.
 *
 * Comp measurements (desktop, 1300 frame):
 *   card              338 x auto, 1.5px #ff8ddf border, white (hero: 2px)
 *   card image        338 x 225   (66.57%)
 *   hero image        566 x 423   (74.73% of its own width)
 *   gradient panel    offset 22px left / 20px below the card
 *   tile title        SourceSerifPro-SemiBold 22px / 30px, #30339f
 *   hero title        SourceSerifPro-SemiBold 24px / 25px, #30339f
 *   copy              Source Sans Pro 16px / 20px (hero: 16 / 25)
 *   "Read more"       SourceSerifPro-BoldIt 16px, #e81e75 (.text-link)
 *
 * SourceSerifPro-SemiBold's @font-face lives in campaign-modules.css, which is
 * enqueued ahead of this file.
 */

section.news-list:not(.podcast) .post-wrapper {
	float: none;
	width: 100%;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	/*
	 * Comp gaps are card-edge to card-edge: 52px across, 70px down. Each tile
	 * carries 22px/20px of padding for its gradient panel, so the grid gaps are
	 * that much smaller.
	 */
	column-gap: 30px;
	row-gap: 50px;
}

section.news-list:not(.podcast) .post-wrapper .post {
	display: block;
	float: none;
	width: auto;
	/* Space for the gradient panel that sits left of / below the card. */
	padding: 0 0 20px 22px;
}

section.news-list:not(.podcast) .post-wrapper .post .post-inner {
	float: none;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	border-width: 1.5px;
}

/*
 * The tile image is a floated .image-size-container in main.min.css, which
 * collapses its parent once .post-inner becomes a flex column. Drive the ratio
 * from a pseudo-element instead and let the image stretch to the final height.
 */
section.news-list:not(.podcast) .post-wrapper .post .post-inner .image-container {
	position: relative;
	float: none;
	width: 100%;
	/* main.min.css sets a global .image-container { height: 100% }. */
	height: auto;
	flex: 0 0 auto;
	overflow: hidden;
}

section.news-list:not(.podcast) .post-wrapper .post .post-inner .image-container:before {
	content: '';
	display: block;
	/* 338 x 225 in the comp. */
	padding-top: 66.57%;
}

section.news-list:not(.podcast) .post-wrapper .post .post-inner .image-size-container {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	float: none;
	width: auto;
	height: auto;
	padding-top: 0;
}

section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container {
	float: none;
	width: 100%;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	/* Comp: 28px under the image, 15px gutters, 25px below. Text column 308. */
	padding: 28px 15px 25px;
}

/* The comp drops the post date from the tiles. */
section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container h6.date {
	display: none;
}

section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container h2 {
	float: none;
	font-family: "SourceSerifPro-SemiBold", "Source Serif Pro", serif;
	font-weight: 600;
	font-size: 22px;
	line-height: 30px;
	color: #30339f;
	margin-bottom: 16px;
}

section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container h3 {
	float: none;
	font-size: 16px;
	line-height: 20px;
}

/* Tiles are equal height, so pin "Read more" to the bottom of every card. */
section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container .link-wrapper {
	float: none;
	margin-top: auto;
	padding-top: 25px;
}

section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container .text-link {
	font-size: 16px;
}

/* Gradient panel: 22px left of the card, 20px below it. */
section.news-list:not(.podcast) .post-wrapper .post .border {
	top: 20px;
	right: 22px;
	bottom: 0;
	left: 0;
	width: auto;
	height: auto;
}

/* --- Hero tile (first post of each page) --------------------------------- */

section.news-list:not(.podcast) .post-wrapper .post.is-hero {
	grid-column: 1 / -1;
}

section.news-list:not(.podcast) .post-wrapper .post.is-hero .post-inner {
	flex-direction: row;
	align-items: stretch;
	border-width: 2px;
}

section.news-list:not(.podcast) .post-wrapper .post.is-hero .image-container {
	width: 50.7%;
	flex: 0 0 50.7%;
}

section.news-list:not(.podcast) .post-wrapper .post.is-hero .image-container:before {
	/* 566 x 423 in the comp. */
	padding-top: 74.73%;
}

section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container {
	width: 49.3%;
	flex: 1 1 auto;
	/* Comp centres the hero copy: 110px clear above and below the text block. */
	justify-content: center;
	padding: 40px 20px 40px 46px;
}

/* Hero runs a size up on the title and a looser copy leading than the tiles. */
section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container h2 {
	font-size: 24px;
	line-height: 25px;
	margin-bottom: 16px;
}

section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container h3 {
	line-height: 25px;
}

section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container .link-wrapper {
	margin-top: 0;
	padding-top: 44px;
}

/* --- Responsive ---------------------------------------------------------- */

@media only screen and (max-width: 1023px) {
	section.news-list:not(.podcast) .post-wrapper {
		grid-template-columns: repeat(2, 1fr);
		column-gap: 40px;
		row-gap: 50px;
	}

	section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container h2 {
		font-size: 20px;
		line-height: 27px;
	}
}

@media only screen and (max-width: 767px) {
	section.news-list:not(.podcast) .post-wrapper .post.is-hero .post-inner {
		flex-direction: column;
	}

	section.news-list:not(.podcast) .post-wrapper .post.is-hero .image-container {
		width: 100%;
		flex: 0 0 auto;
	}

	section.news-list:not(.podcast) .post-wrapper .post.is-hero .image-container:before {
		padding-top: 66.57%;
	}

	section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container {
		width: 100%;
		padding: 28px 15px 25px;
	}

	section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container h2 {
		font-size: 22px;
		line-height: 30px;
	}

	section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container h3 {
		line-height: 20px;
	}

	section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container .link-wrapper {
		padding-top: 35px;
	}
}

@media only screen and (max-width: 640px) {
	section.news-list:not(.podcast) .post-wrapper {
		grid-template-columns: 1fr;
		row-gap: 40px;
	}

	section.news-list:not(.podcast) .post-wrapper .post {
		padding: 0 0 15px 15px;
	}

	section.news-list:not(.podcast) .post-wrapper .post .border {
		top: 15px;
		right: 15px;
	}

	section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container,
	section.news-list:not(.podcast) .post-wrapper .post.is-hero .text-container {
		padding: 25px 20px 25px;
	}

	section.news-list:not(.podcast) .post-wrapper .post .post-inner .text-container .link-wrapper {
		padding-top: 25px;
	}
}

/* ========================================================================== *
 * Services grid — same tile treatment as the blog listing, 3-up on desktop.
 * Selectors mirror the main.min.css prefix so they win on load order.
 * ========================================================================== */

body.template-services section.services-grid .services-block {
	float: none;
	width: 100%;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	column-gap: 30px;
	row-gap: 50px;
}

body.template-services section.services-grid .services-block .service-item {
	display: block;
	float: none;
	width: auto;
	padding: 0 0 20px 22px;
}

body.template-services section.services-grid .services-block .service-item:nth-child(even) {
	float: none;
}

body.template-services section.services-grid .services-block .service-item .post-inner {
	float: none;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	border-width: 1.5px;
}

body.template-services section.services-grid .services-block .service-item .post-inner .image-container {
	position: relative;
	float: none;
	width: 100%;
	height: auto;
	padding-top: 0;
	flex: 0 0 auto;
	overflow: hidden;
}

body.template-services section.services-grid .services-block .service-item .post-inner .image-container:before {
	content: '';
	display: block;
	padding-top: 66.57%;
}

body.template-services section.services-grid .services-block .service-item .post-inner .image-container .image-size-container {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	float: none;
	width: auto;
	height: auto;
	padding-top: 0;
}

body.template-services section.services-grid .services-block .service-item .post-inner .text-container {
	position: relative;
	float: none;
	width: 100%;
	/* main.min.js runs matchHeight over these and writes an inline height. */
	height: auto !important;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	/* Bottom padding reserves the price burst's corner (110px + 20px). */
	padding: 28px 15px 130px;
}

body.template-services section.services-grid .services-block .service-item .post-inner .text-container h2 {
	float: none;
	font-family: "SourceSerifPro-SemiBold", "Source Serif Pro", serif;
	font-weight: 600;
	font-size: 22px;
	line-height: 30px;
	color: #30339f;
	margin-bottom: 16px;
}

body.template-services section.services-grid .services-block .service-item .post-inner .text-container h3 {
	float: none;
	font-size: 16px;
	line-height: 20px;
}

/*
 * Unlike the blog tiles, "Read more" follows the copy instead of being pinned
 * to the card bottom — short service blurbs left a hole in the middle of the
 * card. The slack sits at the bottom, where the price burst lives.
 */
body.template-services section.services-grid .services-block .service-item .post-inner .text-container .link-wrapper {
	float: none;
	margin-top: 0;
	padding-top: 35px;
}

body.template-services section.services-grid .services-block .service-item .post-inner .text-container .link-wrapper .text-link {
	font-size: 16px;
}

body.template-services section.services-grid .services-block .service-item .post-inner .text-container .link-wrapper .text-link:after {
	top: 4px;
}

/* Price burst anchors to the card's bottom-right corner, scaled for 3-up. */
body.template-services section.services-grid .services-block .service-item .post-inner .text-container .price {
	position: absolute;
	float: none;
	top: auto;
	left: auto;
	right: 20px;
	bottom: 20px;
	width: 110px;
	height: 110px;
	margin-top: 0;
	font-size: 21px;
}

body.template-services section.services-grid .services-block .service-item .border {
	top: 20px;
	right: 22px;
	bottom: 0;
	left: 0;
	width: auto;
	height: auto;
}

@media only screen and (max-width: 1023px) {
	body.template-services section.services-grid .services-block {
		grid-template-columns: repeat(2, 1fr);
		column-gap: 28px;
		row-gap: 50px;
	}

	body.template-services section.services-grid .services-block .service-item .post-inner .text-container h2 {
		font-size: 20px;
		line-height: 27px;
	}
}

@media only screen and (max-width: 640px) {
	body.template-services section.services-grid .services-block {
		grid-template-columns: 1fr;
		row-gap: 40px;
	}

	body.template-services section.services-grid .services-block .service-item {
		padding: 0 0 15px 15px;
	}

	body.template-services section.services-grid .services-block .service-item .border {
		top: 15px;
		right: 15px;
	}

	body.template-services section.services-grid .services-block .service-item .post-inner .text-container {
		padding: 25px 20px 120px;
	}

	body.template-services section.services-grid .services-block .service-item .post-inner .text-container h3 {
		line-height: 20px;
	}

	body.template-services section.services-grid .services-block .service-item .post-inner .text-container .link-wrapper {
		padding-top: 30px;
	}

	body.template-services section.services-grid .services-block .service-item .post-inner .text-container .price {
		right: 20px;
		bottom: 20px;
		width: 100px;
		height: 100px;
		font-size: 18px;
	}
}

/* ==========================================================================
 * Podcast listing — heading typography only.
 *
 * AC 512359: the podcast tiles still carried the pre-V2 blog heading (Source
 * Sans Pro Bold 18px pink); the client wants them consistent with the blog's
 * blue serif. Layout is deliberately left alone — the podcast grid keeps its
 * own structure, which is why the rules above exclude .podcast.
 * ========================================================================== */

/* Same inner padding as the blog tiles (comp: 28 top, 15 gutters, 25 bottom). */
section.news-list.podcast .post-wrapper .post .post-inner .text-container {
	padding: 28px 15px 25px;
}

section.news-list.podcast .post-wrapper .post .post-inner .text-container h2 {
	font-family: "SourceSerifPro-SemiBold", "Source Serif Pro", serif;
	font-weight: 600;
	font-size: 22px;
	line-height: 30px;
	color: #30339f;
}

@media only screen and (max-width: 1023px) {
	section.news-list.podcast .post-wrapper .post .post-inner .text-container h2 {
		font-size: 20px;
		line-height: 27px;
	}
}

@media only screen and (max-width: 640px) {
	section.news-list.podcast .post-wrapper .post .post-inner .text-container {
		padding: 25px 20px 25px;
	}
}

/*
 * Featured episode tile — same treatment as the blog hero.
 *
 * main.min.css floats it 50/50 with the copy top-aligned; the blog hero is a
 * flex row with the image bleeding full height and the copy vertically centred.
 * Widths need !important because the podcast rules there are !important.
 */
section.news-list.podcast .post-wrapper .post.featured .post-inner {
	display: flex;
	flex-direction: row;
	align-items: stretch;
}

section.news-list.podcast .post-wrapper .post.featured .post-inner .image-container {
	position: relative;
	float: none;
	width: 50.7% !important;
	height: auto;
	flex: 0 0 50.7%;
	overflow: hidden;
}

section.news-list.podcast .post-wrapper .post.featured .post-inner .image-container:before {
	content: '';
	display: block;
	/* 566 x 423 in the comp. */
	padding-top: 74.73%;
}

section.news-list.podcast .post-wrapper .post.featured .post-inner .image-container .image-size-container {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	float: none;
	width: auto;
	height: auto;
	padding-top: 0;
}

section.news-list.podcast .post-wrapper .post.featured .post-inner .text-container {
	float: none;
	width: 49.3% !important;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 40px 20px 40px 46px;
}

section.news-list.podcast .post-wrapper .post.featured .post-inner .text-container h2 {
	font-size: 24px;
	line-height: 25px;
	margin-bottom: 16px;
}

section.news-list.podcast .post-wrapper .post.featured .post-inner .text-container h3 {
	line-height: 25px;
}

section.news-list.podcast .post-wrapper .post.featured .post-inner .text-container .link-wrapper {
	float: none;
	margin-top: 0;
	padding-top: 44px;
}

@media only screen and (max-width: 767px) {
	section.news-list.podcast .post-wrapper .post.featured .post-inner {
		flex-direction: column;
	}

	section.news-list.podcast .post-wrapper .post.featured .post-inner .image-container {
		width: 100% !important;
		flex: 0 0 auto;
	}

	section.news-list.podcast .post-wrapper .post.featured .post-inner .image-container:before {
		padding-top: 66.57%;
	}

	section.news-list.podcast .post-wrapper .post.featured .post-inner .text-container {
		width: 100% !important;
		padding: 28px 15px 25px;
	}

	section.news-list.podcast .post-wrapper .post.featured .post-inner .text-container h2 {
		font-size: 22px;
		line-height: 30px;
	}

	section.news-list.podcast .post-wrapper .post.featured .post-inner .text-container h3 {
		line-height: 20px;
	}

	section.news-list.podcast .post-wrapper .post.featured .post-inner .text-container .link-wrapper {
		padding-top: 35px;
	}
}
