/* The search overlay.
 *
 * Its own sheet because two different front ends need it. shared/
 * search.js builds the panel; brand.css used to style it, and the
 * Contacts app cannot load brand.css, which carries global resets for
 * *, html, body, h1-h3, a, button and input that would fight Tailwind
 * across the whole app. So Contacts had no overlay and its Search
 * control was a link to the guide: the same button, two behaviours,
 * depending which page you were on.
 *
 * The tokens are declared on the panel with fallbacks, so this is
 * correct beside brand.css and still correct without it.
 */
.pf-search-panel,
.pf-search-btn {
  --pf-search-card: var(--pf-card, #ffffff);
  --pf-search-surface: var(--pf-surface, #f2f4f4);
  --pf-search-line: var(--pf-line, #d7dedb);
  --pf-search-ink: var(--pf-ink, #10231c);
  --pf-search-muted: var(--pf-muted, #5c6f69);
  --pf-search-primary: var(--pf-primary, #04624a);
}

@media (prefers-color-scheme: dark) {
  .pf-search-panel,
  .pf-search-btn {
    --pf-search-card: var(--pf-card, #1c1f20);
    --pf-search-surface: var(--pf-surface, #171a1b);
    --pf-search-line: var(--pf-line, #2c3133);
    --pf-search-ink: var(--pf-ink, #e9ecec);
    --pf-search-muted: var(--pf-muted, #a3b0ac);
    --pf-search-primary: var(--pf-primary, #00d492);
  }
}

.pf-search-btn {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 14px;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
}

.pf-search-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.pf-search-btn svg {
  height: 17px;
  width: 17px;
}

.pf-search-panel {
  background: rgba(0, 0, 0, 0.55);
  inset: 0;
  padding: 10vh 16px 16px;
  position: fixed;
  z-index: 200;
}

.pf-search-sheet {
  background: var(--pf-search-card);
  border: 1px solid var(--pf-search-line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  margin: 0 auto;
  max-width: 580px;
  overflow: hidden;
}

.pf-search-bar {
  align-items: center;
  border-bottom: 1px solid var(--pf-search-line);
  display: flex;
  gap: 11px;
  padding: 0 14px;
}

.pf-search-bar svg {
  color: var(--pf-search-muted);
  flex: none;
  height: 19px;
  width: 19px;
}

.pf-search-bar input {
  background: none;
  border: 0;
  color: var(--pf-search-ink);
  flex: 1;
  font: inherit;
  font-size: 16px;
  min-height: 56px;
  outline: none;
}

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

.pf-search-close {
  background: var(--pf-search-surface);
  border: 1px solid var(--pf-search-line);
  border-radius: 7px;
  color: var(--pf-search-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 8px;
}

.pf-search-results {
  max-height: min(60vh, 460px);
  overflow-y: auto;
  padding: 7px;
}

.pf-search-hit {
  border-radius: 10px;
  color: var(--pf-search-ink);
  display: grid;
  gap: 2px;
  padding: 11px 13px;
  text-decoration: none;
}

.pf-search-hit:hover,
.pf-search-hit:focus-visible {
  background: var(--pf-search-surface);
}

.pf-search-kind {
  color: var(--pf-search-primary);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pf-search-hit strong {
  font-size: 15px;
}

.pf-search-hit small {
  color: var(--pf-search-muted);
  font-size: 13px;
  line-height: 1.45;
}

.pf-search-hint {
  color: var(--pf-search-muted);
  font-size: 14px;
  margin: 0;
  padding: 20px 14px;
  text-align: center;
}

@media (max-width: 720px) {
  .pf-search-hint-key {
    display: none;
  }

  .pf-search-btn {
    padding: 0;
    width: 40px;
  }
}

/* In the narrow-screen drawer the control is a full-width row, and the
   word comes back because there is room for it there. Keyed to the same
   breakpoint brand.css uses for the drawer. */
@media (max-width: 900px) {
  .pf-search-btn {
    justify-content: flex-start;
    width: 100%;
  }

  .pf-search-hint-key {
    display: inline;
  }
}
