/* AFSCME Resolutions Search
 * Rebuild of the legacy AMPS `.amendments-search` box, on-brand for the new
 * site: a green search bar with a white field + white icon, hover-darkens.
 */

:root {
	--afscme-rs-green: #00954c;
	--afscme-rs-green-dark: #006637;
	--afscme-rs-blue: #005daa;
}

.amendments-search {
	margin: 1rem 0 2.5rem;
}

.amendments-search-form {
	display: flex;
	align-items: stretch;
	width: 100%;
	background: var(--afscme-rs-green);
	border: 1px solid var(--afscme-rs-green);
	border-radius: 4px;
	overflow: hidden;
	transition: background 0.3s cubic-bezier(.57, .2, .21, .89), border-color 0.3s cubic-bezier(.57, .2, .21, .89);
}

.amendments-search-form:hover {
	background: var(--afscme-rs-green-dark);
	border-color: var(--afscme-rs-green-dark);
}

/* Focused field: white fill, dark-green text/icon, pulsating green stroke —
 * matches the site-wide search field (afscme-search-tuning). */
.amendments-search-form:focus-within {
	background: #fff;
	border-color: transparent;
	animation: afscme-search-pulse 1.4s cubic-bezier(.57, .2, .21, .89) infinite;
}

.amendments-search-form:focus-within .amendments-search-field,
.amendments-search-form:focus-within .amendments-search-field::placeholder {
	color: var(--afscme-rs-green-dark);
	transition: color 0.3s cubic-bezier(.57, .2, .21, .89);
}

.amendments-search-form:focus-within .amendments-search-button-svg {
	fill: var(--afscme-rs-green-dark);
}

