/* Catalog search page (search.html). Builds on styles.css tokens.
   Brand: Red primary button, Blue links, Black text, White / Off-White
   surfaces; Dark Purple only for focus rings. Plain backgrounds; the header and
   footer are the shared site chrome. */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.search-main { padding: 2rem 0 3rem; background: var(--page); min-height: 70vh; }
.search-main h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); margin-bottom: 0.3em; }
.search-intro { color: var(--ink-soft); max-width: 44rem; }

/* Search box */
.search-form { margin: 1.5rem 0 1rem; }
.search-label { display: block; font-weight: 700; margin-bottom: 0.4rem; }
.search-box { display: flex; gap: 0.5rem; }
.search-box input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.15rem;
  padding: 0.75rem 1rem;
  min-height: 52px;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 10px;
}
.search-box input::placeholder { color: var(--ink-soft); opacity: 1; }
.search-box input:focus-visible { outline-offset: 2px; }

.btn-search, .btn-reset {
  font: inherit;
  font-weight: 700;
  border-radius: 10px;
  min-height: 44px;
  cursor: pointer;
}
.btn-search {
  padding: 0 1.4rem;
  color: var(--white);
  background: var(--red);
  border: 2px solid var(--red);
}
.btn-search:hover { background: #A71507; border-color: #A71507; }
.btn-reset {
  padding: 0 1rem;
  color: var(--blue);
  background: transparent;
  border: 2px solid transparent;
  text-decoration: underline;
}
.btn-reset:hover { color: var(--black); }

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin: 1rem 0 0;
  padding: 0;
  border: 0;
}
.filter { display: flex; flex-direction: column; gap: 0.25rem; min-width: 11rem; flex: 1 1 11rem; max-width: 16rem; }
.filter label { font-size: 0.9rem; font-weight: 700; }
.filter select {
  font: inherit;
  font-size: 0.95rem;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--light-bluish-gray);
  border-radius: 8px;
}

/* Results */
.results-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin: 1.25rem 0 0.5rem; }
.results-status { margin: 0; font-weight: 700; }
.results-time { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--light-bluish-gray);
  border-radius: 999px;
  background: var(--white);
}

.results-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.result {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0.9rem;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: var(--white);
  border: 1px solid var(--light-bluish-gray);
  border-radius: 10px;
  cursor: pointer;
}
.result:hover { border-color: var(--black); }
.result[aria-selected="true"] {
  border-color: var(--black);
  box-shadow: inset 4px 0 0 var(--red);
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
.thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--white);
  border-radius: 6px;
}
.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.2;
  color: var(--ink-soft);
  background: var(--off-white);
  border: 1px dashed var(--light-bluish-gray);
}
.r-body { min-width: 0; }
.r-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.r-no { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; font-size: 0.95rem; }
.r-link, .r-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.r-link { color: var(--blue); text-decoration: none; }
.result:hover .r-link, .result[aria-selected="true"] .r-link { text-decoration: underline; }
.r-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font-size: 0.85rem; color: var(--ink-soft); }

.badge {
  display: inline-block;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
  border-radius: 4px;
}
.badge-part { color: var(--white); background: var(--blue); }
.badge-set { color: var(--white); background: var(--red); }
.badge-minifig { color: var(--black); background: var(--yellow); }
/* Sticker parts: the badge carries the word, so the short title doesn't spend characters on it. */
.badge-sticker { color: var(--black); background: var(--white); box-shadow: inset 0 0 0 1px var(--orange); }

.results-empty {
  margin-top: 0.5rem;
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--light-bluish-gray);
  border-radius: 10px;
}
.results-empty h3 { margin-bottom: 0.3em; }
.results-empty p { margin: 0; color: var(--ink-soft); }
.results-empty[hidden] { display: none; }

/* Catalog credit, one small muted line at the end of the page content (above the site footer) */
.search-attribution {
  margin-top: 2rem;
  padding-top: 1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--light-bluish-gray);
}
.search-attribution p { margin: 0; }

@media (max-width: 560px) {
  .search-main { padding-top: 1.25rem; }
  .search-box { flex-direction: column; }
  .btn-search { min-height: 48px; }
  .filter { max-width: none; flex: 1 1 100%; }
  .result { grid-template-columns: 56px 1fr; gap: 0.7rem; }
  .thumb { width: 56px; height: 56px; }
}

@media (max-width: 560px) {
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .filter { min-width: 0; }
  .filter select { width: 100%; }
  .btn-reset { align-self: end; padding: 0 0.25rem; }
}
