/* Chrysalis v2 (Claude, 19 Nov 2026): the phone tab bar minimizes while you read (Alik's pick "B, Minimize") and a tab change
   glides like an iPhone. Switch and notes: inc/v2/v2-pb-min.php. Script: v2-pb-min.js.

   1. Minimize. While the header is away (html.nm-hdr-away) the bar closes from the right into one round glass button, 56 px, at
      the bottom left, on the bar's own baseline. The tab you are on stays in it (its white pill becomes the button's face); on a
      page with no tab of its own the button shows four dots. The other tabs and every label fade where they stand, so nothing
      slides over anything. Scrolling up opens it again from that corner. Only the bar's own width is animated (one small fixed
      element), the rest is transform and opacity; plain transitions on one number (--pbm-m: 0 = bar, 1 = button), so turning
      round half way carries on from where it is. The blur itself is never animated.
   2. While the button is shown, and for 0.45 s after the bar starts to open again, a shield lies over the button's place
      (::before), so a quick tap there can never land on a tab passing under the finger: it only opens the bar (v2-pb-min.js).
   3. A tab change carried over to the new page (view transition, only where the browser has it): the page changes at once as
      before; the white pill glides from the old tab to the new one on a spring and stretches a little with its speed, the icons
      change colour, and the new tab's icon gives one small bounce. */

