/**
 * MERINEO blog: page intros, category filter, post cards and pagination.
 * The prototype has no blog; the pieces reuse its tokens (hero canvas, eyebrow, pills, cards).
 * Loaded on the front end and inside the editor canvas.
 */

/* ---------------------------------------------------------------------------
 * Page intro: the hero canvas (.merineo-hero) with a heading, lead and filter.
 * ------------------------------------------------------------------------ */

.merineo-page-intro :is(h1, .wp-block-query-title) {
	max-width: 18ch;
}

.merineo-page-intro p.is-style-lead,
.merineo-page-intro .is-style-lead p {
	max-width: 46ch;
}

/* Excerpt and term description render a wrapper around the paragraph, so the lead style is applied inside. */
.merineo-page-intro :is(.wp-block-post-excerpt, .wp-block-term-description).is-style-lead p {
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.62;
	color: var(--wp--preset--color--mist);
}

/* ---------------------------------------------------------------------------
 * Category filter: outline pills on ink, the current one filled.
 * ------------------------------------------------------------------------ */

.merineo-filter > * {
	margin: 0;
}

/* The category items join the row of "All posts", so the pills wrap as one set. */
.merineo-filter .merineo-filter__list {
	display: contents;
	list-style: none;
}

.merineo-filter .merineo-filter__list > li {
	margin: 0;
}

.merineo-filter a {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 8px 16px;
	border: 1px solid var(--wp--custom--line--on-ink);
	border-radius: var(--wp--custom--radius--pill);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	line-height: 1.2;
	color: var(--wp--preset--color--blue);
	text-decoration: none;
}

.merineo-filter a:hover {
	border-color: var(--wp--preset--color--blue);
	color: var(--wp--preset--color--white);
}

/* Current: the category being viewed, or "All posts" on the posts page. */
.merineo-filter .current-cat > a,
body.blog .merineo-filter .merineo-filter__all a {
	border-color: var(--wp--preset--color--blue);
	background-color: var(--wp--preset--color--blue);
	color: var(--wp--preset--color--ink);
}

/* On light sections (search without results) the pills are ink outlines. */
.is-style-section-paper .merineo-filter a {
	border-color: rgba(11, 13, 23, 0.28);
	color: var(--wp--preset--color--ink);
}

.is-style-section-paper .merineo-filter a:hover {
	border-color: var(--wp--preset--color--blue-deep);
	color: var(--wp--preset--color--blue-deep);
}

/* ---------------------------------------------------------------------------
 * Post cards
 * ------------------------------------------------------------------------ */

.merineo-posts__list {
	padding: 0;
	list-style: none;
}

.merineo-post-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--custom--line--on-light);
	border-radius: var(--wp--custom--radius--base);
	transition:
		border-color var(--wp--custom--duration--base) var(--wp--custom--easing--standard),
		transform var(--wp--custom--duration--slow) var(--wp--custom--easing--standard);
}

.merineo-post-card .merineo-post-card__image {
	margin: 0;
	overflow: hidden;
}

.merineo-post-card .merineo-post-card__image img {
	display: block;
	transition: transform 600ms var(--wp--custom--easing--emphasis);
}

.merineo-post-card .merineo-post-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding: 24px 28px 28px;
}

.merineo-post-card__body > * {
	margin-block: 0;
}

:is(.merineo-post-card, .merineo-search__item) .merineo-post-card__terms {
	position: relative;
	z-index: 1;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--wp--preset--color--slate);
}

:is(.merineo-post-card, .merineo-search__item) .merineo-post-card__terms a {
	display: inline-block;
	padding-block: 5px;
	margin-block: -5px;
	color: var(--wp--preset--color--blue-deep);
	text-decoration: none;
}

:is(.merineo-post-card, .merineo-search__item) .merineo-post-card__terms a:hover {
	color: var(--wp--preset--color--ink);
}

.merineo-post-card .merineo-post-card__title {
	line-height: 1.12;
}

.merineo-post-card .merineo-post-card__title a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

/* The title link covers the whole card; category links stay clickable above it. */
.merineo-post-card .merineo-post-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.merineo-post-card .merineo-post-card__title a:focus-visible {
	outline: 0;
}

.merineo-post-card:has(.merineo-post-card__title a:focus-visible) {
	outline: 2px solid var(--wp--preset--color--blue-deep);
	outline-offset: 2px;
}

.merineo-post-card .merineo-post-card__excerpt {
	font-size: 15.5px;
	line-height: 1.6;
	color: rgba(11, 13, 23, 0.72);
}

