/* Suggestions share the site's theme and sit in the normal form flow. */
:root {
  --search-scrollbar-size: 0.5rem;
  --search-scrollbar-radius: 0.375rem;
  --search-submit-font-min: 1rem;
  --search-submit-font-max: 1.25rem;
  --search-submit-height: 3.5rem;
  --search-submit-padding-y: 1rem;
  --search-submit-padding-x: 1.5rem;
  --recent-button-gap: 0.875rem;
}

/* Match the version menu's live theme colours, including Chromium scrollbars. */
:is(#profile-suggestions-list, .head-version-menu) {
  scrollbar-color: var(--head-control-accent) var(--head-menu-surface);
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}

:is(#profile-suggestions-list, .head-version-menu)::-webkit-scrollbar {
  width: var(--search-scrollbar-size);
}

:is(#profile-suggestions-list, .head-version-menu)::-webkit-scrollbar-track {
  background: var(--head-menu-surface);
}

:is(#profile-suggestions-list, .head-version-menu)::-webkit-scrollbar-thumb {
  background: var(--head-control-accent);
  border: var(--mc-pixel-small) solid var(--head-menu-surface);
  border-radius: var(--search-scrollbar-radius);
}

:is(#profile-suggestions-list, .head-version-menu)::-webkit-scrollbar-button {
  display: none;
}

#search-form .search-row {
  grid-template-columns: var(--search-control-size) minmax(0, 1fr) auto;
}

#search-form .search-row input {
  min-inline-size: 0;
}

#search-form button.search-clear {
  display: grid;
  place-items: center;
  grid-column: auto;
  inline-size: var(--search-control-size);
  min-block-size: var(--search-control-size);
  padding: 0;
  margin: 0 var(--search-gap) 0 0;
  border: 0 !important;
  background: transparent;
  color: var(--search-secondary);
  box-shadow: none !important;
  transform: none;
}

.search-clear svg,
.profile-suggestion-icon {
  inline-size: var(--search-icon-size);
  block-size: var(--search-icon-size);
  fill: currentColor;
  stroke: none;
  shape-rendering: crispEdges;
}

#search-form button.search-clear:hover,
#search-form button.search-clear:focus-visible {
  color: var(--search-text);
  background: var(--search-highlight);
}

#search-form button.search-clear:active {
  background: var(--search-surface);
}

.profile-suggestions {
  font-family: var(--pixel);
  margin-block-start: var(--search-gap);
  padding: var(--search-panel-padding);
  background: var(--search-surface);
  border: var(--mc-pixel-small) solid var(--line);
  border-radius: var(--search-radius);
  box-shadow: var(--mc-recessed);
}

.profile-suggestions h2 {
  margin: var(--search-gap) var(--search-row-padding);
  color: var(--search-secondary);
  font: 700 var(--search-label-size)/1.4 var(--pixel);
  letter-spacing: .03em;
  text-shadow: none;
}

#profile-suggestions-list {
  display: grid;
  gap: var(--mc-pixel);
  max-block-size: var(--search-results-height);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-suggestion {
  display: flex;
  align-items: center;
  gap: var(--search-row-padding);
  padding: var(--search-row-padding);
  color: var(--search-text);
  border-radius: var(--search-radius);
  cursor: pointer;
  font: 600 var(--search-name-size)/1.4 var(--pixel);
}

.profile-suggestion:hover,
.profile-suggestion[aria-selected="true"] {
  background: var(--search-highlight);
}

.profile-suggestion[aria-selected="true"] {
  outline: var(--mc-pixel-small) solid var(--mc-focus);
  outline-offset: calc(-1 * var(--mc-pixel-small));
}

.profile-suggestion:active {
  box-shadow: var(--mc-recessed);
}

.profile-suggestion img {
  flex: 0 0 auto;
  inline-size: var(--search-avatar-size);
  block-size: var(--search-avatar-size);
  border: var(--mc-pixel-inset) solid var(--line);
  border-radius: var(--search-radius);
  background: var(--search-highlight);
  image-rendering: pixelated;
}

.profile-suggestion-name {
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-suggestion-icon {
  flex: 0 0 auto;
  margin-inline-start: auto;
  color: var(--search-secondary);
}

.profile-suggestions-status {
  margin: var(--search-gap) var(--search-row-padding);
  color: var(--search-secondary);
  font: 400 var(--search-label-size)/1.6 var(--pixel);
}

.profile-suggestions-status:empty {
  display: none;
}

#search-form .search-submit {
  inline-size: 100%;
  margin-block-start: var(--search-gap);
  min-block-size: var(--search-submit-height);
  padding: var(--search-submit-padding-y) var(--search-submit-padding-x);
  font: 700 clamp(var(--search-submit-font-min), 1.6vw, var(--search-submit-font-max))/1.2 var(--pixel);
  letter-spacing: 0.04em;
}

#recent-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--recent-button-gap);
}

#recent-list button {
  margin: 0;
}

#search-form .search-submit:disabled {
  cursor: wait;
  opacity: .65;
}

@media (prefers-reduced-motion: reduce) {
  #search-form button {
    transition: none;
    transform: none;
  }
  #search-form .button-loader {
    animation: none;
  }
}
