/* Search dialog (_static/js/search.js), on the design tokens. A dialog surface: large radius and
   the medium shadow; rows get the brand tint when selected, like menu items. */

html.dx-search-open { overflow: hidden; }
.dx-search[hidden] { display: none; }
.dx-search { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 10vh var(--adv-space-medium) var(--adv-space-medium); }
.dx-search__scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--adv-navy) 40%, transparent); }
.dx-search__panel {
  position: relative; display: flex; flex-direction: column;
  width: min(680px, 100%); max-height: min(620px, 80vh); overflow: hidden;
  border: 1px solid var(--adv-border); border-radius: var(--adv-radius-large);
  background: var(--adv-surface); box-shadow: var(--adv-shadow-md);
}

/* query */
.dx-search__bar {
  display: flex; align-items: center; gap: var(--adv-space-x-small); flex: none;
  padding: 0 var(--adv-space-small) 0 var(--adv-space-medium); height: var(--adv-space-xx-large);
  border-bottom: 1px solid var(--adv-border); color: var(--adv-text-secondary);
}
.dx-search__input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: none;
  font: 400 17px var(--adv-font-body); color: var(--adv-text-strong);
}
.dx-search__input::placeholder { color: var(--adv-text-muted); }
.dx-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.dx-search.is-loading .dx-search__bar > svg { animation: dx-search-pulse 900ms var(--dx-ease) infinite alternate; }
@keyframes dx-search-pulse { to { color: var(--adv-brand); } }
.dx-search__close { padding: 0; border: 0; background: none; cursor: pointer; }
.dx-search kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--adv-border); border-radius: var(--adv-radius-small); background: var(--adv-surface-2);
  font: 500 11px var(--adv-font-body); color: var(--adv-text-secondary);
}
.dx-search__close:hover kbd { border-color: var(--adv-brand); color: var(--adv-brand); }
.dx-search__close:focus-visible { outline: 2px solid var(--adv-brand-active); outline-offset: 2px; border-radius: var(--adv-radius-small); }

/* results */
.dx-search__list { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: var(--adv-space-x-small); list-style: none; overscroll-behavior: contain; }
.dx-search__label { padding: var(--adv-space-x-small) var(--adv-space-x-small) var(--adv-space-xx-small); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--adv-text-secondary); }
.dx-search__hit {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--adv-space-small); align-items: baseline;
  padding: var(--adv-space-x-small) var(--adv-space-small); border-radius: var(--adv-radius-medium);
  color: var(--adv-text); text-decoration: none;
}
.dx-search__list [aria-selected="true"] > .dx-search__hit { background: var(--adv-brand-tint); }
.dx-search__title { font-size: 15px; font-weight: 600; line-height: 22px; color: var(--adv-text-strong); overflow-wrap: anywhere; }
.dx-search__list [aria-selected="true"] .dx-search__title { color: var(--adv-brand); }
.dx-search__where { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--adv-text-secondary); white-space: nowrap; }
.dx-search__product {
  padding: 0 6px; border-radius: var(--adv-radius-small); font-size: 11px; font-weight: 700; line-height: 18px;
  background: var(--adv-surface-2); color: var(--adv-text-secondary);
}
.dx-search__product--atlas { background: color-mix(in srgb, var(--adv-mint) 30%, transparent); color: var(--adv-text-strong); }
.dx-search__snippet {
  grid-column: 1 / -1; margin-top: 2px; font-size: 13px; line-height: 20px; color: var(--adv-text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dx-search__list mark { padding: 0 1px; border-radius: 2px; background: color-mix(in srgb, var(--adv-brand) 14%, transparent); color: inherit; font-weight: inherit; }
/* a matching heading on the page above */
.dx-search__sub .dx-search__hit { grid-template-columns: auto minmax(0, 1fr); column-gap: var(--adv-space-x-small); margin-left: var(--adv-space-medium); padding-top: 6px; padding-bottom: 6px; }
.dx-search__sub .dx-search__title { font-size: 14px; font-weight: 500; }
.dx-search__hash { color: var(--adv-text-muted); font-weight: 600; }
.dx-search__empty { padding: var(--adv-space-large) var(--adv-space-medium); text-align: center; color: var(--adv-text-secondary); }
.dx-search__empty p { margin: 0 0 var(--adv-space-xx-small); font-size: 14px; }
.dx-search__empty p:first-child { font-weight: 600; color: var(--adv-text-strong); }
.dx-search__ask { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-weight: 600; color: var(--adv-brand); }
.dx-search__ask:hover { text-decoration: underline; text-underline-offset: 3px; }
.dx-search__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.dx-search__foot {
  display: flex; gap: var(--adv-space-medium); flex: none; padding: var(--adv-space-x-small) var(--adv-space-medium);
  border-top: 1px solid var(--adv-border); background: var(--adv-surface-2); font-size: 12px; color: var(--adv-text-secondary);
}
.dx-search__foot span { display: inline-flex; align-items: center; gap: 4px; }

@media (max-width: 767px) {
  .dx-search { padding: 0; }
  .dx-search__panel { width: 100%; max-height: none; height: 100%; border: 0; border-radius: 0; }
  .dx-search__foot { display: none; }
  .dx-search__hit { grid-template-columns: minmax(0, 1fr); }
  .dx-search__where { grid-row: 2; margin-top: 2px; }
}
@media (prefers-reduced-motion: reduce) { .dx-search.is-loading .dx-search__bar > svg { animation: none; } }

/* Home page: the field autocompletes in place, results in a panel under it */
.dx-home-search { position: relative; }
.dx-home-search input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: none;
  font: 400 16px var(--adv-font-body); color: var(--adv-text-strong);
}
.dx-home-search input::placeholder { color: var(--adv-text-secondary); }
.dx-home-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.dx-home-search:focus-within { border-color: var(--adv-brand-active); box-shadow: var(--dx-ring); }
.dx-home-search.is-loading > svg { animation: dx-search-pulse 900ms var(--dx-ease) infinite alternate; }
.dx-home-search__results {
  position: absolute; z-index: 20; top: calc(100% + var(--adv-space-xx-small)); left: -1px; right: -1px;
  display: flex; max-height: min(480px, 60vh); overflow: hidden;
  border: 1px solid var(--adv-border); border-radius: var(--adv-radius-large);
  background: var(--adv-surface); box-shadow: var(--adv-shadow-md); cursor: default;
}
.dx-home-search__results[hidden] { display: none; }