.merineo-post-card__excerpt .wp-block-post-excerpt__excerpt {
	margin: 0;
}

.merineo-post-card .merineo-post-card__meta {
	margin-top: auto;
	padding-top: 16px;
	color: var(--wp--preset--color--slate);
}

.merineo-post-card__meta > * + *::before {
	content: "·";
	margin: 0 10px;
}

.merineo-post-card:hover {
	border-color: var(--wp--preset--color--sky);
	transform: translateY(-4px);
}

.merineo-post-card:hover .merineo-post-card__image img {
	transform: scale(1.04);
}

.merineo-post-card:hover .merineo-post-card__title a {
	color: var(--wp--preset--color--blue-deep);
}

/* First card: image and text side by side across the whole row. */
@media (min-width: 860px) {

	.merineo-posts__list > li:first-child {
		grid-column: 1 / -1;
	}

	.merineo-posts__list > li:first-child .merineo-post-card:has(.merineo-post-card__image) {
		display: grid;
		grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
	}

	.merineo-posts__list > li:first-child .merineo-post-card__image {
		height: 100%;
	}

	.merineo-posts__list > li:first-child .merineo-post-card__image img {
		height: 100%;
		min-height: 360px;
		aspect-ratio: auto !important;
	}

	.merineo-posts__list > li:first-child .merineo-post-card__body {
		justify-content: center;
		padding: 48px;
	}

	.merineo-posts__list > li:first-child .merineo-post-card__title {
		font-size: var(--wp--preset--font-size--xx-large);
	}

	.merineo-posts__list > li:first-child .merineo-post-card__excerpt {
		font-size: var(--wp--preset--font-size--medium);
	}

	.merineo-posts__list > li:first-child .merineo-post-card__meta {
		margin-top: 0;
		padding-top: 24px;
	}
}

/* ---------------------------------------------------------------------------
 * Pagination: round page numbers, outline pills for previous and next.
 * ------------------------------------------------------------------------ */

/* Three columns, so the numbers stay centred when "previous" or "next" is missing. */
.wp-block-query-pagination.merineo-pagination {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: 16px;
	align-items: center;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.merineo-pagination .wp-block-query-pagination-previous {
	grid-column: 1;
	justify-self: start;
}

.merineo-pagination .wp-block-query-pagination-numbers {
	grid-row: 1;
	grid-column: 2;
}

.merineo-pagination .wp-block-query-pagination-next {
	grid-row: 1;
	grid-column: 3;
	justify-self: end;
}

.merineo-pagination .wp-block-query-pagination-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
}

.merineo-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 8px;
	border: 1px solid transparent;
	border-radius: var(--wp--custom--radius--pill);
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.merineo-pagination a.page-numbers:hover {
	border-color: rgba(11, 13, 23, 0.28);
}

.merineo-pagination .page-numbers.current {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
}

