/*
 * Cards (VISUAL_ACCEPTANCE.md CA01–CA07; references R3 cases, R6 resources).
 *
 * Photo on top, a small tracked context label, a short strong title and a
 * quiet action. The card body is untextured Warm White, which reads lighter
 * than the textured page, as in the reference, without a new colour. No
 * borders or shadows (CA02). Image heights are equal within a row (CA03):
 * a fixed aspect ratio per card family, measured in the panels (R3 cases
 * 1.68, R6 resources 2.4).
 *
 * One link per card: the title link is stretched over the card, so the card
 * has one tab stop and no nested links (CA06); the action text is visual only.
 * Focus draws the ring around the whole card.
 *
 * Grid: three per row on desktop (never more, CA01), two on tablet, one on
 * narrow screens (MO06).
 */

:is(.is-style-cards, .is-style-cards-resource) .fct-cards {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--m);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 899.98px) {
	:is(.is-style-cards, .is-style-cards-resource) .fct-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 599.98px) {
	:is(.is-style-cards, .is-style-cards-resource) .fct-cards {
		grid-template-columns: minmax(0, 1fr);
	}
}

:is(.is-style-cards, .is-style-cards-resource) .fct-cards > li {
	display: flex;
	margin: 0;
}

.fct-card {
	--fct-card-ratio: 1.68;

	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	margin: 0;
	overflow: hidden;
	border-radius: 10px;
	background: var(--wp--preset--color--warm-white);
	box-shadow: none;
}

.is-style-cards-resource .fct-card {
	--fct-card-ratio: 2.4;
}

/* The card spaces its own parts; no block-gap margins between them. */
.fct-card > *,
.fct-card__body > * {
	margin-block: 0;
}

.fct-card__image {
	margin: 0;
}

.fct-card__image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--fct-card-ratio);
	object-fit: cover;
}

.fct-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--wp--preset--spacing--xs);
	padding: var(--wp--preset--spacing--m);
}

.fct-card__label {
	margin: 0;
	color: var(--wp--preset--color--forest);
	font-family: var(--wp--preset--font-family--display);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.14em;
	line-height: 1.2;
	text-transform: uppercase;
}

.fct-card__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--card);
	line-height: 1.15;
}

.fct-card__title a {
	color: var(--wp--preset--color--charcoal);
	text-decoration: none;
}

/* Stretch the one link over the whole card. */
.fct-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.fct-card__title a:focus-visible {
	outline: none;
}

.fct-card:has(.fct-card__title a:focus-visible) {
	outline: 3px solid var(--wp--preset--color--forest);
	outline-offset: 3px;
}

.fct-card__more {
	margin: auto 0 0;
	padding-top: var(--wp--preset--spacing--xs);
	font-size: 16px;
}

.fct-card:hover .fct-card__title a {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.15em;
}

.fct-card:hover .fct-card__more::after {
	transform: translateX(2px);
}

/*
 * Pagination under an overview: quiet, like the navigation. The current page
 * carries the same short Gold marker as the current menu item (H05); every
 * target is at least 44 px.
 */
.wp-block-query-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--xs) var(--wp--preset--spacing--m);
	margin-top: var(--wp--preset--spacing--l);
	font-size: 16px;
}

.wp-block-query-pagination-numbers {
	display: flex;
	gap: var(--wp--preset--spacing--2-xs);
}

.wp-block-query-pagination :is(a, .page-numbers) {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	color: var(--wp--preset--color--charcoal);
	font-weight: 500;
}

.wp-block-query-pagination-numbers .page-numbers.current {
	color: var(--wp--preset--color--forest);
	font-weight: 700;
}

.wp-block-query-pagination-numbers .page-numbers.current::after {
	content: "";
	position: absolute;
	inset-inline: 12px;
	bottom: 6px;
	height: 4px;
	border-radius: 3px 2px 3px 2px;
	background: var(--wp--preset--color--gold);
}

/* --- Search results and 404 (Phase 5j) -------------------------------------------------------------------------
 * The utility pages in the house style without new components: the theme's H1, the search field in the reading
 * column, the results as a quiet editorial list (the card label, the title as the one link, a teaser; a hairline
 * between items) instead of cards, the theme's pagination, and the arrow link of the destination pages. */

.fct-utility {
	padding-block: clamp(24px, 4vw, 48px) clamp(64px, 8vw, 112px);
}

.fct-utility .fct-utility__title {
	margin-block: 0;
	overflow-wrap: anywhere;
}

.fct-utility .fct-utility__lead {
	margin-block-start: 20px;
	font-size: clamp(17px, 16px + 0.3vw, 20px);
	line-height: 1.55;
}

.fct-utility .wp-block-search {
	margin-block-start: clamp(28px, 4vw, 40px);
}

.fct-utility .wp-block-search__inside-wrapper {
	max-width: 760px;
}

.fct-utility .fct-utility__results {
	margin-block-start: clamp(40px, 6vw, 64px);
}

.fct-utility .fct-utility__list {
	max-width: 760px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.fct-utility .fct-utility__list > li {
	margin: 0;
	border-top: 1px solid rgb(18 56 61 / 0.18);
}

.fct-utility .fct-utility__list > li:last-child {
	border-bottom: 1px solid rgb(18 56 61 / 0.18);
}

.fct-utility .fct-utility__item {
	padding-block: clamp(22px, 3vw, 30px);
}

.fct-utility .fct-utility__item > * {
	margin-block: 0;
}

.fct-utility .fct-utility__item-title {
	margin-block-start: 10px;
	font-size: clamp(22px, 19px + 0.9vw, 30px);
	line-height: 1.15;
	letter-spacing: -0.01em;
}

.fct-utility .fct-utility__item-title a {
	color: var(--wp--preset--color--forest);
	text-decoration: none;
	text-underline-offset: 0.16em;
}

.fct-utility .fct-utility__item-title a:hover {
	text-decoration: underline;
}

.fct-utility .fct-utility__teaser {
	max-width: 66ch;
	margin-block-start: 10px;
	color: var(--wp--preset--color--charcoal);
	font-size: 17px;
	line-height: 1.55;
}

.fct-utility .fct-utility__teaser .wp-block-post-excerpt__excerpt {
	margin: 0;
}

.fct-utility .wp-block-query-pagination {
	max-width: 760px;
	margin-block-start: clamp(32px, 4vw, 48px);
}

.fct-utility .wp-block-query-no-results > p:first-child {
	margin-block-start: 0;
	font-size: clamp(17px, 16px + 0.3vw, 20px);
	font-weight: 600;
}

.fct-utility .fct-utility__home {
	margin-block-start: 28px;
}

/* The destination pages' quiet arrow link (pages.css, .fct-wwd-link). */
.fct-utility .fct-utility__home a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--wp--preset--color--forest);
	font-weight: 600;
	text-decoration: none;
	text-underline-offset: 4px;
}

.fct-utility .fct-utility__home a::after {
	content: "";
	width: 16px;
	height: 16px;
	background-color: currentColor;
	-webkit-mask: var(--fct-button-arrow) center / contain no-repeat;
	mask: var(--fct-button-arrow) center / contain no-repeat;
	transition: transform 180ms ease;
}

.fct-utility .fct-utility__home a:hover {
	text-decoration: underline;
}

.fct-utility .fct-utility__home a:hover::after {
	transform: translateX(2px);
}

@media (prefers-reduced-motion: reduce) {
	.fct-utility .fct-utility__home a::after {
		transition: none;
	}
}
