/* ==========================================================================
   Engine Search — Autocomplete & Related Posts CSS
   ========================================================================== */

/* ---- Search wrapper ---- */
.engine-search-wrap {
	position: relative;
	max-width: 600px;
	margin: 0 auto;
	width: 100%;
}

.engine-search-wrap .search-field {
	width: 100%;
	padding: 12px 48px 12px 16px;
	border: 2px solid #ddd;
	border-radius: 6px;
	font-size: 16px;
	line-height: 1.5;
	outline: none;
	transition: border-color 0.2s ease;
	box-sizing: border-box;
}

.engine-search-wrap .search-field:focus {
	border-color: #0073aa;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

/* ---- Autocomplete dropdown ---- */
.engine-ac {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	z-index: 9999;
	overflow: hidden;
	max-height: 360px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.engine-ac[hidden] {
	display: none;
}

.engine-ac__item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 16px;
	cursor: pointer;
	border-bottom: 1px solid #f0f0f0;
	text-decoration: none;
	color: inherit;
	transition: background 0.15s ease;
}

.engine-ac__item:last-child {
	border-bottom: none;
}

.engine-ac__item:hover,
.engine-ac__item:focus,
.engine-ac__item[aria-selected="true"] {
	background: #f5f5f5;
	outline: none;
}

.engine-ac__text {
	flex: 1;
	min-width: 0;
}

.engine-ac__title {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #111;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.engine-ac__excerpt {
	display: block;
	font-size: 12px;
	color: #666;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.engine-ac__empty {
	padding: 16px;
	text-align: center;
	font-size: 14px;
	color: #999;
}

.engine-ac__spinner {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.engine-ac__spinner::after {
	content: '';
	width: 20px;
	height: 20px;
	border: 2px solid #ddd;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: engine-spin 0.6s linear infinite;
}

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

/* ---- Search results count ---- */
.engine-results__count {
	font-size: 14px;
	color: #666;
	margin-bottom: 16px;
}

/* ---- Related posts ---- */
.engine-related {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 2px solid #eee;
}

.engine-related__title {
	font-size: 20px;
	margin-bottom: 20px;
}

.engine-related__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 20px;
}

.engine-related__item {
	margin: 0;
}

.engine-related__link {
	text-decoration: none;
	color: inherit;
	display: block;
	border-radius: 6px;
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.engine-related__link:hover,
.engine-related__link:focus {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0,0,0,0.14);
	outline: none;
}

.engine-related__thumb {
	aspect-ratio: 16/9;
	overflow: hidden;
	background: #f0f0f0;
}

.engine-related__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.engine-related__name {
	display: block;
	padding: 12px 14px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: #111;
}

@media (max-width: 600px) {
	.engine-related__grid {
		grid-template-columns: 1fr 1fr;
	}
}
