/**
 * nav-search.css - Expanding navbar search box
 *
 * The search box sits compact and visible by default. On focus (input or
 * submit button), it expands and overlays the nav items to its left rather
 * than pushing the rest of the navbar around. Pure CSS (:focus-within) --
 * no JS required, nothing to keep CSP-clean.
 *
 * The anchor keeps its small footprint in the flex flow at all times so
 * the right-side nav (user menu, dev badge) never shifts; only the form
 * inside it becomes absolutely positioned and grows leftward when focused.
 */

.nav-search-anchor {
  position: relative;
  width: 140px;
  flex: 0 0 auto;
}

.nav-search-form {
  display: flex;
  align-items: center;
  width: 140px;
}

.nav-search-input {
  width: 100%;
}

.nav-search-submit {
  display: none;
  margin-left: 0.375rem;
  flex: 0 0 auto;
}

@media (min-width: 992px) {
  .nav-search-input {
    transition: width 0.15s ease-in-out;
  }

  .nav-search-form:focus-within {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 320px;
    z-index: 1051;
    padding: 0.25rem;
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg, #fff);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
  }

  .nav-search-form:focus-within .nav-search-submit {
    display: inline-flex;
    align-items: center;
  }
}

/* Windows High Contrast Mode support (mirrors sibling editors). */
@media (forced-colors: active) {
  .nav-search-form:focus-within {
    forced-color-adjust: none;
    border: 1px solid ButtonText;
    background-color: Canvas;
  }
}