@media (max-width:899.98px) and (min-height:431px){
  :root{
    --pbm-l:max(12px,env(safe-area-inset-left,0px));
    --pbm-r:max(12px,env(safe-area-inset-right,0px));
    --pbm-room:calc(var(--pbm-vw,100vw) - var(--pbm-l) - var(--pbm-r)); /* --pbm-vw: the page width in px, from v2-pb-min.js */
    --pbm-w:min(480px,var(--pbm-room));  /* the open bar, as before */
    --pbm-d:62px;                        /* the button before it is scaled: the bar's own height, so it is round */
    --pbm-s:.9032;                       /* scaled from the bottom left corner: 56 px on screen */
    --pbm-drop:8.7px;                    /* half of the label (12 px type, 14.4 line) and its 3 px gap */
    --pbm-t-out:.44s;                    /* closing */
    --pbm-t-back:.52s;                   /* opening */
    --pbm-e-out:cubic-bezier(.32,.72,0,1);
    --pbm-e-back:cubic-bezier(.22,1.04,.36,1);
  }
  @supports (transition-timing-function:linear(0,1)){
    :root{
      /* closing: a critically damped spring, no bounce. Opening: a spring that goes 0.6 % past and settles */
      --pbm-e-out:linear(0,.066,.204,.357,.498,.618,.715,.79,.847,.889,.921,.944,.96,.972,.98,.986,.99,.993,.995,.997,.998,.998,1);
      --pbm-e-back:linear(0,.049,.162,.3,.44,.567,.677,.767,.838,.892,.931,.959,.979,.991,.999,1.003,1.006,1.006,1.006,1.005,1.005,1.004,1.003,1.002,1);
    }
  }

  /* the bar: same place, same size, same glass. Its width is a number now, so it can close; the tabs keep their own width */
  body.cl3-pb-on .cl3-pb.cl3-pb{
    --pbm-m:0;--pbm-t:var(--pbm-t-back);--pbm-e:var(--pbm-e-back);
    --pbm-tw:calc((var(--pbm-w) - 10px) / var(--n,5));
    left:calc(var(--pbm-l) + max(0px,(var(--pbm-room) - 480px) / 2));right:auto;margin-inline:0;max-width:none;
    width:calc((1 - var(--pbm-m)) * var(--pbm-w) + var(--pbm-m) * var(--pbm-d));
    grid-auto-columns:var(--pbm-tw);
    transform-origin:0 100%;
    transform:scale(calc(1 - var(--pbm-m) * (1 - var(--pbm-s)))) !important; /* in place of v2-pb-hide.css's slide off the screen */
    transition:width var(--pbm-t) var(--pbm-e),transform var(--pbm-t) var(--pbm-e),box-shadow .3s linear;
  }

  /* the shield over the button's place (and, on a page with no tab of its own, the button's four dots). Hidden while the bar is
     open; it stays 0.45 s after the bar starts to open, so a tap there in that moment only lands on the shield */
  body.cl3-pb-on .cl3-pb.cl3-pb::before{
    content:"";position:absolute;z-index:3;left:0;top:0;width:var(--pbm-d);height:100%;visibility:hidden;opacity:0;
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Ccircle cx='8' cy='8' r='2.4'/%3E%3Ccircle cx='16' cy='8' r='2.4'/%3E%3Ccircle cx='8' cy='16' r='2.4'/%3E%3Ccircle cx='16' cy='16' r='2.4'/%3E%3C/svg%3E") 50% 50%/23px 23px no-repeat;
    transition:visibility 0s linear .45s,opacity .1s linear;
  }

  /* CLOSED: the same signal and the same exceptions as v2-pb-hide.css, plus "the reader tapped the button open" (html.pbm-open).
     The selector is written out in full for each rule below; if a case is ever added, add it to all five.
     Since 19 Nov 2026 the signed-in account screens (body.cl-acp) fold too (Alik: "should we disappear the navigation tab into
     account tab, too?"); the account calculator (chv2-ca) and the sign-in screen (chv2-si) still keep the full bar. */
  html.nm-hdr-away:not(.pbm-open):not(.cl-menu-open):not(.ao-hint-on) body.cl3-pb-on:not(.chv2-si):not(.chv2-ca):not(:has(.p3-pbar)):not(:has(.cm-bar.is-on)):not(:has(.sx-panel)) .cl3-pb.cl3-pb:not(:has(:focus-visible)){
    --pbm-m:1;--pbm-t:var(--pbm-t-out);--pbm-e:var(--pbm-e-out);
    overflow:hidden;overflow:clip; /* only while closed: the open bar keeps the pill's shadow, exactly as before */
    box-shadow:0 10px 26px -12px rgba(0,0,0,.9),0 0 0 1px rgba(255,255,255,.14); /* a hairline more, so the button reads on black */
  }
  html.nm-hdr-away:not(.pbm-open):not(.cl-menu-open):not(.ao-hint-on) body.cl3-pb-on:not(.chv2-si):not(.chv2-ca):not(:has(.p3-pbar)):not(:has(.cm-bar.is-on)):not(:has(.sx-panel)) .cl3-pb.cl3-pb:not(:has(:focus-visible)) .cl3-pb__t{pointer-events:none}
  html.nm-hdr-away:not(.pbm-open):not(.cl-menu-open):not(.ao-hint-on) body.cl3-pb-on:not(.chv2-si):not(.chv2-ca):not(:has(.p3-pbar)):not(:has(.cm-bar.is-on)):not(:has(.sx-panel)) .cl3-pb.cl3-pb:not(:has(:focus-visible))::before{visibility:visible;transition:visibility 0s,opacity .2s linear .14s}
  html.nm-hdr-away:not(.pbm-open):not(.cl-menu-open):not(.ao-hint-on) body.cl3-pb-on:not(.chv2-si):not(.chv2-ca):not(:has(.p3-pbar)):not(:has(.cm-bar.is-on)):not(:has(.sx-panel)) .cl3-pb.cl3-pb:not(:has(:focus-visible)):not(:has(.cl3-pb__t.is-on))::before{opacity:1}
  /* the account screens' soft black edge behind the bar (phone.css .acp-edge) fades out while the bar is a button, so rows show to
     the bottom of the screen as on every other page, and comes back with the bar */
  body.cl-acp .acp-edge{transition:opacity .3s cubic-bezier(.2,.7,.2,1)}
  /* leaving an account screen (v2-pb-min.js pageswap) and arriving on the next one: the bar and its edge take their place at once */
  html.pbm-snap body.cl3-pb-on .cl3-pb.cl3-pb,html.pbm-snap body.cl3-pb-on .cl3-pb *,html.pbm-snap body.cl3-pb-on .cl3-pb::before,html.pbm-snap .acp-edge{transition:none !important}
  html:active-view-transition-type(acp-push,acp-pop) body.cl3-pb-on .cl3-pb.cl3-pb,html:active-view-transition-type(acp-push,acp-pop) body.cl3-pb-on .cl3-pb *{transition:none !important} /* own rule: a browser without this selector drops only it */
  html.nm-hdr-away:not(.pbm-open):not(.cl-menu-open):not(.ao-hint-on) body.cl3-pb-on.cl-acp:not(:has(.p3-pbar)):not(:has(.cm-bar.is-on)):not(:has(.sx-panel)):not(:has(.cl3-pb :focus-visible)) .acp-edge{opacity:0;transition-duration:.2s}

  /* each tab knows its place (--k) and whether it stays in the button (--pbm-pin) */
  .cl3-pb a.cl3-pb__t:nth-of-type(1){--k:0}
  .cl3-pb a.cl3-pb__t:nth-of-type(2){--k:1}
  .cl3-pb a.cl3-pb__t:nth-of-type(3){--k:2}
  .cl3-pb a.cl3-pb__t:nth-of-type(4){--k:3}
  .cl3-pb a.cl3-pb__t:nth-of-type(5){--k:4}
  .cl3-pb .cl3-pb__t{--pbm-pin:0}
  .cl3-pb .cl3-pb__t.is-on{--pbm-pin:1}

  /* the chosen tab glides to the middle of the button (26 px in from the bar's padding). The others fade where they stand:
     closing, all at once and fast; opening, from left to right (70 ms apart), each once the bar's growing edge has passed it */
  body.cl3-pb-on .cl3-pb .cl3-pb__t{
    transform:translateX(calc(var(--pbm-m) * var(--pbm-pin) * ((var(--k,0) + .5) * -100% + 26px)));
    opacity:calc(1 - var(--pbm-m) * (1 - var(--pbm-pin)));
    transition:color .18s linear,
      transform var(--pbm-t) var(--pbm-e),
      opacity calc(.07s + (1 - var(--pbm-m)) * .13s) cubic-bezier(.3,0,.5,1) calc((1 - var(--pbm-m)) * (.04s + var(--k,0) * .07s));
  }
  body.cl3-pb-on .cl3-pb.is-go .cl3-pb__t{transition:none} /* as before: a tapped tab must land before Safari stops painting */

  /* labels fade, they are never squeezed */
  body.cl3-pb-on .cl3-pb .cl3-pb__l{
    opacity:calc(1 - var(--pbm-m));
    transition:opacity calc(.08s + (1 - var(--pbm-m)) * .14s) linear calc((1 - var(--pbm-m)) * .16s);
  }

  /* the icon that stays drops to the middle of the button (half the label and its gap) and keeps its size on screen */
  body.cl3-pb-on .cl3-pb .cl3-pb__i svg{
    transform:translateY(calc(var(--pbm-m) * var(--pbm-pin) * var(--pbm-drop))) scale(calc(1 + var(--pbm-m) * var(--pbm-pin) * .1));
    transition:transform var(--pbm-t) var(--pbm-e);
  }
  body.cl3-pb-on .cl3-pb .cl3-pb__i [data-minicart-count-badge]{ /* the Cart count stays on its bag */
    transform:translateY(calc(var(--pbm-m) * var(--pbm-pin) * var(--pbm-drop)));
    transition:transform var(--pbm-t) var(--pbm-e);
  }

  /* the white pill behind the chosen tab: moves with its tab (the same formula, so the icon stays in its middle) and shrinks to a
     circle. It stays: it is the button's face. phone-bar.js's own tap slide uses the same steps (one tab width each) */
  body.cl3-pb-on .cl3-pb .cl3-pb__g{
    width:calc((1 - var(--pbm-m)) * var(--pbm-tw) + var(--pbm-m) * (var(--pbm-d) - 10px));
    transform:translateX(calc((1 - var(--pbm-m)) * var(--i,0) * var(--pbm-tw)));
    transition:transform var(--pbm-t) var(--pbm-e),width var(--pbm-t) var(--pbm-e),opacity .16s linear;
  }
}

