/*
 * search.css — site search trigger and dialog.
 *
 * Loaded alongside nav.css by scripts/inject-nav.mjs and by client/index.html.
 * Reuses the header's tokens, so it inherits the design system rather than
 * restating it. Scoped to .authority-search*, styles nothing else.
 */

.authority-search-trigger {
  min-height: 40px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: none;
  border: 1px solid var(--authority-line);
  cursor: pointer;
  color: var(--authority-ink);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: border-color 120ms ease;
}

[data-search-js] .authority-search-trigger {
  display: inline-flex;
}

.authority-search-trigger:hover {
  border-color: var(--authority-ink);
}

.authority-search-trigger kbd {
  padding: 2px 5px;
  border: 1px solid var(--authority-line);
  font-family: inherit;
  font-size: 10px;
  opacity: 0.7;
}

.authority-search[hidden] {
  display: none;
}

.authority-search {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 12vh 16px 16px;
}

.authority-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.34);
}

.authority-search-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--authority-paper);
  border: 1px solid var(--authority-ink);
}

.authority-search-input {
  width: 100%;
  padding: 18px 20px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--authority-line);
  color: var(--authority-ink);
  font: inherit;
  font-size: 17px;
  outline: none;
}

.authority-search-input::-webkit-search-cancel-button {
  display: none;
}

.authority-search-status {
  margin: 0;
  padding: 8px 20px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
}

.authority-search-status:empty {
  display: none;
}

.authority-search-results {
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.authority-search-results a {
  display: grid;
  gap: 3px;
  padding: 12px 20px;
  color: var(--authority-ink);
  text-decoration: none;
  border-top: 1px solid var(--authority-line);
}

.authority-search-results li[aria-selected='true'] a,
.authority-search-results a:hover {
  background: rgba(17, 17, 17, 0.05);
}

.authority-search-section {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
}

.authority-search-title {
  font-size: 15px;
  line-height: 1.25;
}

.authority-search-desc {
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.62;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.authority-search-trigger:focus-visible,
.authority-search-results a:focus-visible {
  outline: 2px solid var(--authority-ink);
  outline-offset: -2px;
}

@media (max-width: 900px) {
  /* The label and the shortcut hint are desktop affordances. On a phone the
     trigger is the icon-sized button and the keyboard hint would be a lie. */
  .authority-search-trigger kbd {
    display: none;
  }

  .authority-search {
    padding: 8vh 12px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .authority-search-trigger {
    transition: none;
  }
}
