/* ==========================================================================
   Athena Peptides Education — home page wayfinding

   The band directly under the hero: a peptide search box, a link to the full
   A–Z, and four routes into the rest of the site. It exists so a visitor who
   already knows they want BPC-157 can be on the BPC-157 page in one action,
   without reading an educational section or opening a menu first. Everything
   below it on the page is unchanged.

   Palette matches athena-light.css:
     page #FFFFFF   wash #F2F7FC   line #D9E4F0
     navy #12263F   ink-2 #40566F  teal ink #0F7490   teal #2CB5D6
     orange #F58232
   ========================================================================== */

.apx-find {
  background: #FFFFFF;
  border-top: 1px solid #D9E4F0;
  border-bottom: 1px solid #D9E4F0;
  padding: 2.75rem 0 3rem;
}

.apx-find-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 2rem;
}

.apx-find-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #B4530C;
  margin-bottom: .75rem;
  text-align: center;
}

.apx-find h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 400;
  line-height: 1.15;
  color: #12263F;
  text-align: center;
  margin-bottom: .6rem;
}

.apx-find-sub {
  font-size: .95rem;
  line-height: 1.7;
  color: #40566F;
  text-align: center;
  max-width: 540px;
  margin: 0 auto 2rem;
}

/* --------------------------------------------------------------------------
   The search box
   -------------------------------------------------------------------------- */
.apx-search {
  position: relative;
  z-index: 20;
}

.apx-search-field {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: #FFFFFF;
  border: 2px solid #12263F;
  border-radius: 14px;
  padding: 0 1.25rem;
  transition: border-color .2s, box-shadow .2s;
}

.apx-search-field:focus-within {
  border-color: #0F7490;
  box-shadow: 0 0 0 4px rgba(44, 181, 214, .18);
}

.apx-search-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  color: #40566F;
}

/* Large enough to tap comfortably, and to type a compound name into without
   the field feeling like an afterthought next to the hero above it. */
#apxSearch {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: #12263F;
  padding: 1.15rem 0;
}

#apxSearch::placeholder {
  color: #7C8FA6;
  font-weight: 400;
}

/* Safari draws its own clear button on type=search; this hides it so the one
   below is the only one. */
#apxSearch::-webkit-search-decoration,
#apxSearch::-webkit-search-cancel-button,
#apxSearch::-webkit-search-results-button {
  -webkit-appearance: none;
  appearance: none;
}

.apx-search-clear {
  flex-shrink: 0;
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: #40566F;
  padding: .35rem;
  border-radius: 6px;
}

.apx-search-clear:hover {
  color: #B4530C;
}

.apx-search.has-query .apx-search-clear {
  display: block;
}

/* --- results ----------------------------------------------------------- */
.apx-search-results {
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  right: 0;
  background: #FFFFFF;
  border: 1px solid #D9E4F0;
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(18, 38, 63, .16);
  padding: .4rem;
  margin: 0;
  list-style: none;
  max-height: 22rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.apx-search-results[hidden] {
  display: none;
}

.apx-search-results a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  text-decoration: none;
  color: #12263F;
}

.apx-search-results li.is-active a,
.apx-search-results a:hover,
.apx-search-results a:focus-visible {
  background: #F2F7FC;
  color: #12263F;
}

.apx-search-name {
  font-size: .95rem;
  font-weight: 600;
}

.apx-search-name mark {
  background: rgba(44, 181, 214, .28);
  color: inherit;
  border-radius: 3px;
  padding: 0 .1em;
}

.apx-search-group {
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #40566F;
  white-space: nowrap;
  flex-shrink: 0;
}

.apx-search-empty {
  padding: .9rem;
  font-size: .88rem;
  color: #40566F;
}

.apx-search-empty a {
  color: #0F7490;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Browse all
   -------------------------------------------------------------------------- */
.apx-browse-all {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-top: 1.1rem;
  font-size: .92rem;
  font-weight: 600;
  color: #0F7490;
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 116, 144, .35);
  padding-bottom: .15rem;
  transition: color .2s, border-color .2s;
}

.apx-browse-all:hover,
.apx-browse-all:focus-visible {
  color: #B4530C;
  border-color: #F58232;
}

/* --------------------------------------------------------------------------
   The four routes
   -------------------------------------------------------------------------- */
.apx-paths {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .85rem;
  margin-top: 2.75rem;
}

.apx-path {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  background: #FFFFFF;
  border: 1px solid #D9E4F0;
  border-top: 3px solid #12263F;
  border-radius: 12px;
  padding: 1.25rem 1.15rem 1.35rem;
  text-decoration: none;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.apx-path:hover,
.apx-path:focus-visible {
  border-color: #D9E4F0;
  border-top-color: #F58232;
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(18, 38, 63, .1);
}

.apx-path-title {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.3;
  color: #12263F;
}

.apx-path:hover .apx-path-title {
  color: #B4530C;
}

.apx-path-desc {
  font-size: .8rem;
  line-height: 1.55;
  color: #40566F;
}

/* --------------------------------------------------------------------------
   Narrow screens

   Four across becomes two, then one. The search field keeps its full width and
   grows its tap target rather than shrinking to fit beside anything.
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .apx-paths {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  /* The hero is the only thing between the top of the page and the search box,
     so on a phone it gives back the vertical space it does not need. Wording,
     colours and both buttons are untouched. */
  .hero {
    padding: 5.5rem 1.5rem 2.25rem;
  }

  .hero p {
    margin-bottom: 1.75rem;
  }

  .apx-find {
    padding: 2.5rem 0 3rem;
  }

  .apx-find-inner {
    padding: 0 1.25rem;
  }

  .apx-find-sub {
    margin-bottom: 1.5rem;
  }

  .apx-search-field {
    padding: 0 1rem;
    gap: .65rem;
  }

  #apxSearch {
    font-size: 1rem;
    padding: 1.05rem 0;
  }

  /* The placeholder names four compounds, which is the point of it — but it
     must not push the field into a horizontal scroll on a small phone. */
  #apxSearch::placeholder {
    text-overflow: ellipsis;
  }

  .apx-search-results {
    max-height: 60vh;
  }

  .apx-paths {
    grid-template-columns: 1fr;
    gap: .6rem;
    margin-top: 2rem;
  }

  .apx-path {
    padding: 1rem 1.1rem 1.1rem;
  }
}