/* reduced motion: no morph, the bar and the button simply swap (the shield keeps its 0.45 s) */
@media (max-width:899.98px) and (min-height:431px) and (prefers-reduced-motion:reduce){
  body.cl3-pb-on .cl3-pb.cl3-pb,
  body.cl3-pb-on .cl3-pb .cl3-pb__t,
  body.cl3-pb-on .cl3-pb .cl3-pb__l,
  body.cl3-pb-on .cl3-pb .cl3-pb__i svg,
  body.cl3-pb-on .cl3-pb .cl3-pb__i [data-minicart-count-badge],
  body.cl3-pb-on .cl3-pb .cl3-pb__g{transition:none !important}
}

/* ------------------------------------------------------------------ 3. a tab change, carried over to the new page */
/* Both pages take part only on a phone, and not with reduced motion. The head script in v2-pb-min.php skips every page change
   that is not a tap on the bar, so nothing else on the site changes. While a tab change runs (html.cl-pb-vt) the bar's parts get
   names: the white pill, and the icon and label of the two tabs that change (html.cl-pb-vt-from-N / -to-N); the other tabs stay
   still in the page itself, so they never flicker. */
@media (max-width:899.98px) and (min-height:431px) and (prefers-reduced-motion:no-preference){
  @view-transition{navigation:auto}
  html.cl-pb-vt .cl3-pb[data-on] .cl3-pb__g{view-transition-name:cl-pb-pill}
  html.cl-pb-vt:is(.cl-pb-vt-from-1,.cl-pb-vt-to-1) .cl3-pb a.cl3-pb__t:nth-of-type(1) .cl3-pb__i{view-transition-name:cl-pb-i1}
  html.cl-pb-vt:is(.cl-pb-vt-from-1,.cl-pb-vt-to-1) .cl3-pb a.cl3-pb__t:nth-of-type(1) .cl3-pb__l{view-transition-name:cl-pb-l1}
  html.cl-pb-vt:is(.cl-pb-vt-from-2,.cl-pb-vt-to-2) .cl3-pb a.cl3-pb__t:nth-of-type(2) .cl3-pb__i{view-transition-name:cl-pb-i2}
  html.cl-pb-vt:is(.cl-pb-vt-from-2,.cl-pb-vt-to-2) .cl3-pb a.cl3-pb__t:nth-of-type(2) .cl3-pb__l{view-transition-name:cl-pb-l2}
  html.cl-pb-vt:is(.cl-pb-vt-from-3,.cl-pb-vt-to-3) .cl3-pb a.cl3-pb__t:nth-of-type(3) .cl3-pb__i{view-transition-name:cl-pb-i3}
  html.cl-pb-vt:is(.cl-pb-vt-from-3,.cl-pb-vt-to-3) .cl3-pb a.cl3-pb__t:nth-of-type(3) .cl3-pb__l{view-transition-name:cl-pb-l3}
  html.cl-pb-vt:is(.cl-pb-vt-from-4,.cl-pb-vt-to-4) .cl3-pb a.cl3-pb__t:nth-of-type(4) .cl3-pb__i{view-transition-name:cl-pb-i4}
  html.cl-pb-vt:is(.cl-pb-vt-from-4,.cl-pb-vt-to-4) .cl3-pb a.cl3-pb__t:nth-of-type(4) .cl3-pb__l{view-transition-name:cl-pb-l4}
  html.cl-pb-vt:is(.cl-pb-vt-from-5,.cl-pb-vt-to-5) .cl3-pb a.cl3-pb__t:nth-of-type(5) .cl3-pb__i{view-transition-name:cl-pb-i5}
  html.cl-pb-vt:is(.cl-pb-vt-from-5,.cl-pb-vt-to-5) .cl3-pb a.cl3-pb__t:nth-of-type(5) .cl3-pb__l{view-transition-name:cl-pb-l5}
}
/* during the glide (new page only: html.cl-pb-vt-in) the bar is drawn without its blur, in the same dark: a page snapshot
   cannot show a blur (iPhone draws the page through it). The icons and labels carry their colour themselves rather than only
   inheriting it from the link, so their snapshots keep it (iPhone otherwise tints them blue for that moment). */
