/* sitesearch.css — the "find anything" bar, and the landing flash it hands off to.

   Two pieces, both small:
     1. The bar in the banner and its results list.
     2. `.deeplink-target`, the brief highlight on whatever a result lands you on.

   The second matters more than it looks. Sending someone to #cp-branches drops them
   mid-page with no sign of which thing they were sent to — so the destination glows for
   a moment and then lets go. It is the difference between "here" and "somewhere". */

/* ── The bar ────────────────────────────────────────────────────────────── */
.sitesearch {
  position: relative;
  padding: 0 clamp(12px, 3vw, 24px) 0.5rem;
  max-width: 46rem;
  margin: 0 auto;
}

.sitesearch__field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d9cfae;
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
}
.sitesearch__field:focus-within {
  outline: 2px solid #ffb703;
  outline-offset: 1px;
}

.sitesearch__icon { flex: 0 0 auto; opacity: 0.55; }

.sitesearch__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0.3rem 0;
  color: #023047;
  /* --t-small is the floor for secondary text; a search field is not prose but it is
     read, so it does not go below it. Never a raw px value (see the TEXT SIZE STANDARD). */
  font-size: var(--t-small);
}
.sitesearch__input:focus { outline: none; }   /* the ring is on the field, not the input */
.sitesearch__input::placeholder { color: #8a8168; opacity: 1; }

/* Clear button — only meaningful once something is typed, so the JS toggles [hidden]. */
.sitesearch__clear {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #6b6350;
  cursor: pointer;
  /* 24x24 minimum target (WCAG 2.2 SC 2.5.8). */
  min-width: 1.5rem;
  min-height: 1.5rem;
  line-height: 1;
  font-size: var(--t-body);
}
.sitesearch__clear:hover { color: #023047; }

/* ── Results ────────────────────────────────────────────────────────────── */
.sitesearch__results {
  position: absolute;
  z-index: 60;
  left: clamp(12px, 3vw, 24px);
  right: clamp(12px, 3vw, 24px);
  margin-top: 0.35rem;
  max-height: min(60vh, 30rem);
  overflow-y: auto;
  background: #fffdf6;
  border: 1px solid #d9cfae;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(2, 48, 71, 0.18);
  list-style: none;
  padding: 0.25rem;
  margin-bottom: 0;
}

.sitesearch__group {
  font-size: var(--t-micro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a8168;
  padding: 0.5rem 0.75rem 0.15rem;
  font-weight: 700;
}

.sitesearch__opt {
  display: block;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  color: #023047;
}
/* Selection is carried by BACKGROUND AND a left bar, not colour alone (SC 1.4.1) — and
   aria-activedescendant carries it to a screen reader regardless of either. */
.sitesearch__opt[aria-selected="true"] {
  background: #fdf3d8;
  box-shadow: inset 3px 0 0 #ffb703;
}
.sitesearch__opt:hover { background: #f6efdc; }

.sitesearch__title { font-size: var(--t-small); font-weight: 600; display: block; }
/* The definition. NOT a truncated teaser: the no-fishing contract says a term arrives
   with its meaning, and a result that trails off in an ellipsis has not delivered one. */
.sitesearch__what {
  font-size: var(--t-micro);
  color: #5c5647;
  display: block;
  margin-top: 0.1rem;
}

.sitesearch__empty {
  padding: 0.75rem;
  font-size: var(--t-small);
  color: #5c5647;
}

@media (max-width: 639px) {
  .sitesearch { padding-bottom: 0.4rem; }
  /* NO line clamp here, though a phone is where one is most tempting. A three-line clamp
     rendered "…Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog,
     Pig. You hav…" — cutting off exactly the sentence that tells a reader they have four
     animals rather than one. That is a definition sent hunting for its own ending, which
     is the failure this file's own header says it exists to prevent.
     The list scrolls (max-height above). Fewer complete results beat more broken ones. */
}

/* ── The landing flash ──────────────────────────────────────────────────── */
.deeplink-target {
  animation: deeplink-glow 2.2s ease-out 1;
  border-radius: 10px;
}
@keyframes deeplink-glow {
  0%, 12% { box-shadow: 0 0 0 4px rgba(255, 183, 3, 0.55); }
  100%    { box-shadow: 0 0 0 4px rgba(255, 183, 3, 0); }
}
/* A flash is decoration; someone who has asked for less motion gets a plain, static
   outline instead — it still answers "which one", without the movement. */
@media (prefers-reduced-motion: reduce) {
  .deeplink-target {
    animation: none;
    box-shadow: 0 0 0 3px rgba(255, 183, 3, 0.75);
  }
}
