/**
 * Sermon search page: [sermon_search] + AJAX results (juxt/sermon_search_shortcode.php)
 */

.juxt-sermon-search-page {
	--juxt-ss-accent: #1fb0a1;
	--juxt-ss-gap: 1.5rem;
	max-width: 72rem;
	margin-left: auto;
	margin-right: auto;
}

/* Featured: latest message + current series */
.juxt-sermon-search-featured {
	margin-bottom: 2.5rem;
}

.juxt-sermon-search-featured__heading {
	margin: 0 0 1rem;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #5c5c62;
}

.juxt-sermon-search-featured__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--juxt-ss-gap);
	align-items: stretch;
}

@media (max-width: 767px) {
	.juxt-sermon-search-featured__grid {
		grid-template-columns: 1fr;
	}
}

.juxt-sermon-search-featured-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.juxt-sermon-search-featured-card__thumb {
	display: block;
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #ececee;
}

.juxt-sermon-search-featured-card__thumb img,
.juxt-sermon-search-featured-card__thumb .juxt-series-message-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.juxt-sermon-search-featured-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 8rem;
	background: linear-gradient(135deg, #e8e8ec 0%, #f4f4f6 100%);
}

.juxt-sermon-search-featured-card__body {
	padding: 1.1rem 1.25rem 1.25rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.juxt-sermon-search-featured-card__label {
	margin: 0 0 0.35rem;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #6b6b70;
}

.juxt-sermon-search-featured-card__title {
	margin: 0 0 0.5rem;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.25;
}

.juxt-sermon-search-featured-card__title a {
	color: #141418;
	text-decoration: none;
}

.juxt-sermon-search-featured-card__title a:hover,
.juxt-sermon-search-featured-card__title a:focus {
	text-decoration: underline;
}

.juxt-sermon-search-featured-card__meta {
	margin: 0;
	padding: 0 0 0 1.1rem;
	font-size: 0.9rem;
	color: #4a4a50;
	line-height: 1.5;
	list-style: disc;
}

.juxt-sermon-search-featured-card__meta-line {
	margin: 0 0 0.75rem;
	font-size: 0.95rem;
	color: #4a4a50;
}

.juxt-sermon-search-featured-card__excerpt {
	margin: 0.5rem 0 0;
	font-size: 0.95rem;
	line-height: 1.5;
	color: #2d2d32;
	flex: 1;
}

.juxt-sermon-search-featured-card__action {
	margin: 1rem 0 0;
}

.juxt-sermon-search-featured-card__link {
	font-weight: 600;
	color: var(--juxt-ss-accent);
	text-decoration: none;
}

.juxt-sermon-search-featured-card__link:hover,
.juxt-sermon-search-featured-card__link:focus {
	text-decoration: underline;
}

/* Browse series grid */
.juxt-sermon-search-browse {
	margin-bottom: 2.5rem;
	padding-bottom: 2rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.juxt-sermon-search-browse__heading {
	margin: 0 0 1.25rem;
	font-size: 1.35rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #141418;
}

.juxt-sermon-search-series-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--juxt-ss-gap);
	align-items: stretch;
}

@media (max-width: 1024px) {
	.juxt-sermon-search-series-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.juxt-sermon-search-series-grid {
		grid-template-columns: 1fr;
	}
}

