/* Phone header compact — PREVIEW ONLY, 2 Dec 2026. Nothing uploaded.
   A proposed sitewide change to the shared site header, on phones only.
   This file is separate from japanese-hub.css. It does not edit cookery-header.css.
   All rules are inside @media (max-width: 600px), so the desktop header is unchanged.
   The preview server injects this file (and phone-header-compact.js) into every HTML page
   unless the URL has ?compactheader=0.

   Aim: logo bar about half height; one smaller nav-icon row (tap targets at least 40px);
   hide the site-count line; search collapses to a magnifier (no-JS: a small visible box).
   Together with the slim title bar and menu + breadcrumb, the whole top should be
   about 25% of an 844px phone screen (~211px).
*/

@media (max-width: 600px) {
  /* ---- logo banner: wordmark stretches the full screen width (Bill, 2 Dec 23:43).
     The magnifier sits on top at the right edge and must not shrink or pad the logo. */
  body:not(.cn-framebar):not(.cn-framehead) header.rx-site,
  body:not(.cn-framebar):not(.cn-framehead) .rx-site {
    position: relative;
  }
  body:not(.cn-framebar):not(.cn-framehead) header.rx-site > a.rx-logo,
  body:not(.cn-framebar):not(.cn-framehead) .rx-site > a.rx-logo {
    height: auto !important;
    max-height: none !important;
    box-sizing: border-box !important;
    display: block !important;
    padding: 0 !important;
    overflow: hidden !important;
    flex: 0 0 calc(100% + 24px) !important;
  }
  body:not(.cn-framebar):not(.cn-framehead) .rx-site > a.rx-logo picture,
  body:not(.cn-framebar):not(.cn-framehead) header.rx-site > a.rx-logo picture {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    line-height: 0;
  }
  body:not(.cn-framebar):not(.cn-framehead) .rx-site > a.rx-logo img,
  body:not(.cn-framebar):not(.cn-framehead) header.rx-site > a.rx-logo img {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    margin: 0 !important;
  }

  /* ---- nav: one smaller row, 40px tap targets */
  body:not(.cn-framebar):not(.cn-framehead) .rx-site > .cookery-nav,
  body:not(.cn-framebar):not(.cn-framehead) header.rx-site > .cookery-nav {
    padding: 0 0 2px !important;
    margin: 0 !important;
  }
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav ul {
    padding: 2px 2px 0 !important;
    gap: 0 !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav li,
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav .cn-btn {
    width: auto !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 0 !important;
  }
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav .cn-card,
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav .cn-face,
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav picture.cn-pic,
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav .cn-pic {
    width: 36px !important;
    height: 36px !important;
    margin: 0 auto !important;
  }
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav .cn-pic img,
  body:not(.cn-framebar):not(.cn-framehead) .cookery-nav .cn-btn img {
    width: 36px !important;
    height: 36px !important;
    object-fit: contain !important;
  }
  /* labels stay hidden on this narrow width, as they already do */

  /* ---- hide the site-count line on the phone */
  body:not(.cn-framebar):not(.cn-framehead) header.rx-site > .co-sitecount,
  body:not(.cn-framebar):not(.cn-framehead) .rx-site > .co-sitecount,
  body:not(.cn-framebar):not(.cn-framehead) .co-sitecount {
    display: none !important;
  }

  /* ---- search: no-JS fallback is a visible small box; with JS it starts as a magnifier */
  body:not(.cn-framebar):not(.cn-framehead) .rx-searchbar,
  body:not(.cn-framebar):not(.cn-framehead) header.rx-site > .rx-searchbar {
    padding: 2px 10px 4px !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  body:not(.cn-framebar) .rx-searchbar .cookery-search--1btn input[type=search] {
    height: 32px;
    font-size: 16px; /* keep 16px so iOS does not zoom */
    padding-top: 3px;
    padding-bottom: 3px;
  }
  body:not(.cn-framebar) .rx-searchbar .cookery-search--1btn .cs-seg {
    min-height: 32px;
    height: 32px;
  }

  /* tighter header bottom padding once sitecount and the tall search are gone */
  body:not(.cn-framebar):not(.cn-framehead) header.rx-site,
  body:not(.cn-framebar):not(.cn-framehead) .rx-site {
    padding-bottom: 2px !important;
  }

  /* Two switchable search placements (preview only, Bill 3 Dec 2026):
     ?search=logo (default) — 36px hit / 28px face circle centred on the "o" of ".com".
       Symbol colour: ?searchcolor=orange (default) or ?searchcolor=white.
       Circle fill is the sampled wordmark letter colour, slightly lifted.
     ?search=nav  — eighth icon in the picture nav row; nothing over the logo.
     The choice is remembered in the session. */
  .ph-search-btn {
    display: none;
  }
}

@media (max-width: 600px) {
  /* Visible face is 28px (a touch larger than the previous 26px); 36px hit area.
     Circle fill #2a241c is the wordmark letter colour sampled from the rendered
     logo close-up (letter cores ~#11100c), lifted a little so the disc is not
     blacker than the neighbouring letters. Symbol defaults to site orange
     #c2410c (recipe search-ribbon, recipe.css .rx-searchbar), or white. */
  html.ph-js .ph-search-btn {
    display: flex;
    position: absolute;
    left: calc(0.8588 * 100vw - 18px);
    right: auto;
    top: 0;
    z-index: 6;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    color: #c2410c; /* orange default; white via html.ph-search-color-white */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  html.ph-js.ph-search-color-white .ph-search-btn {
    color: #fff;
  }
  html.ph-js.ph-search-color-orange .ph-search-btn {
    color: #c2410c;
  }
  html.ph-js .ph-search-btn .ph-search-face {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2a241c;
    box-shadow: 0 1px 1px rgba(0,0,0,.22);
  }
  html.ph-js .ph-search-btn svg {
    display: block;
    width: 18px;
    height: 18px;
  }
  html.ph-js .ph-search-btn:focus-visible {
    outline: 2px dashed #fff;
    outline-offset: 0;
  }
  html.ph-js .ph-search-btn:focus-visible .ph-search-face {
    outline: 2px dashed #fff;
    outline-offset: 2px;
  }
  html.ph-js.ph-search-nav .ph-search-btn {
    display: none !important;
  }
  html.ph-js .rx-searchbar,
  html.ph-js body:not(.cn-framebar):not(.cn-framehead) header.rx-site > .rx-searchbar {
    display: none !important;
  }
  html.ph-js body.ph-search-open .rx-searchbar,
  html.ph-js body.ph-search-open:not(.cn-framebar):not(.cn-framehead) header.rx-site > .rx-searchbar {
    display: block !important;
    order: 5; /* under the nav icons, so the row does not jump */
  }

  /* Eighth picture-nav icon, only when ?search=nav. 40px tap, 36px face, to match the others. */
  html.ph-js.ph-search-nav .cookery-nav .ph-search-navitem,
  html.ph-js.ph-search-nav .cookery-nav .ph-search-navbtn {
    width: auto !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 0 !important;
  }
  html.ph-js.ph-search-nav .ph-search-navbtn {
    margin: 0;
    border: 0;
    background: transparent;
    color: #16141f;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
  }
  html.ph-js.ph-search-nav .ph-search-navbtn:focus-visible {
    outline: 2px dashed #16141f;
    outline-offset: -2px;
  }
  html.ph-js.ph-search-nav .ph-search-navico,
  html.ph-js.ph-search-nav .ph-search-navbtn .cn-card,
  html.ph-js.ph-search-nav .ph-search-navbtn .cn-face {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px !important;
    height: 36px !important;
    margin: 0 auto !important;
  }
  /* Circle at the same 36px face size as the other nav pictures, with a
     cartoon black outline and cutout drop-shadow to match their border/style. */
  html.ph-js.ph-search-nav .ph-search-navico {
    background: #fff8e8;
    border-radius: 50%;
    border: 2.5px solid #16141f;
    box-sizing: border-box;
    box-shadow: none;
    filter: drop-shadow(2px 3px 2px rgba(40,25,10,.38));
    transform: none;
    color: #16141f;
  }
  html.ph-js.ph-search-nav .ph-search-navico svg {
    display: block;
    width: 16px;
    height: 16px;
  }
}
