/* The header's search button and the panel it opens (src/site-search.js). Loaded with src/navigation.css. */

/* ---- the button ---------------------------------------------------------------------------- */
body header.wrap.nav .np5-search-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  color: #0a2449;
  font: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

/* The button stays out of sight until the script has built the panel it opens. */
body header.wrap.nav .np5-search-toggle[hidden] {
  display: none;
}

body header.wrap.nav .np5-search-toggle:hover,
body header.wrap.nav .np5-search-toggle[aria-expanded="true"] {
  color: #071a3a;
  background: #f0f4f9;
}

body header.wrap.nav .np5-search-toggle:focus-visible {
  outline: 3px solid #91b5e8;
  outline-offset: 4px;
}

body header.wrap.nav .np5-search-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* On a desktop the button follows the links, at the right end of the row (the header's gap there is
   24px, see navigation.css). */
@media (min-width: 1101px) {
  body header.wrap.nav .np5-search-toggle {
    order: 3;
    margin-left: -16px;
  }
}

/* On a phone the search and menu buttons sit together at the right end, the menu last (the header's
   32px gap is taken back, so the two 44px targets touch). */
@media (max-width: 1100px) {
  body header.wrap.nav .np5-search-toggle {
    margin-right: -32px;
    margin-left: auto;
  }
}

/* ---- the panel ----------------------------------------------------------------------------- */
#np5-site-header .np5-search {
  position: absolute;
  top: calc(100% + 1px);
  right: 0;
  left: 0;
  z-index: 99;
  box-sizing: border-box;
  max-height: calc(100dvh - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #1d1d1f;
  background: #fff;
  border-top: 1px solid #e8e8ed;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.14);
}

#np5-site-header .np5-search[hidden] {
  display: none;
}

#np5-search .np5-search-inner {
  box-sizing: border-box;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 16px 20px 26px;
}

#np5-search .np5-search-form {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  margin: 0;
  padding: 0 4px 0 14px;
  background: #f5f5f7;
  border-radius: 12px;
}

#np5-search .np5-search-form:focus-within {
  box-shadow: 0 0 0 3px #91b5e8;
}

#np5-search .np5-search-glass {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: #6e6e73;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 17px keeps iPhones from zooming the page when the field is focused. */
#np5-search .np5-search-input {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  height: 50px;
  margin: 0;
  padding: 0 8px;
  color: #1d1d1f;
  font: inherit;
  font-size: 17px;
  line-height: 1.3;
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

#np5-search .np5-search-input::placeholder {
  color: #6e6e73;
  opacity: 1;
}

#np5-search .np5-search-input::-webkit-search-decoration,
#np5-search .np5-search-input::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

#np5-search .np5-search-close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  color: #1d1d1f;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

#np5-search .np5-search-close:hover {
  background: #e8e8ed;
}

#np5-search .np5-search-close:focus-visible {
  outline: 3px solid #91b5e8;
  outline-offset: 0;
}

#np5-search .np5-search-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

#np5-search .np5-search-status {
  margin: 18px 0 6px;
  padding: 0 2px;
  color: #6e6e73;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0;
}

#np5-search .np5-search-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

#np5-search .np5-search-list li {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #e8e8ed;
}

#np5-search .np5-search-list li:last-child {
  border-bottom: 0;
}

#np5-search .np5-search-result {
  display: block;
  padding: 13px 4px;
  color: #1d1d1f;
  text-decoration: none;
  border-radius: 8px;
}

#np5-search .np5-search-result:hover {
  background: #f5f5f7;
}

#np5-search .np5-search-result:focus-visible {
  background: #f5f5f7;
  outline: 3px solid #91b5e8;
  outline-offset: -3px;
}

#np5-search .np5-search-title {
  display: block;
  color: #1d1d1f;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

#np5-search .is-quick .np5-search-title {
  font-weight: 500;
}

#np5-search .np5-search-text {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: #6e6e73;
  font-size: 14px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

#np5-search mark {
  padding: 0 1px;
  color: #0a2449;
  font-weight: 700;
  background: #dce9fb;
  border-radius: 3px;
}

/* ---- the page behind it ------------------------------------------------------------------- */
.np5-search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.np5-search-backdrop[hidden] {
  display: none;
}

/* The page behind does not scroll while the panel is open; the gutter stays, so nothing shifts sideways. */
html.np5-search-open {
  overflow: hidden;
  scrollbar-gutter: stable;
}

@media (max-width: 700px) {
  #np5-search .np5-search-inner {
    padding: 12px 16px 22px;
  }
}

@media print {
  .np5-search,
  .np5-search-backdrop,
  .np5-search-toggle {
    display: none !important;
  }
}
