/**
 * Results pages: search.php (and the archive/index loops that share its
 * template-parts). Loaded only there -- see un_theme_results_assets() in
 * inc/enqueue.php.
 *
 * Fixes on top of the vendored CSS + plain Bootstrap cards:
 *  - the title block (a `.page-heading`) no longer inherits the site
 *    header's navy background (see header-overrides.css);
 *  - thumbnails are locked to one aspect ratio (uploads predate the
 *    `un-card` crop size, so WP serves whatever size it has);
 *  - a card with no thumbnail gets a placeholder tile so rows line up;
 *  - the refine-search box gets the header search's look (the vendored
 *    white-text rules are scoped to `.top-menu` / `.mob-menu`).
 *
 * @package Uni_Theme
 */

.results-page {
	padding: 3rem 0 5rem;
}

/* --- Heading --- */

.results-heading {
	max-width: 720px;
	margin: 0 0 2.5rem;
	padding: 0 0 2rem;
	border-bottom: 1px solid #e6e2d8;
}

.results-heading__eyebrow {
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.results-heading__title {
	margin: 0 0 0.5rem;
	font-size: clamp(1.6rem, 3.5vw, 2.25rem);
	font-weight: 700;
	line-height: 1.25;
	color: var(--blue, #231a64);
	overflow-wrap: anywhere;
}

.results-heading__query {
	padding: 0 0.15em;
	background: var(--cream2, #f7efd1);
	color: var(--blue, #231a64);
	border-radius: 0.25em;
}

.results-heading__count {
	margin: 0 0 1.5rem;
	color: #666;
}

.results-heading__count strong {
	color: var(--blue, #231a64);
}

/* Refine search: header look. */
.results-heading__search {
	max-width: 480px;
}

.results-heading__search .search-block-form {
	width: 100%;
}

.results-heading__search .input-group {
	width: 100%;
	margin: 0;
	padding: 4px 8px 4px 20px;
	background: var(--blue, #231a64) !important;
	border-radius: 2rem;
	align-items: center;
	flex-wrap: nowrap;
}

.results-heading__search .input-group input,
.results-heading__search .input-group input:focus {
	flex: 1 1 auto;
	height: auto;
	padding: 10px 2px;
	color: #fff;
	background: transparent;
	border: 0;
	border-radius: 0 !important;
	box-shadow: none;
	font-size: 1rem;
}

.results-heading__search .input-group input::placeholder {
	color: rgba(255, 255, 255, 0.7);
}

.results-heading__search .input-group .btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--yellow, #ddb14d);
	color: var(--blue, #231a64);
	transition: background-color 0.2s ease;
}

.results-heading__search .input-group .btn:hover,
.results-heading__search .input-group .btn:focus-visible {
	background: var(--lyellow, #e8ca59);
	color: var(--blue, #231a64);
}

/* --- Toolbar: type filter chips + sort --- */

.results-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 2rem;
	margin: 0 0 1.25rem;
}

.results-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.results-filter__chip {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.45rem 0.95rem;
	border: 1px solid #e6e2d8;
	border-radius: 50px;
	background: #fff;
	color: var(--blue, #231a64);
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.results-filter__chip:hover {
	border-color: var(--blue, #231a64);
	color: var(--blue, #231a64);
}

.results-filter__chip.is-active {
	border-color: var(--blue, #231a64);
	background: var(--blue, #231a64);
	color: #fff;
}

.results-filter__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5em;
	padding: 0.1em 0.45em;
	border-radius: 50px;
	background: var(--cream2, #f7efd1);
	color: var(--blue, #231a64);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.4;
}

.results-filter__chip.is-active .results-filter__count {
	background: var(--yellow, #ddb14d);
}

.results-sort {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.875rem;
}

.results-sort__label {
	margin-right: 0.35rem;
	color: #777;
}

.results-sort__link {
	padding: 0.3rem 0.6rem;
	border-radius: 50px;
	color: var(--blue, #231a64);
	font-weight: 500;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.results-sort__link:hover {
	background: var(--cream, #f6f2e8);
	color: var(--blue, #231a64);
}

.results-sort__link.is-active {
	background: var(--cream2, #f7efd1);
	font-weight: 700;
}

.results-showing {
	margin: 0 0 1rem;
	font-size: 0.875rem;
	color: #777;
}

/* Query-term highlight inside titles/snippets. */
.search-hl {
	padding: 0 0.05em;
	background: var(--cream2, #f7efd1);
	color: inherit;
	border-radius: 0.2em;
	box-shadow: inset 0 -2px 0 var(--yellow, #ddb14d);
}

/* --- Cards --- */

.result-card {
	overflow: hidden;
	border: 1px solid #e9e6df;
	border-radius: 14px;
	background: #fff;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 14px 30px rgba(35, 26, 100, 0.12);
}

.result-card__media {
	display: block;
	position: relative;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--cream, #f6f2e8);
}

.result-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
	transition: transform 0.4s ease;
}

.result-card:hover .result-card__media img {
	transform: scale(1.04);
}

.result-card__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 2.5rem;
	color: rgba(35, 26, 100, 0.25);
	background: linear-gradient(135deg, var(--cream, #f6f2e8), var(--cream2, #f7efd1));
}

.result-card .card-body {
	display: flex;
	flex-direction: column;
	padding: 1.25rem 1.25rem 1.35rem;
}

.result-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 0.6rem;
	margin-bottom: 0.75rem;
}

.result-card__badge {
	padding: 0.35em 0.7em;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--blue, #231a64);
	background: var(--cream2, #f7efd1);
	border-radius: 50px;
}

.result-card__badge--type {
	position: absolute;
	top: 12px;
	left: 12px;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.result-card__badge--cat {
	color: #fff;
	background: var(--blue, #231a64);
}

.result-card__date,
.result-card__read {
	font-size: 0.8rem;
	color: #777;
}

.result-card__read::before {
	content: "\00b7";
	margin-right: 0.6rem;
	color: #bbb;
}

.result-card__title {
	margin: 0 0 0.6rem;
	font-size: 1.1rem;
	font-weight: 700;
	line-height: 1.35;
}

.result-card__title a {
	color: var(--blue, #231a64);
}

.result-card__title a:hover {
	color: var(--lblue, #2c2872);
	text-decoration: underline !important;
}

.result-card__excerpt {
	margin: 0 0 1rem;
	font-size: 0.95rem;
	line-height: 1.6;
	color: #555;
}

.result-card__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: auto;
	padding-top: 0.85rem;
	border-top: 1px solid #f0ede6;
}

.result-card__author {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-width: 0;
	overflow: hidden;
	font-size: 0.8rem;
	color: #666;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.result-card__author i {
	color: var(--yellow, #ddb14d);
}

.result-card__more {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	gap: 0.5rem;
	margin-left: auto;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--blue, #231a64);
	text-decoration: none;
}

.result-card__more i {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--yellow, #ddb14d);
	color: var(--blue, #231a64);
	font-size: 0.75rem;
	transition: transform 0.2s ease;
}

.result-card__more:hover {
	color: var(--blue, #231a64);
}

.result-card__more:hover i {
	transform: translateX(3px);
}

/* --- Empty state --- */

.no-results {
	max-width: 520px;
	margin: 2rem auto 0;
	text-align: center;
}

.no-results__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	margin-bottom: 1.25rem;
	border-radius: 50%;
	background: var(--cream, #f6f2e8);
	color: var(--blue, #231a64);
	font-size: 1.6rem;
}

.no-results__title {
	margin: 0 0 0.75rem;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--blue, #231a64);
}

.no-results__text {
	margin: 0 0 1.5rem;
	line-height: 1.6;
	color: #555;
	overflow-wrap: anywhere;
}

.no-results__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
}

.no-results__actions .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: static;
	width: auto;
	padding: 10px 22px;
	border-radius: 50px;
	font-weight: 500;
}

.no-results__actions .btn-primary {
	background: var(--blue, #231a64);
	border-color: var(--blue, #231a64);
	color: #fff;
}

.no-results__actions .btn-outline-primary {
	background: transparent;
	border: 1px solid var(--blue, #231a64);
	color: var(--blue, #231a64);
}

.no-results__actions .btn-outline-primary:hover {
	background: var(--blue, #231a64);
	color: #fff;
}

/* --- Empty-state suggestions --- */

.results-suggest {
	margin-top: 3.5rem;
	padding-top: 2.5rem;
	border-top: 1px solid #e6e2d8;
}

.results-suggest__title {
	margin: 0 0 1.25rem;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--blue, #231a64);
}

.results-suggest__topics {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* --- Pagination --- */

.results-pagination .pagination {
	gap: 0.4rem;
}

.results-pagination .page-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 0.75rem;
	border: 1px solid #e6e2d8;
	border-radius: 50px !important;
	background: #fff;
	color: var(--blue, #231a64);
	font-weight: 500;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.results-pagination .page-link:hover {
	background: var(--cream, #f6f2e8);
	color: var(--blue, #231a64);
}

.results-pagination .page-item.active .page-link {
	background: var(--blue, #231a64);
	border-color: var(--blue, #231a64);
	color: #fff;
}

.results-pagination .page-link.dots {
	border-color: transparent;
	background: transparent;
}

@media (max-width: 575.98px) {
	.results-page {
		padding: 2rem 0 3.5rem;
	}

	/* One scrollable row of chips. `min-width: 0` + a fixed 100% basis
	 * stop the nowrap row's min-content width from widening the page. */
	.results-filter {
		flex: 0 0 100%;
		width: 100%;
		min-width: 0;
		flex-wrap: nowrap;
		padding-bottom: 4px;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.results-filter::-webkit-scrollbar {
		display: none;
	}

	.no-results__actions .btn {
		width: 100%;
	}
}
