/* ============================================================
   SEARCH — overlay + results page
   Consumed by assets/js/search.js (overlay markup is injected at
   runtime) and by search-results.html. Everything is expressed in
   the semantic --color-* tokens, so dark mode follows automatically
   from dark-mode.css; nothing here is themed by hand.
   ============================================================ */

/* ========================================================
   1. OVERLAY SHELL
   ======================================================== */
.bf-search {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 1050);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-bg, #fff);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}

.bf-search.is-open {
  opacity: 1;
  visibility: visible;
}

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

.bf-search__inner {
  width: 100%;
  max-width: 900px;
  padding: min(16vh, 140px) 24px 80px;
}

.bf-search__close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-primary, #005dac);
  border-radius: var(--radius-circle, 50%);
  background: var(--color-primary, #005dac);
  color: var(--color-text-inverse, #fff);
  cursor: pointer;
  font-size: 1.05rem;
  transition: background .2s, color .2s, border-color .2s;
}

.bf-search__close:hover {
  background: var(--color-primary-hover, #004e90);
  border-color: var(--color-primary-hover, #004e90);
  color: var(--color-text-inverse, #fff);
}

/* ========================================================
   2. INPUT FIELD
   ======================================================== */
.bf-search__eyebrow {
  display: block;
  font-family: var(--font-secondary, sans-serif);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-primary, #005dac);
  margin-bottom: 14px;
}

.bf-search__field {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid var(--color-border-strong, #cecece);
  padding-bottom: 14px;
  transition: border-color .2s;
}

.bf-search__field:focus-within {
  border-bottom-color: var(--color-primary, #005dac);
}

.bf-search__field > .bi {
  color: var(--color-text-muted, #959595);
  font-size: 1.4rem;
  line-height: 1;
}

.bf-search__input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 0;
  color: var(--color-text-strong, #231f20);
  font-family: var(--font-primary, sans-serif);
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 500;
}

.bf-search__input::placeholder {
  color: var(--color-text-muted, #959595);
  font-weight: 400;
}

/* Hide the browser's own clear affordance — the overlay has its own. */
.bf-search__input::-webkit-search-decoration,
.bf-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* ========================================================
   3. RESULTS LIST (shared by overlay + results page)
   ======================================================== */
.bf-search__results { margin-top: 26px; }

.bf-hits {
  display: flex;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0;
}

.bf-hit {
  border-bottom: 1px solid var(--color-border, #e5e5e5);
}

.bf-hit__link {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  color: var(--color-text, #2e2e2e);
  text-decoration: none;
  transition: gap .2s, color .2s;
}

.bf-hit__link:hover,
.bf-hit__link:focus-visible {
  gap: 20px;
  color: var(--color-primary, #005dac);
}

.bf-hit__body { flex: 1 1 auto; min-width: 0; }

.bf-hit__cat {
  display: block;
  font-family: var(--font-secondary, sans-serif);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-text-muted, #959595);
  margin-bottom: 4px;
}

.bf-hit__ttl {
  display: block;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-text-strong, #231f20);
  transition: color .2s;
}

.bf-hit__link:hover .bf-hit__ttl,
.bf-hit__link:focus-visible .bf-hit__ttl { color: inherit; }

/* Matched terms, highlighted by search.js */
.bf-hit__ttl mark,
.bf-hit__snip mark {
  background: transparent;
  color: var(--color-primary, #005dac);
  font-weight: 600;
}

.bf-hit__snip {
  margin: 8px 0 0;
  color: var(--color-text, #2e2e2e);
  opacity: .82;
  font-size: 15px;
  line-height: 1.65;
}

.bf-hit__arrow {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 6px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

/* PDF results get a badge so it's clear they open a document */
.bf-hit__pdf {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border: 1px solid var(--color-border-strong, #cecece);
  border-radius: var(--radius-xs, 2px);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-muted, #959595);
  vertical-align: middle;
}

/* ========================================================
   4. META — counts, "view all", empty + did-you-mean
   ======================================================== */
.bf-search__viewall {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--color-primary, #005dac);
  color: var(--color-primary, #005dac);
  font-family: var(--font-secondary, sans-serif);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
}

.bf-search__viewall svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.bf-search__count {
  margin: 0 0 6px;
  color: var(--color-text-muted, #959595);
  font-size: 15px;
}

.bf-search__empty {
  margin: 26px 0;
  color: var(--color-text-muted, #959595);
  font-size: 1rem;
  line-height: 1.6;
}

.bf-search__dym {
  color: var(--color-primary, #005dac);
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
}

.bf-search__dym-line {
  margin: 0 0 18px;
  color: var(--color-text-muted, #959595);
  font-size: .98rem;
  font-style: italic;
}

.bf-search__dym-line .bf-search__dym { font-style: normal; }

/* ========================================================
   5. POPULAR TOPICS (shown before the user types)
   ======================================================== */
.bf-search__topics { margin-top: 28px; }

.bf-search__topics h4 {
  margin: 0 0 16px;
  font-family: var(--font-secondary, sans-serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-text-muted, #959595);
}

.bf-search__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bf-search__chip {
  padding: 9px 15px;
  border: 1px solid var(--color-border-strong, #cecece);
  border-radius: var(--radius-sm, 5px);
  background: transparent;
  color: var(--color-text, #2e2e2e);
  font-family: inherit;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}

.bf-search__chip:hover,
.bf-search__chip:focus-visible {
  background: var(--color-surface-tint, rgba(0,0,0,.03));
  border-color: var(--color-primary, #005dac);
  color: var(--color-primary, #005dac);
}

/* ========================================================
   6. FULL RESULTS PAGE (search-results.html)
   ======================================================== */
.bf-searchpage {
  min-height: 72vh;
  background: var(--color-bg, #fff);
}

.bf-searchpage__wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 160px 24px 90px;
}

.bf-searchpage .bf-hit__ttl { font-size: clamp(1.15rem, 2vw, 1.4rem); }
.bf-searchpage .bf-hit__link { padding: 26px 0; }

/* ========================================================
   7. RESPONSIVE
   ======================================================== */
@media (max-width: 768px) {
  .bf-search__inner { padding: 92px 20px 60px; }
  .bf-search__close { top: 16px; right: 16px; }
  .bf-searchpage__wrap { padding: 120px 20px 60px; }
  .bf-hit__snip { font-size: 14px; }
}

/* Body lock while the overlay is open */
body.bf-search-open { overflow: hidden; }
