/* numb. — search (search.js). Shared shell: structure here, look from theme tokens.
 * Classic tokens (--text, --surface, --accent…) are the base; Lueur can override through --lueur-* or by
 * redefining the same tokens under :root[data-theme="lueur"]. */

#search-view[hidden], .nsx-field[hidden] { display: none !important; }
:root[data-nsx] #hero, :root[data-nsx] #rows, :root[data-nsx] #browse { display: none !important; }

/* ───────── desktop: the magnifier opens into a field, in place ───────── */
.nsx-field {
  position: fixed; z-index: 60; display: flex; align-items: center;
  width: 340px; height: 44px; border-radius: var(--lueur-r-pill, var(--radius-pill, 999px));
  color: var(--lueur-ink, var(--text));
  background: var(--lueur-field-bg, color-mix(in srgb, var(--bg, #0d0d0d) 62%, transparent));
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  box-shadow: inset 0 0 0 1px var(--lueur-field-ring, var(--line-strong, rgba(242, 240, 235, .3)));
  overflow: hidden;
  animation: nsx-open var(--lueur-d-slow, var(--dur-slow, 360ms)) var(--lueur-e-out, var(--ease-out, ease-out)) both;
}
.nsx-field.closing { animation: nsx-close var(--lueur-d-base, var(--dur-base, 200ms)) var(--lueur-e-out, var(--ease-out, ease-out)) both; pointer-events: none; }
@keyframes nsx-open { from { width: 44px; } }
@keyframes nsx-close { to { width: 44px; opacity: 0; } }
:root[data-nsx-field] #btn-search { visibility: hidden; }
:root:not([data-ui="desktop"]) .nsx-field { display: none !important; }

.nsx-field .nsx-ico, .nsx-clear {
  flex: none; width: 44px; height: 100%; display: grid; place-items: center;
  background: none; border: 0; color: inherit; cursor: pointer; border-radius: 50%;
}
.nsx-field .ico, .nsx-phone-field .ico, .nsx-clear .ico { width: 20px; height: 20px; }
.nsx-input {
  flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0;
  color: inherit; font: inherit; font-size: 15px;
}
.nsx-input::placeholder { color: var(--lueur-ink-3, var(--text-3)); }
.nsx-clear { color: var(--lueur-ink-3, var(--text-3)); opacity: 0; pointer-events: none; transition: opacity var(--dur-fast, 120ms); }
.nsx-field.has .nsx-clear, .nsx-phone.has .nsx-clear { opacity: 1; pointer-events: auto; }
.nsx-clear:hover, .nsx-clear:focus-visible { color: var(--lueur-ink, var(--text)); }
.nsx-field:focus-within { box-shadow: inset 0 0 0 1px var(--lueur-field-ring-focus, var(--focus-ring, var(--text))); }
@media (prefers-reduced-motion: reduce) { .nsx-field, .nsx-field.closing { animation: none; } }

/* ───────── results page (desktop + phone + TV right column) ───────── */
.nsx-view { animation: nsx-fade var(--lueur-d-base, var(--dur-base, 200ms)) var(--ease-out, ease-out) both; }
@keyframes nsx-fade { from { opacity: 0; } }
.nsx-h {
  font: var(--lueur-h-weight, var(--fw-bold, 700)) 1.9rem/1.05 var(--lueur-display, var(--font-display));
  letter-spacing: var(--lueur-h-tracking, var(--tracking-tight, -.02em));
  text-transform: var(--lueur-h-case, none);
  color: var(--lueur-ink, var(--text)); margin: 0 0 var(--sp-4, 1rem); text-wrap: balance; overflow-wrap: anywhere;
}
.nsx-h-explore { margin-top: var(--sp-7, 3rem); font-size: 1.45rem; }
.nsx-grid { margin-top: 0; }
.nsx-note { color: var(--lueur-ink-3, var(--text-2)); margin: 0 0 var(--sp-5, 1.5rem); }
.nsx-empty { display: grid; justify-items: start; gap: var(--sp-2, .5rem); padding: var(--sp-5, 1.5rem) 0 0; }
.nsx-empty > .ico { width: 34px; height: 34px; color: var(--lueur-ink-3, var(--text-3)); margin-bottom: var(--sp-2, .5rem); }
.nsx-empty .nsx-h { margin: 0; }
.nsx-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2, .5rem); margin: 0 0 var(--sp-6, 2rem); }
.nsx-chip {
  display: inline-flex; align-items: center; gap: .45em; height: 2.4rem; padding: 0 1.05rem;
  border-radius: var(--lueur-r-pill, var(--radius-pill, 999px)); cursor: pointer; white-space: nowrap;
  font: var(--fw-medium, 500) var(--fs-caption, .98rem)/1 var(--font-sans, inherit);
  color: var(--lueur-ink, var(--text)); background: var(--lueur-glass, var(--accent-soft));
  border: 1px solid var(--lueur-chip-line, var(--line));
  transition: background var(--dur-fast, 120ms), transform var(--dur-fast, 120ms) var(--ease-out, ease-out);
}
.nsx-chip:hover, .nsx-chip:focus-visible { background: var(--lueur-glass-2, var(--surface-2)); border-color: var(--line-strong); }
.nsx-chip.is-person::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; opacity: .45; }

