/**
 * Trend Search Block Styles
 *
 * @package RothCo CPA
 * @since   1.0.0
 */

.trend-search-block {
	position: relative;
	width: 100%;
}

.trend-search-stack {
	position: relative;
}

.trend-search-toolbar {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 1rem;
	width: 100%;
}

.trend-search-toolbar.has-active-category {
	justify-content: space-between;
}

.trend-search-active-category {
	flex: 1 1 auto;
	line-height: 1.2;
	text-align: left;
	color: var( --wp--preset--color--text-900, #050a0a );
}

.trend-search-form {
	position: relative;
	flex: 1 1 auto;
	width: 100%;
	max-width: 100%;
	padding: 0.5rem 1rem;
	background: var( --wp--preset--color--background, #fff );
	border-radius: 0.5rem;
	transition: width 420ms cubic-bezier( 0.22, 1, 0.36, 1 ),
		max-width 420ms cubic-bezier( 0.22, 1, 0.36, 1 ),
		padding 320ms cubic-bezier( 0.22, 1, 0.36, 1 );
}

.trend-search-input-row {
	position: relative;
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	flex-wrap: nowrap;
	min-width: 0;
	gap: 1rem;
}

.trend-search-actions {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 0.5rem;
}

.trend-search-input-wrap {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	min-width: 0;
	overflow: hidden;
}

.trend-search-icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	color: var( --wp--preset--color--text-300);
	pointer-events: none;
}

.trend-search-input {
	appearance: none;
	-webkit-appearance: none;
	display: block;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	padding: 0.5rem 2rem 0.5rem 0;
	box-sizing: border-box;
	background: transparent;
	border: none;
	font-size: var( --wp--preset--font-size--xs );
	font-weight: 300;
	line-height: 1.2;
	color: var( --wp--preset--color--text-900 );
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.trend-search-input:focus {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.trend-search-input::placeholder {
	color: var( --wp--preset--color--text-300);
	font-style: italic;
}

.trend-search-input::-webkit-search-cancel-button,
.trend-search-input::-webkit-search-decoration {
	-webkit-appearance: none;
}

.trend-search-form.is-search-expanded .trend-search-input {
	border-bottom: 1px solid var(--wp--preset--color--grey-300);

}

.trend-search-clear {
	position: absolute;
	right: 0.5rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: var( --wp--preset--color--text-secondary, #888 );
	cursor: pointer;
	transition: color 0.25s ease, background-color 0.25s ease;
}

.trend-search-clear:hover {
	background: var( --wp--preset--color--background-secondary, #f2f2f2 );
	color: var( --wp--preset--color--text, #050a0a );
}

.trend-search-clear svg {
	width: 1rem;
	height: 1rem;
}

.trend-search-topics-panel {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 2;
	border-radius: 0 0 0.5rem 0.5rem;
	background: var( --wp--preset--color--background, #fff );
	box-shadow: -10px 6px 18px -14px rgb( 0 0 0 / 0.14 ),
		10px 6px 18px -14px rgb( 0 0 0 / 0.14 ),
		0 10px 18px -14px rgb( 0 0 0 / 0.14 );
	box-sizing: border-box;
	opacity: 1;
	transform: translateY( 0 );
	overflow-x: hidden;
	overflow-y: auto;
	visibility: visible;
	transition: opacity 340ms ease,
		transform 420ms cubic-bezier( 0.22, 1, 0.36, 1 );
}

.trend-search-topics-panel.is-initially-hidden {
	display: block;
	opacity: 0;
	transform: translateY( -6px );
	visibility: hidden;
	pointer-events: none;
}

.trend-search-topics-inner {
	padding: 1rem;
	background: var( --wp--preset--color--background-secondary );
	transition: padding 220ms ease;
}

.trend-search-form.is-search-expanded {
	width: 100%;
	max-width: 100%;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.trend-search-topic-group-services {
	margin-top: 1rem;
}

.trend-search-topic-group {
	padding: 0.75rem;
	border-radius: 0.5rem;
	background: var( --wp--preset--color--background );
}

.trend-search-topic-title {
	margin-bottom: 1rem;
	font-size: var( --wp--preset--font-size--base );
	line-height: 1.2;
	font-weight: 500;
	color: var( --wp--preset--color--text-900 );
}

.trend-search-topic-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.trend-search-topic-link {
	appearance: none;
	-webkit-appearance: none;
	vertical-align: top;
	white-space: normal;
	word-break: break-word;
	overflow-wrap: anywhere;
	overflow: hidden;
	transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 0.5rem 1rem;
	border: 1px solid var( --wp--preset--color--border-secondary );
	border-radius: 5rem;
	font-size: var( --wp--preset--font-size--xs );
	line-height: 1.2;
	text-align: left;
	color: var( --wp--preset--color--text-900 );
	cursor: pointer;
}

.trend-search-topic-link:hover,
.trend-search-topic-link:focus-visible {
	color: var( --wp--preset--color--accent );
	border-color: var( --wp--preset--color--accent );
}

.trend-search-topic-link.is-active,
.trend-search-topic-link[aria-pressed="true"] {
	background-color: color-mix(in srgb, var(--wp--preset--color--accent) calc(var(--tw-bg-opacity, 1) * 15%), transparent) !important;
	color: var( --wp--preset--color--accent ) !important;
	border-color: var( --wp--preset--color--accent );
}

.trend-search-input:focus-visible,
.trend-search-topic-link:focus-visible,
.trend-search-submit:focus-visible {
	outline: none;
}

.trend-search-submit {
	box-sizing: border-box;
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	padding: 0.5rem 1rem;
	border-radius: 5rem;
	border: 1px solid transparent;
	color: var( --wp--preset--color--text-inverted, #fff );
	display: block;
	text-align: center;
	font-weight: 500;
	font-size: var( --wp--preset--font-size--xs );
	cursor: pointer;
	white-space: nowrap;
	background-color: var( --wp--preset--color--primary-750);
	transition: background-color 0.25s ease, border-color 0.25s ease;
}

.trend-search-submit:hover {
	background: var( --wp--preset--color--btn-hover, #36877d );
	border-color: var( --wp--preset--color--btn-hover, #36877d );
}

.trend-search-reset-filters {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1rem;
	border: 1px solid var( --wp--preset--color--primary-750 );
	border-radius: 5rem;
	font-size: var( --wp--preset--font-size--xs );
	font-weight: 500;
	color: var( --wp--preset--color--primary-750 );
	cursor: pointer;
	transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
	white-space: nowrap;
}

.trend-search-reset-filters:hover {
	background-color:  color-mix(in srgb, var(--wp--preset--color--accent) calc(var(--tw-bg-opacity, 1) * 15%), transparent) !important;
}

.trend-search-block-editor {
	pointer-events: none;
}

.trend-search-result-item {
	display: flex;
	padding: 0.8rem 0.95rem;
	gap: 0.85rem;
	border-bottom: 1px solid var( --wp--preset--color--grey-300);
	text-decoration: none;
	color: inherit;
	transition: background-color 0.25s ease;
}

.trend-search-result-item:last-of-type {
	border-bottom: none;
}

.trend-search-result-item:hover {
	background: var( --wp--preset--color--background-secondary, #f7f7f7 );
}

.trend-search-result-thumb {
	flex-shrink: 0;
	width: 4rem;
	height: 4rem;
	border-radius: 0.4rem;
	overflow: hidden;
	background: var( --wp--preset--color--background-secondary, #f0f0f0 );
}

.trend-search-result-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.trend-search-result-thumb-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var( --wp--preset--color--text-secondary, #aaa );
}

.trend-search-result-thumb-placeholder svg {
	width: 1.3rem;
	height: 1.3rem;
}

.trend-search-result-body {
	min-width: 0;
	flex: 1;
}

.trend-search-result-date {
	display: block;
	font-size: var( --wp--preset--font-size--sm );
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var( --wp--preset--color--text-secondary, #888 );
	margin-bottom: 0.25rem;
}

.trend-search-result-title {
	margin: 0;
	font-size: var( --wp--preset--font-size--sm );
	line-height: 1.3;
	color: var( --wp--preset--color--text-900);
}

.trend-search-result-excerpt {
	margin: 0.25rem 0 0;
	font-size: var( --wp--preset--font-size--2xs );
	line-height: 1.4;
	color: var( --wp--preset--color--text-body, #444 );
	display: -webkit-box;
	line-clamp: 2;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.trend-search-view-all {
	display: flex;
	justify-content: flex-end;
	padding: 0.6rem 0.9rem;
	border-top: 1px solid var( --wp--preset--color--grey-300);
}

.trend-search-view-all-link {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: var( --wp--preset--font-size--2xs );
	line-height: 1;
	font-weight: 600;
	text-decoration: none;
	color: var( --wp--preset--color--primary-750);
}

.trend-search-view-all-link svg {
	width: 0.8rem;
	height: 0.8rem;
}

.trend-search-no-results {
	padding: 0.85rem 1rem;
	font-size: var( --wp--preset--font-size--xs );
	color: var( --wp--preset--color--text-secondary, #888 );
	text-align: center;
}

.trend-search-grid-host {
	display: none;
	width: 100%;
}

html.has-trend-cat-filter .trend-search-default-content-target,
.wp-site-blocks.is-trend-search-grid-active .trend-search-scope-active > .trend-search-default-content,
.is-trend-search-default-hidden {
	display: none !important;
}

.wp-site-blocks.is-trend-search-grid-active .trend-search-scope-active {
	justify-content: flex-start !important;
	align-content: flex-start !important;
}

.wp-site-blocks.is-trend-search-grid-active .trend-search-grid-host {
	display: block;
}

.trend-search-grid-results {
	padding: 1rem 0;
}

.trend-search-grid-list {
	display: grid;
	grid-template-columns: repeat( 1, minmax( 0, 1fr ) );
	column-gap: 1.5rem;
	row-gap: 2.25rem;
}

.trend-search-grid-card {
	display: flex;
	flex-direction: column;
	align-self: start;
}

.trend-search-grid-status {
	padding: 2rem 0.75rem 2rem 0;
	text-align: left;
	color: var( --wp--preset--color--text-secondary, #6b7280 );
}

.trend-search-grid-list-skeleton {
	pointer-events: none;
}

.trend-search-grid-card-skeleton {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.trend-search-skeleton {
	display: block;
	border-radius: 0.35rem;
	background: linear-gradient(
		90deg,
		color-mix(in srgb, var(--wp--preset--color--grey-300, #e5e7eb) 68%, var(--wp--preset--color--background) 32%) 0%,
		color-mix(in srgb, var(--wp--preset--color--grey-300, #e5e7eb) 38%, var(--wp--preset--color--background) 62%) 45%,
		color-mix(in srgb, var(--wp--preset--color--grey-300, #e5e7eb) 68%, var(--wp--preset--color--background) 32%) 100%
	);
	background-size: 200% 100%;
	animation: trend-search-skeleton-shimmer 1.2s linear infinite;
}

.trend-search-skeleton-thumbnail {
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: 0;
}

.trend-search-skeleton-meta {
	height: 0.65rem;
	width: 40%;
}

.trend-search-skeleton-title {
	height: 0.95rem;
	width: 85%;
}

.trend-search-skeleton-author {
	height: 0.75rem;
	width: 55%;
}

.trend-search-form:not( .is-search-expanded ) {
	width: 100%;
}

@keyframes trend-search-skeleton-shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

@media ( min-width: 769px ) {
	.trend-search-grid-list {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

@media ( min-width: 1025px ) {
	.trend-search-grid-list {
		grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	}
}

@media ( min-width: 1441px ) {
	.trend-search-grid-list {
		grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	}
}

@media ( min-width: 993px ) {
	/*
	 * Avoid chip-height jank when expanding search: width animation causes temporary reflow/wrapping in topic pills.
	 */
	.trend-search-form {
		transition: padding 320ms cubic-bezier( 0.22, 1, 0.36, 1 );
	}

	.trend-search-block {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
	}

	/* Shell shrink-wraps so the live-results panel matches the form width. */
	.trend-search-shell {
		width: 100%;
		max-width: 100%;
	}

	.trend-search-stack {
		width: 100%;
		max-width: 100%;
	}

	.trend-search-form:not( .is-search-expanded ) {
		max-width: 30%;
		min-width: 0;
		margin-left: auto;
		flex: 0 0 auto;
	}

	.trend-search-toolbar.has-active-category .trend-search-form:not( .is-search-expanded ) {
		max-width: 40%;
	}

	.trend-search-form.is-search-expanded {
		width: 70%;
		max-width: 70%;
		min-width: 0;
		margin-left: auto;
		flex: 0 0 auto;
	}

	.trend-search-input-row {
		flex: 0 0 auto;
		width: 100%;
	}
}

@media ( min-width: 1441px ) {
	.trend-search-form.is-search-expanded {
		width: 50%;
		max-width: 50%;
	}
}

@media ( max-width: 878px ) {
	.trend-search-toolbar,
	.trend-search-toolbar.has-active-category {
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: 2rem;
	}

	.trend-search-grid-status {
		text-align: center;
	}

	.trend-search-form {
		order: 1;
		max-width: 100%;
	}

	.trend-search-active-category {
		order: 2;
	}
}

@media ( max-width: 768px ) {
	.trend-search-toolbar,
	.trend-search-toolbar.has-active-category {
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
	}

	.trend-search-form {
		order: 1;
		min-height: auto;
		overflow: visible;
	}

	.trend-search-active-category {
		order: 2;
	}

	.trend-search-input-row {
		width: 100%;
	}

	.trend-search-actions {
		gap: 0.35rem;
	}

	.trend-search-input-wrap {
		width: 100%;
		min-height: 40px;
		flex: 1 1 0;
	}

	.trend-search-reset-filters {
		flex: 0 0 auto;
	}

	.trend-search-input {
		height: 40px;
		border-bottom: none;
	}
}

@media ( max-width: 430px ) {
	.trend-search-topic-link {
		width: 100%;
		min-height: 3rem;
		padding-inline: 1rem;
		text-align: center;
	}
}