/*
 * The search entry in the header on wide screens.
 *
 * The theme shows the magnifier only on phones and tablets (below 992px) and keeps the search box hidden on
 * wider screens.  Here the same magnifier is shown at the right end of the menu; a click opens the same search
 * box under it.  Opening and closing is done by the theme's own script, the suggestions while typing by the
 * site's search script (search.js).  Below 992px nothing changes.
 *
 * The second block (at the end) keeps the main menu on one row between 992px and 1169px, where it used to fall
 * into two rows.  It is here because the room the menu has depends on the room taken for the magnifier.
 *
 * Every page with a header loads this file:  <link id="rt-search-css" ...> before </head>, put there by
 * tools\patch-search.mjs.  After a change here: raise "?v=" in that tool (SEARCH_STYLE), run it, then build.
 */
@media (min-width: 992px) {
  /* room for the magnifier to the right of the menu */
  #header .header-main .header-right { padding-right: 46px; }

  #header .header-main .header-right > .searchform-popup {
    display: block;
    position: absolute;
    right: 0;
    top: 50%;
    margin: -20px 0 0;
    line-height: 1;
  }

  /* the magnifier: same size of letter, colours and rounding as an entry of the menu */
  #header .header-main .header-right > .searchform-popup .search-toggle {
    display: block;
    width: 40px;
    height: 40px;
    margin: 0;
    border-radius: 8px;
    font-size: 20px;
    line-height: 40px;
    color: #fff;
    transition: background-color .2s;
  }
  #header .header-main .header-right > .searchform-popup .search-toggle:hover,
  #header .header-main .header-right > .searchform-popup .search-toggle.opened {
    background-color: #3f7ab5;
    color: #fff;
  }
  #header .header-main .header-right > .searchform-popup .search-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -3px;
  }

  /* the box that opens under it (hidden until the magnifier is clicked) */
  #header .header-main .header-right > .searchform-popup .searchform {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1003;
    margin: 9px 0 0;
    border-width: 3px;
    line-height: 36px;
    box-shadow: 0 5px 8px rgba(0, 0, 0, .15);
  }
  #header .header-main .header-right > .searchform-popup .searchform input {
    width: 340px;
    height: 36px;
    line-height: 36px;
    font-size: 14px;
  }
  #header .header-main .header-right > .searchform-popup .searchform button {
    height: 36px;
    line-height: 36px;
    color: #333;
  }
}

/*
 * The main menu on one row between 992px and 1169px.
 *
 * In that range the page is only 960px wide (970px from 1160px on: bootstrap.css and s2c.css switch to the
 * 1140px page at different widths, 1160px and 1170px), and the seven entries of the main menu (English and
 * Chinese) need more room than is left beside the logo, so the last ones fell to a second row - with or without
 * the magnifier.  Slightly smaller letters (18px instead of 20px) and a little less room between the entries
 * keep them on one row, magnifier included.  The menu of the product pages (five entries) fits as it is and is
 * left alone.  From 1170px on the theme's own sizes are used.
 */
@media (min-width: 992px) and (max-width: 1169.98px) {
  #header #menu-main-menu > li.menu-item > a,
  #header #menu-main-menu-tc > li.menu-item > a {
    font-size: 18px;
    padding-left: 7px;
    padding-right: 9px;
  }
}
