/* stylelint-disable no-descending-specificity -- Archive variants deliberately
 * refine the shared card selectors. */

.moca-editorial-hero .wp-block-cover__inner-container {
	max-width: 52rem;
}

.moca-news-hero .wp-block-cover__inner-container {
	max-width: 73.75rem;
}

.moca-editorial-hero h1 {
	color: #fff;
	margin: 0.5rem 0 1rem;
}

.moca-editorial-hero__intro {
	color: #fff;
	font-size: var(--wp--preset--font-size--xl);
	line-height: 1.55;
	max-width: 42rem;
}

.moca-news-hero__grid {
	gap: clamp(2rem, 6vw, 6rem);
}

.moca-news-search .wp-block-search__inside-wrapper {
	padding: 0;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: #fff;
}

.moca-news-search .wp-block-search__input {
	min-height: 44px;
	padding-left: 1.25rem;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
}

.moca-news-search .wp-block-search__button {
	width: 44px;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border-radius: 50%;
}

/* Keep the focus indicator around the complete pill. Drawing it around only
   the input left a broken-looking edge behind the adjoining icon button. */
.moca-news-search .wp-block-search__inside-wrapper:focus-within {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.moca-news-search .wp-block-search__input:focus-visible {
	outline: none;
}

.moca-news-search .wp-block-search__button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

.moca-editorial-feed {
	gap: 0;
}

.moca-editorial-feed > li {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 1.5rem;
	padding: 1.5rem 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.moca-editorial-card__copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
}

.moca-editorial-card__copy > * {
	margin-block: 0;
}

.moca-editorial-card__copy > * + * {
	margin-top: 0.75rem;
}

.moca-editorial-card__copy h2 {
	font-size: var(--wp--preset--font-size--xl);
	font-weight: 700;
}

.moca-editorial-card__copy h2 a {
	text-decoration: none;
}

.moca-editorial-card__topic,
.moca-editorial-card__type {
	color: var(--wp--preset--color--blue);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.moca-editorial-card__topic a,
.moca-editorial-card__type a {
	text-decoration: none;
}

/*
 * The featured card.
 *
 * Two archives use it and they are built differently. /customers/ still
 * composes two Query Loops, so its featured story is `.moca-blog-feature` - a
 * post template of its own above the grid. /blog/ and the topic hubs now carry
 * ONE inherited Query Loop; its rendered Post Template is split after the
 * first card so the topic navigation can retain its approved position. Same
 * treatment, two selectors, and the /customers/ one is not dropped because
 * that archive has not moved.
 *
 * `moca365_place_blog_topics_after_lead()` adds `.moca-blog-grid--lead` only
 * to the one-item list it creates on the first archive page. On page two the
 * first card is ordinary, so it never matches the featured selectors.
 */
.moca-blog-feature > li,
.moca-blog-grid--lead > li:first-child {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(20rem, 0.95fr);
	gap: clamp(2rem, 5vw, 4.5rem);
	align-items: center;
}

/*
 * What only the Blog lead needs: it is a card of the two-column grid, so it
 * has to span both columns and shed the side padding and divider that go with
 * a column. The /customers/ feature is in its own list and has neither.
 */
.moca-blog-grid--lead > li:first-child {
	grid-column: 1 / -1;
	padding: 0 0 1.5rem;
	border-bottom: 0;
	border-left: 0;
}

.moca-feature-label {
	color: var(--wp--preset--color--blue);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.moca-blog-feature h2,
.moca-blog-grid--lead > li:first-child h2 {
	font-size: var(--wp--preset--font-size--3-xl);
	font-weight: 400;
}

/*
 * The pill on featured cards only. /blog/ and /news/ use dedicated Read More
 * blocks on their leads; /customers/ keeps the link rendered by its excerpt.
 * Scoping every selector to its lead prevents the remaining cards from
 * becoming pills too.
 */
.moca-blog-feature .wp-block-post-excerpt__more-link,
.moca-blog-grid--lead > li:first-child .moca-feature-read-more,
.moca-editorial-feed--news > li:first-child .moca-news-read-more {
	display: inline-flex;
	min-height: 0;
	align-items: center;
	margin-top: 1rem;
	padding: 0.6rem 1.1rem;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--magenta);
	color: #fff;
	font-size: var(--wp--preset--font-size--body);
	font-weight: 700;
	line-height: 1.6;
	text-decoration: none;
}

.moca-customer-hero__copy {
	max-width: 52rem;
	margin-right: auto !important;
	margin-left: 0 !important;
}

.moca-customer-list {
	margin-top: 2.5rem;
	border-top: 1px solid var(--wp--preset--color--border);
}

.moca-customer-grid .wp-block-post-excerpt__excerpt {
	display: none;
}

.moca-customer-grid .wp-block-post-excerpt__more-link {
	font-size: var(--wp--preset--font-size--body);
	font-weight: 700;
}

.moca-blog-topics {
	display: flex;
	gap: clamp(1rem, 3vw, 2.75rem);
	overflow-x: auto;
	margin: 2.5rem 0 0;
	border-block: 1px solid var(--wp--preset--color--border);
}

.moca-blog-topics a {
	flex: 0 0 auto;
	padding: 1rem 0;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.moca-blog-topics a.is-current {
	border-bottom: 3px solid var(--wp--preset--color--blue);
	color: var(--wp--preset--color--blue);
}

.moca-blog-grid {
	gap: 0;
}

.moca-blog-grid > li {
	display: grid;
	grid-template-columns: minmax(10rem, 0.9fr) minmax(0, 1.1fr);
	gap: 1.5rem;
	padding: 1.5rem 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

/*
 * Which side of the two-column grid a card sits on, and therefore which side
 * carries the divider.
 *
 * The rendered post-template is split after the lead card, so the continuation
 * list starts at its own first item and follows this ordinary odd/even rhythm.
 * Both lists still come from the same inherited Query Loop.
 */
.moca-blog-grid > li:where(:nth-child(odd)) {
	padding-right: 1.5rem;
}

.moca-blog-grid > li:where(:nth-child(even)) {
	padding-left: 1.5rem;
	border-left: 1px solid var(--wp--preset--color--border);
}

/*
 * The card image radius, in CSS rather than on the block.
 *
 * One Query Loop means one post-featured-image block for both treatments, and
 * a radius set as a block attribute renders as an inline style that only
 * `!important` could override. Two rules here, no inline style, and the lead
 * keeps the 12px it has always had.
 */
.moca-blog-grid .moca-editorial-card__image img {
	border-radius: 10px;
}

.moca-blog-grid--lead > li:first-child .moca-editorial-card__image img {
	border-radius: 12px;
}

.moca-blog-grid h2 {
	font-size: var(--wp--preset--font-size--xl);
}

.moca-editorial-feed--news > li:where(:first-child) {
	grid-column: 1 / -1;
	grid-template-columns: minmax(0, 1.05fr) minmax(20rem, 0.95fr);
	gap: clamp(2rem, 5vw, 4.5rem);
	padding-top: 0;
}

.moca-editorial-feed--news > li:where(:not(:first-child)) {
	grid-template-columns: minmax(10rem, 0.9fr) minmax(0, 1.1fr);
}

.moca-editorial-feed--news .moca-editorial-card__image {
	align-self: center;
}

.moca-editorial-feed--news > li:where(:nth-child(even)) {
	padding-right: 1.5rem;
}

.moca-editorial-feed--news > li:where(:nth-child(odd):not(:first-child)) {
	padding-left: 1.5rem;
	border-left: 1px solid var(--wp--preset--color--border);
}

.moca-editorial-feed--news > li:not(:first-child) .moca-editorial-card__copy h2 {
	font-size: var(--wp--preset--font-size--xl);
}

.moca-editorial-archive .wp-block-query-pagination {
	margin-top: 2.5rem;
}

@media (max-width: 900px) {

	.moca-news-hero__grid {
		flex-wrap: wrap !important;
	}

	.moca-news-hero__grid > .wp-block-column {
		flex-basis: 100% !important;
	}

	.moca-editorial-feed--news > li,
	.moca-editorial-feed--news > li:first-child {
		grid-column: 1 / -1;
		grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
		padding-inline: 0;
		border-left: 0;
	}

	.moca-blog-feature > li,
	.moca-blog-grid--lead > li:first-child {
		grid-template-columns: minmax(0, 1fr) minmax(18rem, 1fr);
	}

	.moca-blog-grid > li {
		grid-column: 1 / -1;
		padding-inline: 0;
		border-left: 0;
	}

	/*
	 * Repeated at the lead page's specificity. The column rules above are
	 * two classes deep so a card could keep a divider it has no column to
	 * sit beside once the grid collapses to one.
	 */
	.moca-archive-has-lead .moca-blog-grid > li {
		grid-column: 1 / -1;
		padding-inline: 0;
		border-left: 0;
	}
}

@media (max-width: 760px) {

	.moca-blog-topics {
		flex-wrap: wrap;
		column-gap: clamp(1rem, 5vw, 1.5rem);
		row-gap: 0;
		justify-content: center;
		overflow-x: visible;
	}

	.moca-blog-topics a {
		padding-block: 0.7rem;
	}
}

@media (max-width: 620px) {

	.moca-editorial-feed--news > li,
	.moca-editorial-feed--news > li:first-child {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	/*
	 * The lead selector is repeated so it outranks the 900px two-column rule.
	 * Without it the lead kept an 18rem text column and the image column
	 * shrank to 0-22px on phones.
	 */
	.moca-blog-feature > li,
	.moca-blog-grid > li,
	.moca-blog-grid--lead > li:first-child {
		grid-template-columns: 1fr;
	}
}
