/*
 * Design System - AELITA
 * components/search-suggest.css - live suggestions for the site search form.
 *
 * Progressive enhancement over searchform.php: works only when
 * js/design-system/search-suggest.js is active. Uses tokens only; sharp edges;
 * one red accent (the <mark> highlight); overlay shadow only.
 */

/* The form anchors its suggestion list. */
.a-search {
	position: relative;
}

.a-search__suggest {
	position: absolute;
	inset-block-start: calc(100% + var(--space-1));
	inset-inline: 0;
	z-index: var(--z-dropdown);
	max-height: min(70vh, 520px);
	overflow-y: auto;
	background-color: var(--bg);
	border: var(--border-w) solid var(--border);
	box-shadow: var(--shadow-overlay);
	overscroll-behavior: contain;
}

.a-search__suggest[hidden] {
	display: none;
}

/* Grouping */
.a-search__group-label {
	margin: 0;
	padding: var(--space-3) var(--space-4) var(--space-1);
	color: var(--text-secondary);
	font-family: var(--font-body);
	font-size: var(--fs-caption);
	font-weight: var(--fw-semibold);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.a-search__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Option */
.a-search__option {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-2) var(--space-4);
	color: var(--text-primary);
	text-decoration: none;
	cursor: pointer;
	border-left: 2px solid transparent;
	transition: background-color var(--dur-popover) var(--ease-out);
}

.a-search__option:hover,
.a-search__option.is-active {
	background-color: var(--bg-muted);
	border-left-color: var(--c-red-600);
}

.a-search__option-media {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	overflow: hidden;
	background-color: var(--bg-muted);
	color: var(--text-muted);
}

.a-search__option-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.a-search__option-media svg {
	width: 20px;
	height: 20px;
}

.a-search__option-body {
	min-width: 0;
}

.a-search__option-title {
	display: block;
	font-size: var(--fs-small);
	font-weight: var(--fw-semibold);
	line-height: var(--lh-heading);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.a-search__option-title mark {
	background: transparent;
	color: var(--c-red-600);
	font-weight: var(--fw-bold);
}

.a-search__option-meta {
	display: block;
	margin-top: 2px;
	color: var(--text-secondary);
	font-size: var(--fs-caption);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Status row (loading / empty / hint) */
.a-search__status {
	padding: var(--space-3) var(--space-4);
	color: var(--text-secondary);
	font-size: var(--fs-small);
}

/* "View all" footer */
.a-search__all {
	display: block;
	padding: var(--space-3) var(--space-4);
	border-top: var(--border-w) solid var(--border);
	color: var(--text-primary);
	font-size: var(--fs-small);
	font-weight: var(--fw-semibold);
	text-decoration: none;
}

.a-search__all:hover {
	color: var(--link-hover);
}

/* -------------------------------------------------------------------- */
/* Brand => models hierarchy                                            */
/* -------------------------------------------------------------------- */
.a-search__option--brand {
	border-left-color: var(--c-red-600);
}

/* Wide, uncropped logo box: contain keeps every aspect ratio intact. */
.a-search__option-media--logo,
.a-search__option--model .a-search__option-media {
	width: 64px;
	height: 40px;
	background-color: transparent;
}

.a-search__option-media--logo img,
.a-search__option--model .a-search__option-media img {
	object-fit: contain;
	object-position: left center;
	width: 100%;
	height: 100%;
}

.a-search__option-media--monogram {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	color: var(--c-ink-300);
	font-family: var(--font-display-strong);
	font-size: 22px;
	font-weight: var(--fw-bold);
}

/* Models are visually nested under their brand. */
.a-search__option--model {
	padding-inline-start: calc(var(--space-4) + var(--space-5));
}

.a-search__option--model .a-search__option-title {
	font-weight: var(--fw-regular);
}

/* On the mobile drawer the field must not be clipped: the list flows in. */
.a-mobile-nav__search .a-search__suggest {
	position: static;
	max-height: 50vh;
	border: 0;
	box-shadow: none;
	margin-top: var(--space-2);
}

@media (prefers-reduced-motion: reduce) {
	.a-search__option {
		transition-duration: 0.01ms;
	}
}
