/* HabHub global search. Tokens only (habhub.css :root); brand colours are
   never tinted/alpha'd (brand book rule). No dark mode in HabHub — the
   accessibility attributes (data-contrast, data-text) are honoured instead. */
.hh-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.hh-search { position: relative; display: flex; align-items: center; gap: 0.5rem;
  background: #fff; border: 2px solid var(--hh-text); border-radius: 0.6rem;
  font-family: var(--hh-sans); }
.hh-search:focus-within { outline: 3px solid var(--hh-link); outline-offset: 2px; }
.hh-search-icon { color: var(--hh-muted); }
.hh-search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--hh-text); }
.hh-search-input::placeholder { color: var(--hh-faint); }
.hh-search-input::-webkit-search-cancel-button { cursor: pointer; }
.hh-search-kbd { border: 1px solid var(--hh-gray-4); border-radius: 0.3rem; padding: 0 0.4rem;
  font-size: 0.8rem; color: var(--hh-muted); background: #fff; }

.hh-search--large { margin: 1rem 0 0.25rem; padding: 0.8rem 1rem; font-size: 1.1rem; }
.hh-search--compact { flex: 0 1 18rem; width: auto; min-width: 12rem; padding: 0.35rem 0.6rem; font-size: 0.95rem; }
.hh-search--compact .hh-search-kbd { display: none; }
.hh-search-close { display: none; background: none; border: 0; font-size: 1.6rem; line-height: 1;
  color: var(--hh-text); cursor: pointer; padding: 0 0.3rem; }
.hh-search-toggle { display: none; background: none; border: 0; font-size: 1.15rem;
  color: var(--hh-text); cursor: pointer; padding: 0.25rem; }

.hh-search-pop { position: absolute; top: calc(100% + 0.4rem); left: 0; right: 0; z-index: 1050;
  background: #fff; border: 1px solid var(--hh-border); border-radius: 0.6rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); max-height: 70vh; overflow-y: auto; padding: 0.35rem 0; }
.hh-search--compact .hh-search-pop { width: 28rem; left: auto; }
.hh-search-group { padding: 0.5rem 0.9rem 0.2rem; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--hh-muted); }
.hh-search-opt { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.45rem 0.9rem;
  color: var(--hh-text); text-decoration: none; }
.hh-search-opt:hover, .hh-search-opt[aria-selected="true"] { background: var(--hh-gray-1); }
.hh-search-opt-icon { width: 1.4rem; text-align: center; color: var(--hh-dark-blue); padding-top: 0.1rem; }
.hh-search-opt-body { display: flex; flex-direction: column; min-width: 0; }
.hh-search-opt-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-search-opt-sub { font-size: 0.8rem; color: var(--hh-muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.hh-search-all { border-top: 1px solid var(--hh-border); margin-top: 0.3rem; color: var(--hh-link); }
.hh-search-none { padding: 0.6rem 0.9rem; color: var(--hh-muted); font-size: 0.9rem; }
.hh-search-clear { display: block; margin: 0.3rem 0.9rem 0.2rem auto; background: none; border: 0;
  color: var(--hh-link); font: inherit; font-size: 0.85rem; cursor: pointer; }
.hh-search mark, .hh-sr mark { background: var(--hh-gold); color: var(--hh-text); padding: 0 0.1em;
  border-radius: 0.15em; }

html[data-contrast="on"] .hh-search, html[data-contrast="on"] .hh-search-pop { border-color: #000; }
html[data-contrast="on"] .hh-search-opt[aria-selected="true"] { outline: 2px solid #000; }

/* BREAKPOINT: keep in sync with HH_SEARCH_COLLAPSE in search.js. Below 1200px
   the inline field collapses to the magnifier toggle + overlay. */
@media (max-width: 1199px) {
  .hh-search-toggle { display: inline-block; }
  .hh-search--compact { display: none; }
  .hh-search--compact.is-open { display: flex; position: fixed; inset: 0 0 auto 0; z-index: 1100;
    width: auto; margin: 0; border-radius: 0; padding: 0.8rem 1rem; }
  .hh-search--compact.is-open .hh-search-close { display: inline-block; }
  .hh-search--compact.is-open .hh-search-pop { position: fixed; top: 3.6rem; left: 0; right: 0;
    width: auto; max-height: calc(100vh - 3.6rem); border-radius: 0; }
}
@media (max-width: 767px) {
  .hh-search--large { font-size: 1rem; }
}

/* ---- Results page (split view) ---- */
.hh-sr { max-width: 1400px; }
.hh-sr-hint { color: var(--hh-muted); font-size: 0.9rem; }
.hh-sr-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.9rem 0; }
.hh-sr-chip { border: 1px solid var(--hh-gray-4); border-radius: 999px; padding: 0.25rem 0.8rem;
  color: var(--hh-text); text-decoration: none; font-size: 0.9rem; background: #fff; }
.hh-sr-chip.is-active { background: var(--hh-text); color: #fff; border-color: var(--hh-text); }
.hh-sr-count { font-weight: 700; margin-left: 0.15rem; }
.hh-sr-split { display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 1fr); gap: 1rem;
  align-items: start; }
.hh-sr-list { list-style: none; margin: 0; padding: 0; }
.hh-sr-item { display: flex; gap: 0.7rem; padding: 0.7rem 0.8rem; margin-bottom: 0.45rem;
  background: #fff; border: 1px solid var(--hh-border); border-radius: 0.6rem; cursor: pointer; outline: none; }
.hh-sr-item:hover { border-color: var(--hh-gray-6); }
.hh-sr-item:focus-visible { outline: 3px solid var(--hh-link); outline-offset: 1px; }
.hh-sr-item.is-selected { border: 2px solid var(--hh-purple); padding: calc(0.7rem - 1px) calc(0.8rem - 1px); }
.hh-sr-icon { flex: 0 0 2rem; height: 2rem; border-radius: 0.45rem; display: flex; align-items: center;
  justify-content: center; color: #fff; background: var(--hh-dark-blue); }
.hh-sr-icon--policy { background: var(--hh-purple); }
.hh-sr-icon--policy_form { background: var(--hh-magenta); }
.hh-sr-icon--document, .hh-sr-icon--folder { background: var(--hh-dark-blue); }
.hh-sr-icon--person { background: var(--hh-green); color: var(--hh-text); }
.hh-sr-icon--tool { background: var(--hh-gold); color: var(--hh-text); }
.hh-sr-icon--training { background: var(--hh-cyan); color: var(--hh-text); }
.hh-sr-icon--news, .hh-sr-icon--site, .hh-sr-icon--page, .hh-sr-icon--announcement { background: var(--hh-gray-10); }
.hh-sr-body { min-width: 0; }
.hh-sr-title { font-weight: 700; color: var(--hh-link); text-decoration: none; }
.hh-sr-title:hover { text-decoration: underline; }
.hh-sr-meta { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; font-size: 0.8rem; color: var(--hh-muted); margin-top: 0.15rem; }
.hh-sr-kind { font-weight: 700; }
.hh-sr-ext { border: 1px solid var(--hh-gray-4); border-radius: 0.25rem; padding: 0 0.3rem; font-size: 0.7rem; }
.hh-sr-viewed { color: var(--hh-text); }
.hh-sr-item.is-viewed .hh-sr-title { color: var(--hh-purple); }
.hh-sr-snippet { margin: 0.3rem 0 0; font-size: 0.88rem; color: var(--hh-text); }
.hh-sr-pane { position: sticky; top: 5rem; background: #fff; border: 1px solid var(--hh-border);
  border-radius: 0.6rem; padding: 1rem; min-height: 60vh; max-height: calc(100vh - 6rem); overflow-y: auto; }
.hh-sr-back { display: none; }
.hh-sr-pane-empty { color: var(--hh-muted); text-align: center; margin-top: 20vh; }
.hh-sr-empty { background: #fff; border: 1px solid var(--hh-border); border-radius: 0.6rem; padding: 1.2rem; }
.hh-sr-pages { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

.hh-pv-head { display: flex; gap: 0.7rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 0.8rem; }
.hh-pv-titles { flex: 1; min-width: 12rem; }
.hh-pv-title { margin: 0; font-size: 1.15rem; color: var(--hh-text); }
.hh-pv-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.hh-pv-passage { background: var(--hh-gray-1); border-left: 4px solid var(--hh-gold); padding: 0.6rem 0.8rem;
  border-radius: 0.3rem; font-size: 0.92rem; }
.hh-pv-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0.6rem 0; }
.hh-pv-facts dt { font-weight: 700; color: var(--hh-muted); }
.hh-pv-facts dd { margin: 0; }
.hh-pv-frame { width: 100%; height: 70vh; border: 1px solid var(--hh-border); border-radius: 0.4rem; }
.hh-pv-image { max-width: 100%; border-radius: 0.4rem; }
.hh-pv-text { white-space: pre-line; line-height: 1.55; }
.hh-pv-children { list-style: none; padding: 0; }
.hh-pv-children li { padding: 0.3rem 0; border-bottom: 1px solid var(--hh-border); }

html[data-contrast="on"] .hh-sr-item, html[data-contrast="on"] .hh-sr-pane { border-color: #000; }

@media (max-width: 767px) {
  .hh-sr-split { display: block; }
  .hh-sr-pane { display: none; }
  body.hh-sr-sheet-open { overflow: hidden; }
  body.hh-sr-sheet-open .hh-sr-pane { display: block; position: fixed; inset: 0; z-index: 1100;
    border-radius: 0; max-height: none; min-height: 0; top: 0; }
  body.hh-sr-sheet-open .hh-sr-back { display: inline-flex; gap: 0.4rem; align-items: center;
    background: none; border: 0; color: var(--hh-link); font: inherit; font-weight: 700;
    padding: 0 0 0.8rem; cursor: pointer; }
  .hh-pv-frame { height: 65vh; }
}