@keyframes afscme-search-pulse {
	0%, 100% { box-shadow: 0 0 0 2px var(--afscme-rs-green, #00954c); }
	50% { box-shadow: 0 0 0 5px var(--afscme-rs-green, #00954c); }
}

@media (prefers-reduced-motion: reduce) {
	.amendments-search-form:focus-within,
	.afscme-search-sort select:focus {
		animation: none;
		box-shadow: 0 0 0 2px var(--afscme-rs-green, #00954c);
	}
}

/* Visually-hidden label that becomes visible on keyboard focus. */
.amendments-search-label {
	clip: rect(1px, 1px, 1px, 1px);
	position: absolute !important;
	height: 1px;
	width: 1px;
	overflow: hidden;
	word-wrap: normal !important;
}

.amendments-search-label:focus {
	background: var(--afscme-rs-blue);
	color: #fff;
	clip: auto !important;
	display: inline-block;
	font-size: 1rem;
	height: auto;
	width: auto;
	position: absolute;
	left: 0;
	top: 0;
	z-index: 100000;
	line-height: normal;
	padding: 0.5rem;
}

.amendments-search-field {
	flex: 1 1 auto;
	min-width: 0;
	background: transparent;
	border: 0;
	padding: 1rem 1.25rem;
	font-family: "Open Sans", sans-serif;
	font-size: 1.2rem;
	color: #fff;
	-webkit-appearance: none;
	appearance: none;
}

.amendments-search-field::-webkit-search-cancel-button,
.amendments-search-field::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.amendments-search-field::-ms-clear {
	display: none;
	width: 0;
	height: 0;
}

.amendments-search-field:focus {
	outline: none;
}

.amendments-search-field::placeholder {
	color: rgba(255, 255, 255, 0.85);
	opacity: 1;
}

/* On phones the 1.2rem placeholder ("Search Resolutions & Amendments") is wider
 * than the field and gets clipped behind the search button. Shrink the field
 * text and tighten the padding so the full placeholder fits, and ellipsize as a
 * final guard. (Brandon: "placeholder text cutting off".) */
@media (max-width: 47.99em) {
	.amendments-search-field {
		font-size: 1rem;
		padding: 0.85rem 0.25rem 0.85rem 1rem;
		text-overflow: ellipsis;
	}
	.amendments-search-button {
		flex-basis: 2.75rem;
		padding: 0 0.75rem;
	}
}

.amendments-search-button {
	flex: 0 0 3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: transparent;
	cursor: pointer;
	padding: 0 1rem;
	transition: opacity 0.3s ease;
}

.amendments-search-button:hover,
.amendments-search-button:focus {
	opacity: 0.85;
}

.amendments-search-button-svg {
	width: 1.25rem;
	height: 1.5rem;
	max-height: 1.5rem;
	fill: #fff;
}

/* Results list */
.resolutions-results {
	margin-top: 1.5rem;
}

.resolutions-results-summary {
	font-family: "Open Sans", sans-serif;
	color: #555;
	margin-bottom: 1.25rem;
	text-align: center;
	font-size: var(--wp--preset--font-size--small);
}

/* Summary + sort control on one row (summary left, sort right). */
.resolutions-results-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: .5rem 1.25rem;
	margin: 0 0 1.25rem;
}

.resolutions-results-header .resolutions-results-summary {
	text-align: left;
	margin: 0;
	flex: 1 1 auto;
}

.afscme-search-sort {
	display: flex;
	align-items: center;
	gap: .5rem;
	margin: 0;
	font-family: "Open Sans", sans-serif;
	font-size: .95rem;
}

.afscme-search-sort label {
	color: #555;
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: .04em;
}

.afscme-search-sort select {
	padding: .45rem 2rem .45rem .7rem;
	border: 1px solid #c4ccc6;
	border-radius: 4px;
	background: #fff;
	color: #222;
	font: inherit;
	cursor: pointer;
	transition: background 0.3s cubic-bezier(.57, .2, .21, .89), border-color 0.3s cubic-bezier(.57, .2, .21, .89), color 0.3s cubic-bezier(.57, .2, .21, .89);
}

.afscme-search-sort select:hover {
	background: var(--afscme-rs-green, #00954c);
	border-color: var(--afscme-rs-green, #00954c);
	color: #fff;
}

.afscme-search-sort select:focus {
	outline: none;
	background: #fff;
	border-color: transparent;
	color: var(--afscme-rs-green-dark, #006637);
	animation: afscme-search-pulse 1.4s cubic-bezier(.57, .2, .21, .89) infinite;
}

/* Breadcrumb-style label above the page heading. */
.resolutions-breadcrumb {
	font-family: "Montserrat", sans-serif;
	font-weight: 700;
	font-size: 0.8rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	margin-bottom: 0.25rem;
}

/* Tighten the gap between the breadcrumb label and the "Search Results" heading. */
.resolutions-breadcrumb + .wp-block-heading {
	margin-block-start: 0;
	margin-top: 0;
}

.resolutions-breadcrumb a {
	color: #111;
	text-decoration: none;
	transition: color 0.15s ease;
}

.resolutions-breadcrumb a:hover,
.resolutions-breadcrumb a:focus {
	color: var(--afscme-rs-green);
	text-decoration: none;
}

.resolutions-results-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.resolutions-results-item {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
}

/* Card — whole thing is a stretched link (mirrors Unbox Group Link). The
 * positioning rules are repeated here so the card works even if the
 * unbox-group-link stylesheet isn't enqueued. Borderless: separated by spacing. */
.resolutions-results-card {
	position: relative;
	padding: 1rem 1.25rem;
	transition: background-color 0.15s ease;
}

/* Match the convention-list hover on the Resolutions & Amendments page. */
.resolutions-results-card:hover,
.resolutions-results-card:focus-within {
	background-color: var(--wp--preset--color--light-gray);
}

.resolutions-results-card .unbox-group-link {
	position: absolute;
	inset: 0;
	z-index: 1;
	cursor: pointer;
}

.resolutions-results-card-content {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

/* Keep the real title link clickable/focusable above the overlay. */
.resolutions-results-card-content a {
	position: relative;
	z-index: 2;
}

.resolutions-results-year {
	font-family: "Montserrat", sans-serif;
	font-weight: 700;
	font-size: 0.8rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #555;
}

.resolutions-results-title {
	display: inline-block;
	font-family: "Montserrat", sans-serif;
	font-weight: 700;
	font-size: var(--wp--preset--font-size--subheading);
	line-height: 1.2;
	color: var(--afscme-rs-green);
	text-decoration: none;
	transition: color 0.15s ease;
}

/* Headline turns blue on hover (no underline), matching the card hover. */
.resolutions-results-title:hover,
.resolutions-results-title:focus,
.resolutions-results-card:hover .resolutions-results-title,
.resolutions-results-card:focus-within .resolutions-results-title {
	color: var(--afscme-rs-blue);
	text-decoration: none;
}

.resolutions-results-excerpt {
	font-family: "Open Sans", sans-serif;
	color: #444;
	font-size: 1rem;
	line-height: 1.35;
}

.resolutions-results-empty {
	font-family: "Open Sans", sans-serif;
	font-size: 1.1rem;
	color: #444;
	padding: 1rem 0;
	text-align: center;
}

.resolutions-results-pagination {
	margin-top: 2rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.resolutions-results-pagination .page-numbers {
	display: inline-block;
	padding: 0.5rem 0.85rem;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	font-family: "Open Sans", sans-serif;
	color: var(--afscme-rs-blue);
	text-decoration: none;
}

.resolutions-results-pagination .page-numbers.current {
	background: var(--afscme-rs-green);
	border-color: var(--afscme-rs-green);
	color: #fff;
}

.resolutions-results-pagination a.page-numbers:hover {
	background: #f1f1f1;
}
