/*
 * header-v2.css — exp-0017 header arm, phones and desktop (views/header-v2.php, gated
 * by inc/site-header.php). Styles only its own markup (#site-header-m); the stock
 * #main-header rules never match it.
 *
 * A logo, then a group of matching pills: Tests, Members, search, language. One pill
 * spec: white, #cad5e2 border, fully rounded, 34px tall, regular 16px Open Sans in the
 * site's body grey (16px also stops iOS zooming the page when the search is tapped).
 *
 * Phone (< 728px, the site's own mobile breakpoint): icon logo; Members is a round
 * person-icon pill; search is a round icon pill that opens a full-width box over the
 * row (.hdr-m-searching). Sizes that must give on narrow phones are clamp()s.
 * Desktop (>= 728px): the wordmark at 30px, Members with its label, the search pill
 * open and wide; the bar is slim (58px) and its content keeps to the page width.
 */
#site-header-m {
  margin: 0;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  box-shadow: 0 1px 8px rgba(0, 0, 0, .05);
  font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  box-sizing: border-box;
}
#site-header-m *, #site-header-m *::before, #site-header-m *::after { box-sizing: border-box; }
#site-header-m .hdr-m-inner {
  display: flex;
  align-items: center;
  gap: clamp(6px, 2.4vw, 12px);
  padding: 12px clamp(10px, 4.2vw, 20px);
}

#site-header-m .hdr-m-logo { flex: 0 0 auto; display: block; line-height: 0; }
#site-header-m .hdr-m-logo img { display: block; width: auto; }
#site-header-m .hdr-m-logo img.hdr-m-logo-icon { height: clamp(32px, 10.4vw, 40px); }
#site-header-m .hdr-m-logo img.hdr-m-logo-word { display: none; height: 30px; }

#site-header-m .hdr-m-tools {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(5px, 1.8vw, 8px);
}

/* the shared pill */
#site-header-m .hdr-m-pill,
#site-header-m #langSelectButton {
  height: 34px;
  margin: 0;
  border: 1px solid #cad5e2;
  border-radius: 9999px;
  background: #fff;
  color: #464646;
  font: 400 16px/1 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  box-shadow: none;
  outline: none;
  transition: border-color .18s ease;
}
#site-header-m .hdr-m-pill:hover,
#site-header-m .hdr-m-pill:focus-visible,
#site-header-m input.hdr-m-pill:focus,
#site-header-m #langSelectButton:hover,
#site-header-m #langSelectButton:focus-visible { border-color: #22b9ec; }

/* Tests, Members */
#site-header-m .hdr-m-tests,
#site-header-m .hdr-m-members {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 clamp(10px, 3.6vw, 14px);
  text-decoration: none;
  white-space: nowrap;
}
#site-header-m .hdr-m-members i { width: 16px; margin: 0; font-size: 16px; line-height: 1; text-align: center; }
#site-header-m .hdr-m-members i::before { margin: 0; }

/* search */
#site-header-m .hdr-m-search { position: relative; margin: 0; display: flex; align-items: center; min-width: 0; }
#site-header-m .hdr-m-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; color: #464646; font-size: 16px; line-height: 1; margin: 0; padding: 0; text-align: center; pointer-events: none;
}
#site-header-m .hdr-m-search input {
  display: block; width: 100%; min-width: 0; padding: 0 10px 0 36px;
  text-overflow: ellipsis;  /* a long localized placeholder ends "Bus…", not clipped mid-letter */
  -webkit-appearance: none; appearance: none;
}
#site-header-m .hdr-m-search input::placeholder { color: #464646; opacity: 1; }
#site-header-m .hdr-m-search input::-webkit-search-cancel-button { display: none; }
#site-header-m .hdr-m-search-open,
#site-header-m .hdr-m-search-close {
  display: none; align-items: center; justify-content: center; padding: 0; cursor: pointer; line-height: 1;
  -webkit-appearance: none; appearance: none; min-width: 0; text-transform: none; margin: 0 !important;
}
/* the close x: no box at all (the site's button styles gave it a tinted square) */
#site-header-m .hdr-m-search-close { border: 0 !important; background: none !important; box-shadow: none !important; outline: none; margin: 0 !important; }
#site-header-m .hdr-m-search-open i,
#site-header-m .hdr-m-search-close i { margin: 0; font-size: 16px; line-height: 1; }
#site-header-m .hdr-m-search-open i::before,
#site-header-m .hdr-m-search-close i::before { margin: 0; }

