/* RootsPersona search box and results. Colours follow the template colour set
   (--rp-*) when the theme or the plugin defines it, with neutral fallbacks. */

.rp-search {
	position: relative;
	display: flex;
	align-items: stretch;
	max-width: 100%;
	box-sizing: border-box;
}

.rp-search *,
.rp-search *::before,
.rp-search *::after {
	box-sizing: border-box;
}

.rp-search__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.5em 0.75em;
	font: inherit;
	color: inherit;
	background: var(--rp-card, #fff);
	border: 1px solid var(--rp-line, #c9c3b8);
	border-right: 0;
	border-radius: var(--rp-radius-sm, 4px) 0 0 var(--rp-radius-sm, 4px);
}

.rp-search__input:focus {
	outline: 2px solid var(--rp-accent, #8a5a2b);
	outline-offset: -1px;
}

.rp-search__button {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 0.8em;
	cursor: pointer;
	color: var(--rp-accent-ink, #fff);
	background: var(--rp-accent, #8a5a2b);
	border: 1px solid var(--rp-accent, #8a5a2b);
	border-radius: 0 var(--rp-radius-sm, 4px) var(--rp-radius-sm, 4px) 0;
}

.rp-search__panel {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	min-width: min(22rem, 90vw);
	max-height: 70vh;
	overflow-y: auto;
	z-index: 1000;
	color: var(--rp-ink, #2b2721);
	background: var(--rp-card, #fff);
	border: 1px solid var(--rp-line, #c9c3b8);
	border-radius: var(--rp-radius-sm, 4px);
	box-shadow: var(--rp-shadow, 0 8px 24px rgba(0, 0, 0, 0.15));
	text-align: left;
	line-height: 1.35;
}

.rp-search__panel[hidden] {
	display: none;
}

.rp-search__group {
	padding: 0.35em 0;
}

.rp-search__group + .rp-search__group {
	border-top: 1px solid var(--rp-line, #e2ddd4);
}

.rp-search__heading {
	padding: 0.35em 0.9em 0.2em;
	font-size: 0.75em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--rp-muted, #6f675c);
}

.rp-search__item {
	display: block;
	padding: 0.45em 0.9em;
	color: inherit;
	text-decoration: none;
}

.rp-search__item:hover,
.rp-search__item[aria-selected="true"] {
	background: var(--rp-accent-soft, #f1e8dc);
}

.rp-search__name {
	font-weight: 600;
}

.rp-search__years,
.rp-search__type {
	margin-left: 0.4em;
	font-size: 0.85em;
	color: var(--rp-muted, #6f675c);
	white-space: nowrap;
}

.rp-search__place,
.rp-search__note,
.rp-search__excerpt {
	display: block;
	font-size: 0.82em;
	color: var(--rp-muted, #6f675c);
}

.rp-search__more,
.rp-search__empty {
	display: block;
	padding: 0.55em 0.9em;
	border-top: 1px solid var(--rp-line, #e2ddd4);
	font-size: 0.9em;
}

.rp-search__more {
	color: var(--rp-accent, #8a5a2b);
	text-decoration: none;
	font-weight: 600;
}

.rp-search__more[aria-selected="true"],
.rp-search__more:hover {
	background: var(--rp-accent-soft, #f1e8dc);
}

.rp-search__empty {
	color: var(--rp-muted, #6f675c);
	border-top: 0;
}

/* Full results page */
.rp-search-results .rp-search {
	margin-bottom: 1.5em;
}

.rp-search-results__group {
	margin-bottom: 2em;
}

.rp-search-results__group h2 {
	font-size: 1.2em;
	margin: 0 0 0.6em;
}

.rp-search-results__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.rp-search-results__item {
	padding: 0.55em 0;
	border-bottom: 1px solid var(--rp-line, #e2ddd4);
}

.rp-search-results__item .rp-search__note,
.rp-search-results__item .rp-search__place,
.rp-search-results__item .rp-search__excerpt {
	display: inline;
}

.rp-search-results__pager {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em;
	margin-top: 0.8em;
}

.rp-search-results__pager a,
.rp-search-results__pager span {
	padding: 0.15em 0.55em;
	border: 1px solid var(--rp-line, #e2ddd4);
	border-radius: var(--rp-radius-sm, 4px);
	text-decoration: none;
}

.rp-search-results__pager span[aria-current] {
	background: var(--rp-accent, #8a5a2b);
	border-color: var(--rp-accent, #8a5a2b);
	color: var(--rp-accent-ink, #fff);
}
