/*
 * NCP Search 0.3.0 — the desktop panel (F3): suggestions · products · preview, under the store's own search box.
 * Plan of record: docs/recon/site-search-3.md §E.5 (.s2-panel, __col--sugg|--products|--preview, __group, __opt,
 * __opt--active, __foot, .s2-preview, .s2-tiles/.s2-tile, .s2-recent, .s2-completion). Core's tokens and resets apply;
 * the rows and the price, stock and spec pieces are the card stylesheet's.
 *
 * ⚠ CALM (F8 Look 2): one hairline frame and the one soft shadow the open panel is allowed (--s2-shadow-panel); the
 * highlight is a neutral tint, never a coloured box. ⚠ TYPE (Look 3): nothing below 13 px. ⚠ MOTION (Look 5): the panel
 * fades in, opacity only, in --s2-dur (0 ms under prefers-reduced-motion — core's rule).
 */

.ncp-s2.s2-panel {
	position: fixed;
	z-index: 1;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 304px;
	grid-template-rows: minmax(0, 1fr) auto;
	min-height: 0;
	overflow: hidden;
	border: 1px solid var(--s2-line);
	border-radius: var(--s2-radius);
	background: var(--s2-bg);
	color: var(--s2-text);
	box-shadow: var(--s2-shadow-panel);
	font-size: 14px;
	animation: ncp-s2-fade var(--s2-dur) var(--s2-ease) both;
}

.ncp-s2.s2-panel[hidden] {
	display: none;
}

/* the listbox holds the first two columns side by side */
.ncp-s2 .s2-panel__list {
	display: grid;
	grid-template-columns: 248px minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
	min-height: 0;
	min-width: 0;
	overflow: hidden;
}

.ncp-s2.s2-panel--nosugg .s2-panel__list {
	grid-template-columns: 0 minmax(0, 1fr);
}

.ncp-s2.s2-panel--nosugg .s2-panel__col--sugg {
	padding: 0;
	border: 0;
}

.ncp-s2 .s2-panel__col {
	min-width: 0;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
	padding: var(--s2-sp-2);
}

.ncp-s2 .s2-panel__col--sugg {
	border-right: 1px solid var(--s2-line);
}

.ncp-s2 .s2-panel__col--preview {
	border-left: 1px solid var(--s2-line);
}

.ncp-s2 .s2-panel__col--preview:empty {
	display: block;
}

/* narrower windows: the preview column goes, suggestions and products stay */
.ncp-s2.s2-panel--narrow {
	grid-template-columns: minmax(0, 1fr);
}

.ncp-s2.s2-panel--narrow .s2-panel__col--preview {
	display: none;
}

.ncp-s2.s2-panel--narrow .s2-panel__list {
	grid-template-columns: 220px minmax(0, 1fr);
}

/* a cached answer for the words typed so far, painted while the real one is on its way */
.ncp-s2.s2-panel--stale .s2-panel__list {
	opacity: .72;
	transition: opacity var(--s2-dur) var(--s2-ease);
}

/* ── groups and their labels ───────────────────────────────────────────────────────────────────────────────── */
.ncp-s2 .s2-panel__group + .s2-panel__group,
.ncp-s2 .s2-panel__group + .s2-note,
.ncp-s2 .s2-note + .s2-panel__group {
	margin-top: var(--s2-sp-2);
}

.ncp-s2 .s2-panel__label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s2-sp-1);
	min-height: 24px;
	margin-bottom: 4px;
	padding: 0 var(--s2-sp-1);
	color: var(--s2-mute);
	font-size: 13px;
	font-weight: 600;
}