.juxt-sermon-search-series-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.juxt-sermon-search-series-card:hover {
	border-color: rgba(0, 0, 0, 0.12);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.juxt-sermon-search-series-card__thumb {
	display: block;
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #ececee;
}

.juxt-sermon-search-series-card__thumb img,
.juxt-sermon-search-series-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.juxt-sermon-search-series-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 6rem;
	background: linear-gradient(135deg, #e8e8ec 0%, #f4f4f6 100%);
}

.juxt-sermon-search-series-card__body {
	padding: 1rem 1.1rem 1.15rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.juxt-sermon-search-series-card__title {
	margin: 0 0 0.5rem;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.35;
}

.juxt-sermon-search-series-card__title a {
	color: #141418;
	text-decoration: none;
}

.juxt-sermon-search-series-card__title a:hover,
.juxt-sermon-search-series-card__title a:focus {
	text-decoration: underline;
}

.juxt-sermon-search-series-card__meta {
	margin: 0 0 0.75rem;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
	line-height: 1.45;
	color: #4a4a50;
}

.juxt-sermon-search-series-card__meta li + li {
	margin-top: 0.2rem;
}

.juxt-sermon-search-series-card__action {
	margin: auto 0 0;
	font-size: 0.9rem;
	font-weight: 600;
}

.juxt-sermon-search-series-card__action a {
	color: var(--juxt-ss-accent);
	text-decoration: none;
}

.juxt-sermon-search-series-card__action a:hover,
.juxt-sermon-search-series-card__action a:focus {
	text-decoration: underline;
}

/* Search tools + form */
.juxt-sermon-search-tools__heading {
	margin: 0 0 1rem;
	font-size: 1.25rem;
	font-weight: 700;
	color: #141418;
}

.juxt-sermon-search-form {
	display: flex;
	justify-content: space-between;
	align-items: stretch;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 1.25rem;
}

.juxt-sermon-search-results-wrap {
	position: relative;
	min-height: 80px;
}

.search-container {
	position: relative;
	flex: 1;
	min-width: 200px;
}

#search_field {
	width: 100%;
	padding: 10px 40px 10px 12px;
	border: 2px solid var(--juxt-ss-accent);
	border-radius: 5px;
	box-sizing: border-box;
}

.search-button {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	font-size: 16px;
}

.juxt-sermon-search-form select {
	flex: 1;
	min-width: 140px;
	padding: 10px;
	border: 2px solid var(--juxt-ss-accent);
	border-radius: 5px;
	color: var(--juxt-ss-accent);
	box-sizing: border-box;
}

@media screen and (max-width: 768px) {
	.juxt-sermon-search-form select,
	.search-container {
		min-width: calc(50% - 6px);
		flex: 1 1 calc(50% - 6px);
	}
}

@media screen and (max-width: 480px) {
	.juxt-sermon-search-form select,
	.search-container {
		min-width: 100%;
		flex: 1 1 100%;
	}
}

/* AJAX message results grid — even columns; minmax(0,1fr) avoids uneven stretch */
.juxt-sermon-search-message-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--juxt-ss-gap);
	align-items: start;
}

.juxt-sermon-search-message-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	height: 100%;
	padding: 0;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.07);
	border-radius: 10px;
	overflow: hidden;
	box-sizing: border-box;
}

.juxt-sermon-search-message-card__thumb {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #ececee;
}

.juxt-sermon-search-message-card__thumb a {
	display: block;
	height: 100%;
}

.juxt-sermon-search-message-card__thumb img,
.juxt-sermon-search-message-card__thumb .juxt-series-message-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	vertical-align: middle;
}

.juxt-sermon-search-message-card__body {
	padding: 1rem 1rem 1.1rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.juxt-sermon-search-message-card h3 {
	margin: 0 0 0.35rem;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.35;
}

.juxt-sermon-search-message-card h3 a {
	color: #141418;
	text-decoration: none;
}

.juxt-sermon-search-message-card h3 a:hover,
.juxt-sermon-search-message-card h3 a:focus {
	text-decoration: underline;
}

.juxt-sermon-search-message-card .sermon-date {
	font-style: italic;
	font-size: 0.875rem;
	color: #555;
	margin: 0 0 0.5rem;
}

.juxt-sermon-search-message-card p {
	margin: 0.35rem 0 0;
	font-size: 0.875rem;
	line-height: 1.45;
	color: #4a4a50;
}

.juxt-sermon-search-message-card p:first-of-type:not(.sermon-date) {
	margin-top: 0.25rem;
}

@media (max-width: 1024px) {
	.juxt-sermon-search-message-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.juxt-sermon-search-message-grid {
		grid-template-columns: 1fr;
	}
}

.juxt-sermon-search-hint {
	margin: 0;
	padding: 1rem 0;
	color: #4a4a50;
	font-size: 1rem;
	line-height: 1.5;
}

.juxt-sermon-search-error {
	color: #b91c1c;
}

.sermon-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.35rem;
	padding: 1.5rem 0 0;
	list-style: none;
	margin: 0;
}

.sermon-pagination a,
.sermon-pagination span {
	display: inline-block;
	padding: 10px 15px;
	border-radius: 5px;
	color: var(--juxt-ss-accent);
	text-decoration: none;
}

.sermon-pagination span.current,
.sermon-pagination span[aria-current='page'] {
	background-color: var(--juxt-ss-accent);
	color: #fff;
	font-weight: 600;
}

.sermon-pagination a:hover,
.sermon-pagination a:focus {
	background-color: #f0f0f0;
	color: var(--juxt-ss-accent);
}

.sermon-loading {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
}

.sermon-loading:before {
	content: '';
	width: 44px;
	height: 44px;
	border: 4px solid #ddd;
	border-top-color: #333;
	border-radius: 50%;
	animation: juxt-ss-spin 0.85s linear infinite;
}

@keyframes juxt-ss-spin {
	to {
		transform: rotate(360deg);
	}
}
