/* Shared cards, 404 and search pages (PLAN.md Phase 5b D62/D63, Phase 5c D64-D70). Only what the theme lacks: hero search, card image, focus rings. Square corners, no shadows. */

/* Hero search: large white text on the navy band, underline only. */
.tt-band .wp-block-search,
.tt-404-hero .wp-block-search {
	margin-block-start: var(--wp--preset--spacing--40);
}

.tt-band .wp-block-search__label,
.tt-404-hero .wp-block-search__label {
	display: block;
	margin-block-end: var(--wp--preset--spacing--10);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 2.24px;
	text-transform: uppercase;
	color: var(--wp--preset--color--base);
}

.tt-band .wp-block-search__inside-wrapper,
.tt-404-hero .wp-block-search__inside-wrapper {
	padding: 0;
	border: 0;
	border-bottom: 2px solid var(--wp--preset--color--base);
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

.tt-band .wp-block-search__input,
.tt-404-hero .wp-block-search__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 14px 8px 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 400;
}

.tt-band .wp-block-search__input::placeholder,
.tt-404-hero .wp-block-search__input::placeholder {
	color: var(--wp--preset--color--base);
	opacity: 0.75;
}

.tt-band .wp-block-search__input:focus-visible,
.tt-404-hero .wp-block-search__input:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-1) !important;
	outline-offset: 4px;
}

.tt-band .wp-block-search__button,
.tt-404-hero .wp-block-search__button {
	padding: 0 14px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--wp--preset--color--base);
	cursor: pointer;
}

.tt-band .wp-block-search__button svg,
.tt-404-hero .wp-block-search__button svg,
.tt-band .wp-block-search__button img,
.tt-404-hero .wp-block-search__button img {
	width: 1.5rem;
	height: 1.5rem;
	fill: currentColor;
}

/* Headlines: avoid a lone last word on its own line. */
.tt-band h1,
.tt-404-hero h1,
.tt-404-suggestions .h3 {
	text-wrap: balance;
}

.tt-band .wp-block-search__button:focus-visible,
.tt-404-hero .wp-block-search__button:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-1);
	outline-offset: 2px;
}

/* Suggestions section. */
.tt-404-suggestions {
	display: block;
}

/* Card grids: the 404 group grid and the search query loop (core grid, 3 columns, 18rem minimum). */
.tt-card-grid,
.tt-404-suggestions .tt-404-grid,
.tt-results .wp-block-post-template {
	gap: var(--wp--preset--spacing--40);
}

.tt-results .wp-block-post-template {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tt-results .wp-block-post-template > li.wp-block-post {
	display: flex;
	flex-direction: column;
	margin: 0;
}

@media (max-width: 781px) {
	.tt-card-grid,
	.tt-404-suggestions .tt-404-grid,
	.tt-results .wp-block-post-template {
		grid-template-columns: 1fr;
	}
}

/* Equal-height cards: the navy panel grows to fill the card, so a long title does not leave a short card. */
.tt-card,
.tt-404-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	/* The inset accent line (border-inset:before) inherits this colour: white, as on the site's other cards. */
	border-color: var(--wp--preset--color--base);
}

.tt-card > .is-style-dark-1,
.tt-404-card > .is-style-dark-1 {
	flex: 1 1 auto;
}

/* Card: 4:3 image, one link, ring on the card when the link is focused. */
.tt-card .wp-block-image,
.tt-card .wp-block-image img,
.tt-card .wp-block-post-featured-image,
.tt-card .wp-block-post-featured-image img,
.tt-404-card .wp-block-image,
.tt-404-card .wp-block-image img {
	display: block;
	width: 100%;
	margin: 0;
}

.tt-card .wp-block-image img,
.tt-card .wp-block-post-featured-image img,
.tt-404-card .wp-block-image img {
	aspect-ratio: 4 / 3;
	object-fit: cover;
	height: auto;
}

.tt-card .wp-block-heading a,
.tt-card .wp-block-post-title a,
.tt-404-card .wp-block-heading a {
	color: inherit;
	text-decoration: none;
}

.tt-card:focus-within,
.tt-404-card:focus-within {
	outline: 3px solid var(--wp--preset--color--accent-1);
	outline-offset: 3px;
}

.tt-card .wp-block-heading a:focus-visible,
.tt-card .wp-block-post-title a:focus-visible,
.tt-404-card .wp-block-heading a:focus-visible {
	outline: none;
}

/* "Learn more": plain text, not a link. The 404 span already draws its arrow (is-style-text-arrow-light). */
.tt-card-more {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

.tt-results .tt-card-more::after {
	content: "\2192";
	margin-inline-start: 0.5em;
}

/* Search results. */
/* No results: the message keeps the narrow column of the band above; the 3 suggestion cards use the wide width. */
.tt-results .wp-block-query-no-results > p {
	max-width: 780px;
	margin-inline: auto;
}

.tt-results .wp-block-query-no-results .tt-404-suggestions {
	margin-block-start: var(--wp--preset--spacing--60);
}

.tt-results .wp-block-query-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin-block-start: var(--wp--preset--spacing--50);
}

.tt-results .wp-block-query-pagination-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
}

.tt-results .wp-block-query-pagination .page-numbers,
.tt-results .wp-block-query-pagination-previous,
.tt-results .wp-block-query-pagination-next {
	display: inline-block;
	margin: 0;
	padding: 10px 16px;
	border: 2px solid var(--wp--preset--color--main);
	border-radius: 0;
	background: transparent;
	color: var(--wp--preset--color--main);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
}

.tt-results .wp-block-query-pagination .page-numbers.current {
	background: var(--wp--preset--color--main);
	color: var(--wp--preset--color--base);
}

.tt-results .wp-block-query-pagination a:hover {
	background: var(--wp--preset--color--secondary);
}

.tt-results .wp-block-query-pagination a:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-1);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.tt-card.hover-image .wp-block-image > img,
	.tt-card.hover-image:hover .wp-block-image > img,
	.tt-card.hover-image .wp-block-post-featured-image img,
	.tt-card.hover-image:hover .wp-block-post-featured-image img {
		transition: none;
		transform: none;
	}
}