.merineo-pagination :is(.wp-block-query-pagination-previous, .wp-block-query-pagination-next) {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	min-height: 44px;
	margin: 0;
	padding: 0 20px;
	border: 1px solid rgba(11, 13, 23, 0.28);
	border-radius: var(--wp--custom--radius--pill);
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.merineo-pagination :is(.wp-block-query-pagination-previous, .wp-block-query-pagination-next):hover {
	background-color: rgba(11, 13, 23, 0.06);
}

.merineo-pagination :is(.wp-block-query-pagination-previous-arrow, .wp-block-query-pagination-next-arrow) {
	margin: 0;
}

/* Small screens: previous and next shrink to round arrow buttons; the label stays for screen readers. */
@media (max-width: 759px) {

	.wp-block-query-pagination.merineo-pagination {
		gap: 8px;
	}

	.merineo-pagination :is(.wp-block-query-pagination-previous, .wp-block-query-pagination-next) {
		justify-content: center;
		width: 44px;
		padding: 0;
		font-size: 0;
	}

	.merineo-pagination :is(.wp-block-query-pagination-previous-arrow, .wp-block-query-pagination-next-arrow) {
		font-size: var(--wp--preset--font-size--medium);
	}
}

/* ---------------------------------------------------------------------------
 * Article header: breadcrumbs, title, lead, author and facts on ink.
 * ------------------------------------------------------------------------ */

.merineo-article-intro .merineo-article-intro__title {
	max-width: 22ch;
}

.merineo-breadcrumbs {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	line-height: 1.6;
	letter-spacing: 0.26em;
	text-transform: uppercase;
	color: var(--wp--preset--color--mist);
}

/* Links get a 24px tall hit area (WCAG 2.5.8) without changing the line. */
.merineo-breadcrumbs a {
	display: inline-block;
	padding-block: 4px;
	margin-block: -4px;
	color: var(--wp--preset--color--blue);
	text-decoration: none;
}

.merineo-breadcrumbs a:hover {
	color: var(--wp--preset--color--white);
}

.merineo-article-intro__meta {
	row-gap: 16px;
}

.merineo-article-intro__facts,
.merineo-post-card__meta {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.merineo-article-intro__facts {
	color: var(--wp--preset--color--mist);
}

.merineo-article-intro__facts > * + *::before {
	content: "·";
	margin: 0 10px;
}

/* A vertical hairline between the author and the facts while they share a row. */
.merineo-article-intro__meta > .merineo-post-author + .merineo-article-intro__facts {
	padding-left: 24px;
	border-left: 1px solid var(--wp--custom--line--on-ink);
}

@media (max-width: 559px) {

	.merineo-article-intro__meta > .merineo-post-author + .merineo-article-intro__facts {
		width: 100%;
		padding-left: 0;
		border-left: 0;
	}
}

/* ---------------------------------------------------------------------------
 * Article body: reading typography on paper.
 * ------------------------------------------------------------------------ */

.merineo-article .merineo-article__image img {
	border-radius: var(--wp--custom--radius--base);
}

.merineo-article__content {
	font-size: 18px;
	line-height: 1.7;
}

.merineo-article__content > :where(h2, h3, h4, h5, h6) {
	margin-top: 1.9em;
	margin-bottom: 0;
	line-height: 1.12;
}

.merineo-article__content > :where(h2, h3, h4, h5, h6) + * {
	margin-top: 16px;
}

.merineo-article__content > h2 {
	font-size: var(--wp--preset--font-size--xx-large);
}

.merineo-article__content > h3 {
	font-size: var(--wp--preset--font-size--x-large);
}

.merineo-article__content > h4 {
	font-size: var(--wp--preset--font-size--large);
}

.merineo-article__content > :first-child {
	margin-top: 0;
}

.merineo-article__content :where(ul, ol) {
	padding-left: 1.3em;
}

.merineo-article__content :where(ul, ol) > li + li {
	margin-top: 8px;
}

.merineo-article__content li::marker {
	font-weight: 700;
	color: var(--wp--preset--color--blue-deep);
}

.merineo-article__content a:where(:not(.wp-element-button)) {
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.merineo-article__content :where(.wp-block-quote, .wp-block-pullquote) {
	margin-top: 40px;
	margin-bottom: 40px;
	padding: 4px 0 4px 28px;
	border-left: var(--wp--custom--rule--height) solid var(--wp--preset--color--blue-deep);
	color: var(--wp--preset--color--ink);
}

.merineo-article__content .wp-block-pullquote {
	padding: 0;
	border-left: 0;
	text-align: left;
}

.merineo-article__content .wp-block-pullquote blockquote {
	padding: 4px 0 4px 28px;
	border-left: var(--wp--custom--rule--height) solid var(--wp--preset--color--amber);
}

.merineo-article__content :where(.wp-block-quote, .wp-block-pullquote) p {
	margin: 0;
}

.merineo-article__content :where(.wp-block-quote, .wp-block-pullquote) cite {
	display: block;
	margin-top: 16px;
	color: var(--wp--preset--color--slate);
}

.merineo-article__content figure.wp-block-image img {
	border-radius: var(--wp--custom--radius--base);
}

.merineo-article__content .wp-element-caption {
	margin-top: 12px;
	margin-bottom: 0;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	text-align: left;
}

.merineo-article__content .wp-block-table {
	overflow-x: auto;
}

.merineo-article__content .wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15.5px;
	line-height: 1.5;
	background: var(--wp--preset--color--white);
}

.merineo-article__content .wp-block-table :is(th, td) {
	padding: 12px 16px;
	border: 0;
	border-bottom: 1px solid var(--wp--custom--line--on-light);
	text-align: left;
}

.merineo-article__content .wp-block-table thead {
	border-bottom: 0;
}

.merineo-article__content .wp-block-table th {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--slate);
	border-bottom-color: var(--wp--preset--color--ink);
}

.merineo-article__content .wp-block-code {
	padding: 20px 24px;
	overflow-x: auto;
	border: 0;
	border-radius: var(--wp--custom--radius--base);
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--sky);
	font-size: 15px;
	line-height: 1.6;
}