@media (max-width:899.98px) and (min-height:431px) and (prefers-reduced-motion:no-preference){
  html.cl-pb-vt-in body.cl3-pb-on .cl3-pb.cl3-pb{-webkit-backdrop-filter:none;backdrop-filter:none;background:#16161a}
  html.cl-pb-vt body.cl3-pb-on .cl3-pb .cl3-pb__t :is(.cl3-pb__i,.cl3-pb__l){color:rgba(255,255,255,.64)}
  html.cl-pb-vt body.cl3-pb-on .cl3-pb .cl3-pb__t.is-on :is(.cl3-pb__i,.cl3-pb__l){color:#0e0e10}
}
/* the page itself changes at once, exactly as before; a touch during the 0.5 s ends the glide at once (head script), so no tap is lost */
html.cl-pb-vt::view-transition{pointer-events:none}
html.cl-pb-vt::view-transition-old(root){animation:none;opacity:0}
html.cl-pb-vt::view-transition-new(root){animation:none}
/* the white pill glides to the new tab on a spring (about 4 % past, then settles) and stretches a little with its speed */
html.cl-pb-vt::view-transition-group(cl-pb-pill){animation-duration:.5s;animation-timing-function:cubic-bezier(.3,1.25,.5,1)}
@supports (transition-timing-function:linear(0,1)){
  html.cl-pb-vt::view-transition-group(cl-pb-pill){animation-timing-function:linear(0,.047,.161,.306,.458,.601,.726,.828,.907,.965,1.005,1.029,1.042,1.046,1.045,1.04,1.033,1.026,1.02,1.014,1.009,1.005,1.002,1,1)}
}
/* landing on the first or the last tab: no overshoot, so the pill never leaves the bar's rounded end */
html.cl-pb-vt.cl-pb-vt-edge::view-transition-group(cl-pb-pill){animation-timing-function:cubic-bezier(.32,.72,0,1)}
html.cl-pb-vt::view-transition-image-pair(cl-pb-pill){animation:cl-pb-stretch .5s cubic-bezier(.3,0,.25,1) both}
html.cl-pb-vt::view-transition-old(cl-pb-pill){animation:none;opacity:0}
html.cl-pb-vt::view-transition-new(cl-pb-pill){animation:none}
/* coming from a page with no tab of its own: the pill appears on its tab instead of gliding */
html.cl-pb-vt.cl-pb-vt-new::view-transition-image-pair(cl-pb-pill){animation:none}
html.cl-pb-vt.cl-pb-vt-new::view-transition-new(cl-pb-pill){animation:cl-pb-in .42s cubic-bezier(.22,1.04,.36,1) both}
/* the icons and labels change colour in place; the new tab's icon gives one small bounce */
html.cl-pb-vt::view-transition-group(cl-pb-i1),html.cl-pb-vt::view-transition-group(cl-pb-i2),html.cl-pb-vt::view-transition-group(cl-pb-i3),
html.cl-pb-vt::view-transition-group(cl-pb-i4),html.cl-pb-vt::view-transition-group(cl-pb-i5),
html.cl-pb-vt::view-transition-group(cl-pb-l1),html.cl-pb-vt::view-transition-group(cl-pb-l2),html.cl-pb-vt::view-transition-group(cl-pb-l3),
html.cl-pb-vt::view-transition-group(cl-pb-l4),html.cl-pb-vt::view-transition-group(cl-pb-l5){animation-duration:.3s;z-index:1}
html.cl-pb-vt-to-1::view-transition-image-pair(cl-pb-i1),html.cl-pb-vt-to-2::view-transition-image-pair(cl-pb-i2),
html.cl-pb-vt-to-3::view-transition-image-pair(cl-pb-i3),html.cl-pb-vt-to-4::view-transition-image-pair(cl-pb-i4),
html.cl-pb-vt-to-5::view-transition-image-pair(cl-pb-i5){animation:cl-pb-pop .5s cubic-bezier(.3,.7,.3,1) .05s both}
@keyframes cl-pb-stretch{0%{transform:none}38%{transform:scale(1.16,.9)}100%{transform:none}}
@keyframes cl-pb-in{0%{opacity:0;transform:scale(.6)}100%{opacity:1;transform:none}}
@keyframes cl-pb-pop{0%{transform:none}28%{transform:scale(.86)}60%{transform:scale(1.13)}82%{transform:scale(.97)}100%{transform:none}}

/* ------------------------------------------------------------------ 4. reading pages (Claude, 19 Nov 2026, local fix read19) */
/* The full article check (19 Nov 2026) found the folded button and the WhatsApp button sitting on the article's text (first
   words of lines, links, FAQ questions, figure values). Only on reading pages, marked by the articles plugin: articles and reading
   guides (body.bl-wa-read) and the Blog lists (body.bl-wa-quiet). Every other page keeps B exactly as above.
   a. The tab bar: while it is folded (the same CLOSED condition as above, written out once more) it also slides down out of view,
      on the separate translate property, so it composes with the bar's own scale; the same springs (closing without bounce,
      opening with the small settle). Scrolling up brings it back with the header, as everywhere. Reduced motion: the bar simply
      swaps (the transition:none above covers translate too). */
@media (max-width:899.98px) and (min-height:431px){
  body.cl3-pb-on:is(.bl-wa-read,.bl-wa-quiet) .cl3-pb.cl3-pb{
    transition:width var(--pbm-t) var(--pbm-e),transform var(--pbm-t) var(--pbm-e),translate var(--pbm-t) var(--pbm-e),box-shadow .3s linear;
  }
  html.nm-hdr-away:not(.pbm-open):not(.cl-menu-open):not(.ao-hint-on) body.cl3-pb-on:is(.bl-wa-read,.bl-wa-quiet):not(.chv2-si):not(.chv2-ca):not(:has(.p3-pbar)):not(:has(.cm-bar.is-on)):not(:has(.sx-panel)) .cl3-pb.cl3-pb:not(:has(:focus-visible)){
    translate:0 calc(100% + 28px + env(safe-area-inset-bottom,0px));
  }
}
/* b. WhatsApp on reading pages (phones): no tip at all, on the Blog lists too (the note and the hover label); otherwise the Blog
      lists keep the button exactly as before. On articles and reading guides the button keeps off the intro: html.pbm-rd (set in
      the footer before any script, then kept by v2-pb-min.js) keeps it out of view until the reader has scrolled past the first
      screen (html.pbm-rd-past), then it shows while the header is shown (scrolling up) and, once the article is over ("More in" on
      screen: html.pbm-rd-end), whatever the direction. Out of view = faded out where it stands (opacity, no taps), never moved:
      blog.css's step-aside (translate) is cancelled here, so chrome.js always checks the spot the button really comes back to and
      keeps it off pictures, headings and controls from the first frame. Not visibility: a keyboard user who tabs to it keeps it.
      When chrome.js puts it aside it fades out (chrome.css's off transition; blog.css's own one would drop it at once). The
      article's own "Ask on WhatsApp" is untouched. Without the scripts the button is exactly as before. */
@media (max-width:899.98px){
  body:is(.bl-wa-read,.bl-wa-quiet) .cl-wa :is(.cl-wa__say,.cl-wa__tip){display:none}
  html.pbm-rd:not(.fyd-wa-up) body.bl-wa-read.bl-wa-quiet .cl-wa.cl-wa{translate:none}
  html.nm-hdr-away body.bl-wa-quiet.bl-wa-read .cl-wa:focus-visible{translate:none} /* blog.css's step-aside, for a focused button */
  html.cl3-wa-off body.bl-wa-quiet .cl-wa{transition:opacity .2s ease,transform .2s ease,visibility 0s linear .2s}
  html.pbm-rd:not(.pbm-rd-end):is(:not(.pbm-rd-past),.nm-hdr-away) body.bl-wa-read .cl-wa:not(:focus-visible){opacity:0;pointer-events:none}
}
@media (max-width:899.98px) and (prefers-reduced-motion:reduce){
  html.cl3-wa-off body.bl-wa-quiet .cl-wa{transition:none}
}
