/* ==========================================================================
   Chopskip header fit (v1)
   The ONE place that decides how the top menu fits. It is loaded last on
   every page that has the shared header, and on /peel.

   1181px and wider : every link on one row. The link size follows the room
                      left in the bar (container units), so it cannot spill
                      out of the pill, whatever the page or the screen.
   1180px and under : the menu button and a drop-down list.
                      (Used to be 900px. Fourteen links at a readable size
                      do not fit in one row below about 1180px.)

   Why ".nav.nav.nav": repeating the class makes these rules outrank the
   per-page header rules (.fp-hero .nav, .gravy-hero .nav, .m-hero .nav),
   so this file wins without editing those pages. Colours, borders and
   backgrounds of each header are left alone; only the fit is set here.

   Adding or renaming a link later: the number 1.06cqw below is the share
   of the row the link text may fill, tuned for the 14 links on the home
   page (now 15, including Peel & Bloom).
   ========================================================================== */

/* ---------- 1181px and wider: one row ---------- */
@media (min-width:1181px){
  /* Shared header only: the bar's own spacing eases in between 1181px and 1680px,
     so the links keep their old size on laptops instead of running out of room. */
  .nav{
    left:clamp(14px,calc(5.6vw - 52px),42px);
    right:clamp(14px,calc(5.6vw - 52px),42px);
    gap:clamp(13px,calc(1.8vw - 8.3px),22px);
    padding:clamp(11px,calc(.4vw + 6.3px),13px) clamp(17px,calc(1.8vw - 4.3px),26px);
  }
  .nav .logo{font-size:clamp(22px,calc(.6vw + 14.9px),25px)}

  /* Every header */
  .nav.nav.nav ul{
    display:flex;flex:1 1 0%;min-width:0;flex-wrap:nowrap;align-items:center;
    gap:6px;                       /* smallest gap allowed; spare room is shared out above this */
    container-type:inline-size;    /* lets the links size themselves from this row's width */
  }
  .nav.nav.nav ul a{
    white-space:nowrap;
    font-size:clamp(11px,.92vw,15px);       /* older browsers */
    font-size:clamp(11px,1.06cqw,15px);     /* 1.06% of the row width per link-text pixel */
  }

  /* Your Mode page keeps its centred, 12px menu */
  .m-hero .nav.nav.nav ul{gap:clamp(6px,.9vw,16px)}
  .m-hero .nav.nav.nav ul a{font-size:clamp(11px,.9vw,12px);font-size:clamp(11px,1.06cqw,12px)}
}
/* Gravy page keeps its own inset bar (80px each side). Up to 1320px it uses the
   40px inset it already had at 1200px, so thirteen or fourteen links still fit. */
@media (min-width:1181px) and (max-width:1320px){
  .gravy-hero .nav.nav{left:40px;right:40px}
}

/* ---------- 1180px and under: menu button ---------- */
@media (max-width:1180px){
  .nav.nav.nav ul{display:none;flex-wrap:nowrap}
  .nav.nav.nav.open ul{display:flex;flex-direction:column;justify-content:flex-start}
  .nav.nav.nav .burger{display:grid;place-items:center}
  .nav.nav.nav .nav-order-m{display:list-item}
  /* A short page top used to cut the opened list off (Tonight showed 6 of 13 links on a phone,
     Our Story 9, Your Mode 11). While the list is open, those page tops stop clipping downwards.
     The home page and the Freshness Passport page are left out on purpose: their tops are tall
     enough for the whole list, and the home page's background must stay clipped. */
  :is(.hero-page,.story-hero,.decide-hero,.m-hero):has(> .nav.open){overflow-x:clip;overflow-y:visible}
  /* Your Mode page: its top is its own layer, so later sections drew over the list. Lift it while open. */
  .m-hero:has(> .nav.open){z-index:20}
}

/* 901px to 1180px had no drop-down before, so it is drawn here. 900px and under keeps each page's own. */
@media (min-width:901px) and (max-width:1180px){
  .nav{left:14px;right:14px;gap:13px;padding:11px 17px}
  .nav .logo{font-size:22px}
  .nav.nav.nav ul{
    position:absolute;top:calc(100% + 10px);right:0;left:auto;width:min(340px,100%);
    flex:none;margin:0;padding:14px;gap:2px;align-items:stretch;justify-content:flex-start;
    background:#0A2A1C;border:1px solid rgba(255,255,255,.15);border-radius:18px;
    box-shadow:0 18px 38px rgba(0,0,0,.3);max-height:min(72vh,620px);overflow:auto;
  }
  .nav.nav.nav ul a{display:block;padding:10px;font-size:15px;white-space:nowrap}
}

/* Freshness Passport page: its phone menu was meant to be 14px (its own rule says so) but a later
   rule shrank it to 10px. This puts the intended size back. */
@media (max-width:900px){
  .fp-hero .nav.nav.nav ul a{font-size:14px}
}

/* Your Mode page: its own drop-down started at 820px, which left 821px to 900px with the list stuck open */
@media (min-width:821px) and (max-width:900px){
  .m-hero .nav.nav.nav ul{position:absolute;top:56px;left:0;right:0;padding:16px;gap:12px;justify-content:flex-start;background:#0c2a1c;border:0;border-radius:0 0 16px 16px;box-shadow:none}
}

/* ---------- Log in button (links to /login) ----------
   Sits outside the menu list, right before the menu button, so the 14 menu links
   and their fitting rules above are untouched.
   1181px and wider : small round gold person icon at the end of the bar.
   1180px and under : compact gold "Log in" pill next to the menu button. */
.nav.nav.nav .nav-login{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:none;
  font-family:inherit;font-weight:800;font-size:13px;line-height:1;white-space:nowrap;text-decoration:none;
  color:#06231A;background:linear-gradient(135deg,#F6E3A6 0%,#D9B65A 48%,#B8912F 100%);
  padding:9px 14px;border-radius:100px;box-shadow:0 4px 14px rgba(168,131,43,.35);
  transition:transform .2s,box-shadow .2s;
}
.nav.nav.nav .nav-login:hover{transform:translateY(-1px);box-shadow:0 8px 20px rgba(168,131,43,.45)}
.nav.nav.nav .nav-login svg{width:16px;height:16px;flex:none}
@media (min-width:1181px){
  .nav.nav.nav .nav-login{width:36px;height:36px;padding:0}
  .nav.nav.nav .nav-login span{display:none}
}
@media (max-width:1180px){
  .nav.nav.nav .nav-login{margin-left:auto;margin-right:10px}
  .nav.nav.nav .burger{margin-left:0}
}
