/* ============================================================
   AREA 52 — the header search (round 32; shared since 32b)
   The magnifier button, the panel and its result rows, for EVERY page:
   the site header (css/site.css places it under the header's right
   edge) and the hero's badge row (css/style.css places it under the
   badge). Loaded after each host's own sheet. Every colour reads the
   host's token with the site palette as the fallback, so the hero —
   whose sheet lacks --amber-lo, --line and --ease-out — renders the
   same panel. No cursor rule lives here: the hero's cursor rule order
   is load-bearing (HANDOFF invariant 8) and a <button> is already in
   both hosts' interactive selectors.
   ============================================================ */

.search-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--amber-lo, #cf9c4d);
  transition: color 0.25s ease;
}
.search-btn svg { display: block; width: 21px; height: 21px; }
/* with a word beside the magnifier (mount({ label }) — the hero, round 43)
   the button grows to fit; the word wears the hero's HUD type (10 px
   Space Mono, 0.28em tracking) in the button's own colour, so it goes
   amber-hi on hover and beam while the panel is open, with the icon */
.search-btn.has-word {
  width: auto;
  min-width: 34px;
  grid-auto-flow: column;
  gap: 7px;
  padding: 0 5px 0 4px;
}
.search-word {
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.28em;
  margin-right: -0.28em;      /* the last letter's own tracking */
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
.search-btn:hover { color: var(--amber-hi, #ffd9a0); }
.search-btn[aria-expanded="true"] { color: var(--beam, #a6ff4d); }
.search-btn:focus-visible { outline: 2px solid var(--amber, #ffae42); outline-offset: 3px; }

/* the panel: the host sets top / left / right / width; closed = the
   hidden attribute (display none — the field must never sit in the tab
   order behind an invisible panel); .search-open on the host runs the
   same 0.18 s fade as the menus */
.site-search {
  position: absolute;
  z-index: 1;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.7;
  background: rgba(11, 10, 24, 0.94);
  border: 1px solid var(--line, rgba(169, 143, 232, 0.18));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), transform 0.18s var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.search-open > .site-search { opacity: 1; transform: translateY(0); }

.ss-form { display: flex; padding: 12px; }
.ss-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--bone, #f2ede0);
  background: rgba(11, 10, 24, 0.7);
  border: 1px solid var(--line, rgba(169, 143, 232, 0.18));
  border-radius: 0;
  padding: 9px 12px;
  transition: border-color 0.2s ease;
}
.ss-input::placeholder { color: var(--faint, #8d8b9c); }
.ss-input:focus { outline: none; border-color: rgba(166, 255, 77, 0.6); }

.ss-list { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 460px); overflow-y: auto; }
.ss-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  color: var(--bone, #f2ede0);
  text-decoration: none;
  border-top: 1px solid rgba(169, 143, 232, 0.1);
  transition: background 0.15s ease;
}
.ss-row:hover { background: rgba(166, 255, 77, 0.06); }
.ss-row:focus-visible { outline: 2px solid var(--amber, #ffae42); outline-offset: -2px; }
.ss-thumb { display: block; width: 40px; height: 40px; object-fit: cover; background: var(--panel, #0f0e22); border: 1px solid var(--line, rgba(169, 143, 232, 0.18)); }
.ss-title {
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ss-meta { font-size: 10px; letter-spacing: 0.14em; color: var(--amber, #ffae42); white-space: nowrap; text-align: right; }
.ss-meta small { margin-left: 8px; font-size: 10px; letter-spacing: 0.2em; color: var(--faint, #8d8b9c); }
.ss-row.is-sold .ss-thumb { opacity: 0.4; filter: grayscale(0.6); }
.ss-row.is-sold .ss-meta { color: var(--faint, #8d8b9c); }
.ss-note, .ss-foot {
  margin: 0;
  padding: 10px 12px 12px;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--faint, #8d8b9c);
  text-transform: uppercase;
  border-top: 1px solid rgba(169, 143, 232, 0.1);
}
.ss-note a, .ss-foot a { color: var(--beam, #a6ff4d); text-decoration: none; }
.ss-note a:hover, .ss-foot a:hover { color: var(--beam-soft, #d6ff9e); }

@media (prefers-reduced-motion: reduce) {
  .site-search, .search-btn, .ss-row, .ss-input { transition: none; }
}