/* ───────── phone: full-width field at the top of the page ───────── */
.nsx-phone, .nsx-tv { display: none; }
:root[data-ui="phone"] .nsx-phone { display: flex; align-items: center; gap: var(--sp-3, .75rem); margin: 0 0 var(--sp-5, 1.5rem); }
.nsx-phone-field {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem; height: 48px; padding-left: 14px;
  border-radius: var(--lueur-r-pill, var(--radius-pill, 999px)); color: var(--lueur-ink, var(--text));
  background: var(--lueur-glass, var(--surface)); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.nsx-phone-field:focus-within { box-shadow: inset 0 0 0 1px var(--focus-ring, var(--text)); }
.nsx-phone-input { font-size: 16px; } /* ≥16px: iOS does not zoom */
.nsx-cancel { flex: none; background: none; border: 0; color: var(--lueur-ink-2, var(--text-2)); font: inherit; min-height: 44px; padding: 0 4px; }
:root[data-ui="phone"] .nsx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4, 1rem) var(--sp-3, .75rem); }
@media (max-width: 340px) { :root[data-ui="phone"] .nsx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
:root[data-ui="phone"] .nsx-h { font-size: 1.35rem; }
:root[data-ui="phone"] .nsx-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--safe-x, 16px) * -1); padding-inline: var(--safe-x, 16px); }
:root[data-ui="phone"] .nsx-chips::-webkit-scrollbar { display: none; }

/* ───────── TV: A–Z grid on the left, results live on the right ───────── */
:root[data-ui="tv"] .nsx-view { display: grid; grid-template-columns: 26rem minmax(0, 1fr); gap: 0 3.5rem; align-items: start; }
:root[data-ui="tv"] .nsx-view[hidden] { display: none !important; }
:root[data-ui="tv"] .nsx-tv { display: block; position: sticky; top: 8rem; }
.nsx-tv-display {
  display: flex; align-items: center; gap: .7rem; height: 4rem; padding: 0 1.4rem; margin-bottom: 1.4rem;
  border-radius: var(--lueur-r-pill, var(--radius-pill, 999px)); font-size: 1.45rem; font-weight: 600;
  background: var(--lueur-glass, var(--surface)); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--lueur-ink, var(--text));
  text-transform: uppercase; letter-spacing: .04em; overflow: hidden; white-space: nowrap;
}
.nsx-tv-display .ico { width: 24px; height: 24px; flex: none; color: var(--lueur-ink-3, var(--text-3)); }
.nsx-tv-text { overflow: hidden; text-overflow: ellipsis; }
.nsx-caret { width: 2px; height: 1.4em; background: currentColor; opacity: .6; animation: nsx-blink 1s steps(1) infinite; margin-left: -.4rem; }
@keyframes nsx-blink { 50% { opacity: 0; } }
.nsx-kb { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .45rem; }
.nsx-key {
  height: 3.6rem; border: 0; border-radius: var(--lueur-r-key, var(--radius-md, 12px)); cursor: pointer;
  display: grid; place-items: center; font: 500 1.35rem/1 var(--font-sans, inherit); color: var(--lueur-ink, var(--text));
  background: var(--lueur-glass, var(--surface)); transition: transform var(--dur-fast, 120ms) var(--ease-out, ease-out), background var(--dur-fast, 120ms);
}
.nsx-key.w2 { grid-column: span 2; font-size: 1.05rem; }
.nsx-key.w3 { grid-column: span 3; font-size: 1.05rem; }
.nsx-key .ico { width: 1.5rem; height: 1.5rem; }
.nsx-key:focus, .nsx-key:focus-visible { outline: 0; background: var(--lueur-ink, var(--accent)); color: var(--lueur-on-ink, var(--text-on-accent)); transform: scale(1.08); }
.nsx-hints { display: flex; gap: 1.4rem; margin-top: 1.6rem; color: var(--lueur-ink-3, var(--text-3)); font-size: 1rem; }
.nsx-hints b { display: inline-grid; place-items: center; min-width: 1.9rem; height: 1.6rem; padding: 0 .4rem; margin-right: .45rem; border-radius: 6px; background: var(--surface-2); color: var(--lueur-ink, var(--text)); font-size: .85rem; }
:root[data-ui="tv"] .nsx-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
:root[data-ui="tv"] .nsx-chip { height: 3rem; padding: 0 1.4rem; font-size: 1.1rem; }
:root[data-ui="tv"] .nsx-field, :root[data-ui="tv"] .nsx-tv-display { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* "Did you mean", partial failure, Retry, and results from the wider catalogue (not in this home). */
.nsx-dym { margin: 0 0 var(--sp-4, 1rem); color: var(--lueur-ink-2, var(--text-2)); font-size: 1.05rem; }
.nsx-link {
  background: none; border: 0; padding: 0 .1em; font: inherit; font-weight: var(--fw-semibold, 600); cursor: pointer;
  color: var(--lueur-ink, var(--text)); text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; border-radius: 4px;
}
.nsx-link:hover, .nsx-link:focus-visible { text-decoration-thickness: 2px; }
.nsx-retry { margin-top: var(--sp-3, .75rem); }
.nsx-h-ext { margin-top: var(--sp-6, 2rem); font-size: 1.35rem; }
.nsx-ext-note { max-width: 46rem; font-size: .95rem; }
.nsx-ext .card .chip-ext {
  background: color-mix(in srgb, var(--bg, #0d0d0d) 72%, transparent); color: var(--lueur-ink-2, var(--text-2));
  border: 1px solid var(--line, rgba(255,255,255,.12));
}