.merineo-article__content :not(pre) > code {
	padding: 2px 6px;
	border-radius: var(--wp--custom--radius--base);
	background: rgba(11, 13, 23, 0.06);
	font-size: 0.88em;
}

.merineo-article__content .wp-block-separator {
	margin-top: 48px;
	margin-bottom: 48px;
	color: var(--wp--preset--color--sky);
}

/* Complianz documents (cookie and privacy policy) inside page content; the id selector
 * outranks the plugin document stylesheet (#cmplz-document …). */
.merineo-article__content #cmplz-document {
	max-width: none;
	font-size: inherit;
	line-height: inherit;
}

.merineo-article__content #cmplz-document :is(h2, h3, h4) {
	margin-top: 1.9em;
	margin-bottom: 0;
	line-height: 1.12;
	text-transform: uppercase;
}

.merineo-article__content #cmplz-document h2 {
	font-size: var(--wp--preset--font-size--x-large);
}

.merineo-article__content #cmplz-document :is(h3, h4) {
	font-size: var(--wp--preset--font-size--large);
}

.merineo-article__content #cmplz-document :is(h2, h3, h4) + * {
	margin-top: 12px;
}

.merineo-article__content #cmplz-document > :first-child {
	margin-top: 0;
}

.merineo-article__content #cmplz-document :is(p, li, td) {
	font-size: inherit;
	line-height: inherit;
}

.merineo-article__content #cmplz-document p {
	margin-top: 16px;
	margin-bottom: 0;
}

.merineo-article__content #cmplz-document table {
	width: 100%;
	border-collapse: collapse;
}

.merineo-article__content #cmplz-document :is(th, td) {
	font-size: 15px;
}

.merineo-article__content #cmplz-document :is(th, td) {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid var(--wp--custom--line--on-light);
}

/* Tags: outline pills after the content. */
.merineo-article__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.merineo-article__tags .wp-block-post-terms__prefix {
	margin-right: 8px;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--wp--preset--color--slate);
}

.merineo-article__tags .wp-block-post-terms__separator {
	display: none;
}

.merineo-article__tags a {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 6px 14px;
	border: 1px solid rgba(11, 13, 23, 0.28);
	border-radius: var(--wp--custom--radius--pill);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	line-height: 1.2;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.merineo-article__tags a:hover {
	border-color: var(--wp--preset--color--blue-deep);
	color: var(--wp--preset--color--blue-deep);
}

/* ---------------------------------------------------------------------------
 * Related posts: hidden when the query found no other post.
 * ------------------------------------------------------------------------ */

.merineo-related:not(:has(.merineo-related__list)) {
	display: none;
}

.merineo-related__head > * {
	margin: 0;
}

/* Three columns on desktop, two (without the third post) on tablets, one on phones. */
.wp-block-post-template.merineo-related__list {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1039px) {

	.wp-block-post-template.merineo-related__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.merineo-related__list > li:nth-child(n + 3) {
		display: none;
	}
}

@media (max-width: 759px) {

	.wp-block-post-template.merineo-related__list {
		grid-template-columns: minmax(0, 1fr);
	}

	.merineo-related__list > li:nth-child(n + 3) {
		display: block;
	}
}

/* ---------------------------------------------------------------------------
 * Search results: rows separated by hairlines; the title link covers the row.
 * ------------------------------------------------------------------------ */

.merineo-search__list {
	max-width: 840px;
	padding: 0;
	list-style: none;
}

.merineo-search__list > li {
	margin: 0;
	border-top: 1px solid var(--wp--custom--line--on-light);
}

.merineo-search__list > li:last-child {
	border-bottom: 1px solid var(--wp--custom--line--on-light);
}

.merineo-search__item {
	position: relative;
	padding: 28px 0;
}

.merineo-search__item > * {
	margin-block: 0;
}

.merineo-search__item .merineo-search__title {
	line-height: 1.12;
}

.merineo-search__item .merineo-search__title a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.merineo-search__item .merineo-search__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.merineo-search__item:hover .merineo-search__title a {
	color: var(--wp--preset--color--blue-deep);
}

.merineo-search__item .merineo-search__excerpt {
	font-size: 15.5px;
	line-height: 1.6;
	color: rgba(11, 13, 23, 0.72);
}

.merineo-search__excerpt .wp-block-post-excerpt__excerpt {
	margin: 0;
}

.merineo-search .wp-block-query-no-results > .is-style-lead {
	margin: 0;
}

@media (prefers-reduced-motion: reduce) {

	.merineo-post-card:hover {
		transform: none;
	}

	.merineo-post-card:hover .merineo-post-card__image img {
		transform: none;
	}
}