.ncp-s2 .s2-panel__clear {
	padding: 2px 4px;
	color: var(--s2-mute);
	font-size: 13px;
	font-weight: 500;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ncp-s2 .s2-panel__clear:hover {
	color: var(--s2-text);
}

/* ── an option: a search, a page, a tile ─────────────────────────────────────────────────────────────────────── */
.ncp-s2 .s2-panel__opt {
	display: flex;
	align-items: center;
	gap: var(--s2-sp-1);
	min-height: 36px;
	padding: 6px var(--s2-sp-1);
	border-radius: calc(var(--s2-radius) - 2px);
	color: var(--s2-text);
	font-size: 14px;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
}

.ncp-s2 .s2-panel__opt > .s2-ic {
	color: var(--s2-mute);
}

.ncp-s2 .s2-panel__opt:hover,
.ncp-s2 .s2-panel__opt--active,
.ncp-s2 .s2-row.s2-panel__opt--active {
	background: rgba(0, 0, 0, .05);
	color: var(--s2-text);
}

.ncp-s2 .s2-panel__opt--active {
	outline: 2px solid var(--s2-accent-text, var(--s2-accent));
	outline-offset: -2px;
}

.ncp-s2 .s2-panel__text {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ncp-s2 .s2-panel__opt .s2-pill__count {
	flex: none;
	font-size: 13px;
}

.ncp-s2 .s2-sugg__in {
	color: var(--s2-mute);
}

/* the completions: what was typed is marked (core's <mark>: bold) */
.ncp-s2 .s2-completion mark {
	font-weight: 700;
}

/* "Go to Gas Heaters →" — drawn first */
.ncp-s2 .s2-panel__shortcut {
	min-height: 44px;
	border: 1px solid var(--s2-line);
	font-weight: 500;
}

.ncp-s2 .s2-panel__shortcut > .s2-ic:last-child {
	color: var(--s2-text);
}

.ncp-s2 .s2-panel__correction {
	margin-bottom: var(--s2-sp-2);
	padding: 0 var(--s2-sp-1);
}

.ncp-s2 .s2-panel__understood {
	margin-bottom: var(--s2-sp-1);
	padding: 0 var(--s2-sp-1);
}

.ncp-s2 .s2-panel__und {
	color: var(--s2-text);
	font-weight: 500;
}

/* recently viewed: a small picture and the name */
.ncp-s2 .s2-viewed__img {
	display: block;
	flex: none;
	width: 40px;
	height: 40px;
	object-fit: contain;
	border-radius: 4px;
	background: var(--s2-bg);
}

/* ── the products column: core's compact rows ─────────────────────────────────────────────────────────────── */
.ncp-s2 .s2-panel__col--products .s2-row {
	border-radius: calc(var(--s2-radius) - 2px);
}

.ncp-s2 .s2-panel__col--products .s2-row:hover {
	background: rgba(0, 0, 0, .05);
}

/* nothing found */
.ncp-s2 .s2-panel__zero {
	padding: var(--s2-sp-1);
}

.ncp-s2 .s2-panel__nothing {
	margin-bottom: 4px;
	font-size: 16px;
	font-weight: 600;
}

.ncp-s2 .s2-panel__person {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s2-sp-1);
	margin-top: var(--s2-sp-2);
	padding: 0 var(--s2-sp-1);
}

/* ── category tiles with pictures (before typing) ─────────────────────────────────────────────────────────── */
.ncp-s2 .s2-tiles {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--s2-sp-1);
}

.ncp-s2 .s2-panel__opt.s2-tile {
	flex-direction: column;
	align-items: stretch;
	gap: 6px;
	padding: var(--s2-sp-1);
	border: 1px solid var(--s2-line);
	text-align: left;
}

.ncp-s2 .s2-tile__img {
	display: grid;
	place-items: center;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	border-radius: 4px;
	background: var(--s2-bg);
	color: var(--s2-mute);
}

.ncp-s2 .s2-tile__label {
	overflow: hidden;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.ncp-s2 .s2-tile__count {
	color: var(--s2-mute);
	font-size: 13px;
}

/* ── the preview (F3): large picture, brand, title, price, stock, three specs, the one next step ──────────── */
.ncp-s2 .s2-preview {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--s2-sp-1);
}

.ncp-s2 .s2-preview__media {
	position: relative;
	display: grid;
	place-items: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: calc(var(--s2-radius) - 2px);
	background: var(--s2-bg);
}

.ncp-s2 .s2-preview__img {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	object-fit: contain;
	color: var(--s2-mute);
}

.ncp-s2 .s2-preview__brand {
	color: var(--s2-mute);
	font-size: 13px;
	font-weight: 500;
}

.ncp-s2 .s2-preview__title {
	font-size: var(--s2-title-size);
	font-weight: var(--s2-title-weight);
	line-height: 1.35;
}

.ncp-s2 .s2-preview__link:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ncp-s2 .s2-preview__offer {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ncp-s2 .s2-preview__actions {
	display: flex;
	flex-direction: column;
	gap: var(--s2-sp-1);
	margin-top: 4px;
}

.ncp-s2 .s2-preview__actions .s2-btn {
	width: 100%;
	white-space: normal;
	overflow-wrap: anywhere;
}

/* skeletons in the final boxes */
.ncp-s2 .s2-panel__skel {
	display: block;
	height: 14px;
	margin: 10px var(--s2-sp-1);
	border-radius: 4px;
	background: rgba(0, 0, 0, .07);
}

.ncp-s2 .s2-panel__skel:nth-child(2) {
	width: 70%;
}

.ncp-s2 .s2-panel__skel:nth-child(3) {
	width: 55%;
}

.ncp-s2 .s2-panel__skel--media {
	width: 100%;
	height: auto;
	margin: 0 0 var(--s2-sp-1);
	aspect-ratio: 1 / 1;
}

/* ── the footer: the keys, and "See all n results" ────────────────────────────────────────────────────────── */
.ncp-s2 .s2-panel__foot {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s2-sp-2);
	min-height: 52px;
	padding: var(--s2-sp-1) var(--s2-sp-2);
	border-top: 1px solid var(--s2-line);
}

.ncp-s2 .s2-panel__foot:empty {
	display: none;
}

.ncp-s2 .s2-panel__keys {
	color: var(--s2-mute);
	font-size: 13px;
}

.ncp-s2 .s2-panel__keys kbd {
	display: inline-block;
	min-width: 20px;
	margin: 0 2px;
	padding: 0 4px;
	border: 1px solid var(--s2-line);
	border-radius: 4px;
	background: var(--s2-bg);
	color: var(--s2-text);
	font-family: inherit;
	font-size: 13px;
	line-height: 18px;
	text-align: center;
	box-shadow: none;
}

.ncp-s2 .s2-panel__all {
	margin-left: auto;
}