/* language: flag + caret (the flag already names the language) */
#site-header-m .lang-select { flex: 0 0 auto; position: relative; margin: 0 !important; }
#site-header-m #langSelectButton {
  display: flex; align-items: center; gap: 4px; min-width: 0;
  padding: 0 clamp(7px, 2.4vw, 9px) !important; margin: 0 !important; cursor: pointer;
}
#site-header-m #langSelectButton img { margin: 0; }
#site-header-m #langSelectButton .lang-abbr,
#site-header-m #langSelectButton #selectedValue { display: none; }
/* the caret: the icon font's glyph box (16px + 0.2em side margins) was squeezed
   into 14px and clipped, which pushed it right and below the flag's centre line */
#site-header-m #langSelectButton .icon-down-dir {
  display: flex; align-items: center; justify-content: center;
  width: 12px; height: 16px; overflow: visible; line-height: 1; font-size: 14px;
}
#site-header-m #langSelectButton .icon-down-dir::before { margin: 0; width: auto; line-height: 1; }
#site-header-m .lang-select ul { left: auto; right: 0; }  /* open inward from the screen edge */

/* ---- phone ---- */
@media (max-width: 727px) {
  #site-header-m .hdr-m-members { width: 34px; padding: 0; justify-content: center; }
  #site-header-m .hdr-m-members .hdr-m-label { display: none; }
  #site-header-m .hdr-m-search { flex: 0 0 auto; }
  #site-header-m .hdr-m-search-open { display: flex; width: 34px; }
  #site-header-m .hdr-m-search-icon,
  #site-header-m .hdr-m-search input { display: none; }
  /* the search box open: it takes the whole row */
  #site-header-m.hdr-m-searching .hdr-m-tests,
  #site-header-m.hdr-m-searching .hdr-m-members,
  #site-header-m.hdr-m-searching .lang-select,
  #site-header-m.hdr-m-searching .hdr-m-search-open { display: none; }
  #site-header-m.hdr-m-searching .hdr-m-search { flex: 1 1 auto; }
  #site-header-m.hdr-m-searching .hdr-m-search-icon { display: block; }
  #site-header-m.hdr-m-searching .hdr-m-search input { display: block; padding-right: 40px; }
  #site-header-m.hdr-m-searching .hdr-m-search-close {
    display: flex; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border: 0; background: none; color: #464646;
  }
}

/* ---- desktop ---- */
@media (min-width: 728px) {
  #site-header-m .hdr-m-inner { max-width: 1300px; margin: 0 auto; padding: 12px 30px; gap: 24px; }
  #site-header-m .hdr-m-logo img.hdr-m-logo-icon { display: none; }
  #site-header-m .hdr-m-logo img.hdr-m-logo-word { display: block; }
  #site-header-m .hdr-m-tools { gap: 10px; }
  #site-header-m .hdr-m-search { flex: 0 1 320px; }
}

/* dark theme (users who chose it keep it; there is no toggle in this header) */
html.supports-dark-mode.theme-dark #site-header-m { background: #1e1e1e; border-bottom-color: #888; box-shadow: none; }
html.supports-dark-mode.theme-dark #site-header-m .hdr-m-pill { background: transparent; color: #eee; }
html.supports-dark-mode.theme-dark #site-header-m .hdr-m-search-icon,
html.supports-dark-mode.theme-dark #site-header-m .hdr-m-search-close,
html.supports-dark-mode.theme-dark #site-header-m .hdr-m-search input::placeholder { color: #eee; }

/* keep the gap under the bar constant: the stock sheet's 350px rule
   (`#page .content { margin: 0; padding: .5em }`) otherwise pulls the first
   content block up against the header — continuity, not a new layout step */
@media (max-width: 350px) {
  #site-header-m ~ .content { padding-top: 20px; }
}

/* centre the icon glyphs in their round buttons (the icon font's glyph box sits low) */
#site-header-m .hdr-m-search-open i,
#site-header-m .hdr-m-search-close i,
#site-header-m .hdr-m-members i { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
