/**
 * Post Template (core block): the two ways a Query Loop lists articles.
 *
 * The title link is stretched over its whole item, so the item is one
 * large target with one accessible name. Topic links sit above it.
 */

.wp-block-post-template:is(.is-style-rows, .is-style-cards) {
	margin-block: 0;
	padding: 0;
	list-style-type: "";
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) > li {
	position: relative;
	margin-block: 0;
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) > li > * {
	margin-block: 0;
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .wp-block-post-title {
	margin: 0;
	font-size: var(--wp--preset--font-size--heading-sm);
	font-weight: var(--wp--custom--font-weight--medium);
	line-height: var(--wp--custom--line-height--snug);
	letter-spacing: 0;
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .wp-block-post-title a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .wp-block-post-excerpt {
	margin-block: var(--wp--preset--spacing--1) 0;
	color: var(--wp--preset--color--ink-2);
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .wp-block-post-excerpt__excerpt {
	margin: 0;
}

/* Date and reading time on one line, separated by a middle dot. */
.wp-block-post-template:is(.is-style-rows, .is-style-cards) .ab-post-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--wp--preset--spacing--2);
	color: var(--wp--preset--color--ink-3);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-xs);
	line-height: var(--wp--custom--line-height--control);
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .ab-post-meta > * {
	margin: 0;
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .ab-post-meta > * + *::before {
	content: "·" / "";
	margin-inline-end: var(--wp--preset--spacing--2);
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .wp-block-post-terms {
	position: relative;
	z-index: 1;
	color: var(--wp--preset--color--navy);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-xs);
	text-transform: lowercase;
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) .wp-block-post-terms a {
	display: inline-flex;
	align-items: center;
	min-height: var(--wp--custom--target);
	color: inherit;
}

.wp-block-post-template:is(.is-style-rows, .is-style-cards) > li:hover .wp-block-post-title a {
	color: var(--wp--preset--color--link);
}

/* Rows: date, title and topic across; stacked when narrow. */
.wp-block-post-template.is-style-rows {
	display: block;
	border-block-start: var(--wp--custom--line--width) solid var(--wp--custom--line--base);
}

.wp-block-post-template.is-style-rows > li {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--1) var(--wp--preset--spacing--8);
	align-items: start;
	padding-block: var(--wp--preset--spacing--5);
	border-block-end: var(--wp--custom--line--width) solid var(--wp--custom--line--base);
}

.wp-block-post-template.is-style-rows .ab-post-meta {
	padding-block-start: var(--wp--preset--spacing--1);
}

.wp-block-post-template.is-style-rows .ab-post-main > * {
	margin-block-start: 0;
}

/* Cards: meta above title in a bordered box. */
.wp-block-post-template.is-style-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 18.75rem), 1fr));
	gap: var(--wp--preset--spacing--6);
}

.wp-block-post-template.is-style-cards > li {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--3);
	padding: var(--wp--preset--spacing--5) var(--wp--preset--spacing--6);
	border: var(--wp--custom--line--width) solid var(--wp--custom--line--base);
	border-radius: var(--wp--custom--ab--border-radius--lg);
}

.wp-block-post-template.is-style-cards > li:hover {
	border-color: var(--wp--custom--line--hover);
}

/* Feature: one post, larger, in a single box. */
.wp-block-post-template.is-style-cards.ab-post-feature {
	display: block;
}

.wp-block-post-template.is-style-cards.ab-post-feature > li {
	gap: var(--wp--preset--spacing--4);
	padding: var(--wp--preset--spacing--gutter);
}

.wp-block-post-template.is-style-cards.ab-post-feature .wp-block-post-title {
	font-size: var(--wp--preset--font-size--title-sm);
	font-weight: var(--wp--custom--font-weight--semibold);
	line-height: var(--wp--custom--line-height--heading);
	letter-spacing: var(--wp--custom--letter-spacing--title);
}

.wp-block-post-template.is-style-cards.ab-post-feature .wp-block-post-excerpt {
	max-width: 60ch;
	font-size: var(--wp--preset--font-size--body);
}

/* Wide: fixed tracks, so titles line up whether or not a row has topics. */
@media (min-width: 51.25em) {

	.wp-block-post-template.is-style-rows > li {
		grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
	}
}
