/* Docs search: the header button and the dialog (src/search.js). Uses the
   colour tokens from docs.css, so it follows the theme. */
.search-btn {
  display: flex; align-items: center; gap: 8px; height: 34px; width: 260px; margin-left: 12px; padding: 0 8px 0 11px;
  font: inherit; font-size: 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; cursor: pointer; text-align: left;
}
.search-btn:hover { border-color: var(--muted); color: var(--ink-2); }
.search-btn svg { flex: none; width: 15px; height: 15px; }
.search-btn span { flex: 1; }
.search kbd, .search-btn kbd {
  font-family: var(--sans); font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--bg);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; line-height: 1.5;
}

.search {
  width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px)); margin: 72px auto auto; padding: 0;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 60px -12px rgb(8 14 28 / 0.35); overflow: hidden; flex-direction: column;
}
.search[open] { display: flex; }
.search::backdrop { background: rgb(8 14 28 / 0.45); backdrop-filter: blur(2px); }
.search-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.search-box input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; color: var(--ink); background: none; border: 0; outline: none; padding: 4px 2px;
}
.search-box input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.search-results:empty { display: none; }
.search-results li { margin: 0; }
.search-results a { display: block; padding: 9px 12px; border-radius: 9px; color: var(--ink); }
.search-results a:hover { text-decoration: none; background: var(--inline-bg); }
.search-results [aria-selected='true'] a { background: var(--accent-soft); }
.sr-path { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.sr-h { display: block; font-weight: 650; font-size: 15px; line-height: 1.4; }
.sr-x { display: block; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; margin-top: 2px; overflow-wrap: anywhere; }
.search mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-msg { padding: 18px 12px; color: var(--muted); font-size: 14.5px; }
.search-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.search-foot kbd { margin-right: 3px; }
.search-results:empty + .search-foot { display: none; }
.search.empty .search-foot { display: none; }

@media (max-width: 1180px) { .search-btn { width: 200px; } }
@media (max-width: 860px) {
  .top-links a.pill { white-space: nowrap; }
  .search-btn { width: 34px; padding: 0; justify-content: center; margin-left: 0; order: 0; }
  .search-btn span, .search-btn kbd { display: none; }
  .search { margin-top: 16px; max-height: calc(100vh - 32px); }
}
/* Very narrow phones: the search icon needs the room of the "docs" label. */
@media (max-width: 359px) { .top .brand span { display: none; } }
