/* Fix round 2, group fyd: floating layers, part 2 (Claude, 15 Nov 2026; SPEC-fix2.md "### fyd", audit/PLAN.md row 1.1 with
   audit/CHALLENGE.md "1.1" changes 2 and 3). Loaded by inc/v2/v2-fix2-fyd.php only while round 2 is on (<body> carries chvf2),
   after every other stylesheet. No word, no new colour: the values below are the site's own (stack bar edge, kit motion).
   The two avoid lists of the WhatsApp button and its note are in assets/v3/chrome/chrome.js (CTL) and wa-tip.js (KEEP). */

/* ---- 1. Wholesale, phones: the ring's controls sat under the tab bar on the first screen --------------------------------------
   The ring is the home page's hero, sized for a price card under it (assets/v3/chrome/phone-bar.css). Wholesale has the
   research-use line and the ring's controls there instead, 85 px taller, so the controls ended under the tab bar on every phone
   up to 890 px tall. Here they rise until their lower edge is var(--cl3-pb) + 16px above the screen's bottom:
     --fyd-f0  the ring's size today (phone-bar.css's own formula)
     --fyd-l   how far the controls must rise: their lower edge today (button 285 px, the ring's visible part, the line and the
               controls 120 px, less what the hero already closes up on short screens) against the screen; 0 on tall phones
     --fyd-p   part of it taken from the black between the white button and the ring's top bracket, never leaving less than 16 px
               there (on short screens, where the hero has used that black already, nothing)
   The rest comes from the line's gap (it moves into the ring's faded foot, .33), the controls' top padding (.05) and the ring's
   size. The ring keeps its place under the button. Not while the ring is a still picture (no controls then). */
@media (max-width:899.98px) and (min-height:431px){
  html body.chvf2.cl3-pb-on.cl-content--wholesale .c3-root.h3[data-h3]:not([data-h3-state="static"]){
    --fyd-f0:clamp(calc(290px - var(--c4s) * .78),calc((var(--c4vh) - 312px - var(--cl3-pb) - var(--cl3-pb-lead,0px)) / .86),460px);
    --fyd-l:max(0px,calc(421px + var(--cl3-pb) + var(--fyd-f0) * .86 - var(--c4s) * .4 - var(--c4vh)));
    --fyd-p:max(0px,min(calc(var(--fyd-f0) * .14 - var(--c4s) * .2 - 16px),calc(var(--fyd-l) * .2353)))}
  html body.chvf2.cl3-pb-on.cl-content--wholesale .c3-root.h3[data-h3]:not([data-h3-state="static"]) .h3-frame{
    --c4fh:calc(var(--fyd-f0) - var(--fyd-l) * .866 + var(--fyd-p) * 1.389);
    margin-top:calc(var(--c4fh) * -.28 + var(--fyd-f0) * .14 - var(--c4s) * .2 - var(--fyd-p))}
  html body.chvf2.cl3-pb-on.cl-content--wholesale .c3-root.h3[data-h3]:not([data-h3-state="static"]) .h3-ruo{margin-top:calc(16px - var(--fyd-l) * .3294)}
  html body.chvf2.cl3-pb-on.cl-content--wholesale .c3-root.h3[data-h3]:not([data-h3-state="static"]) .h3-foot{padding-top:calc(14px - var(--fyd-l) * .0471)}
}
/* the research-use line in a centred 260 px block (two even lines, clear of the WhatsApp button at the right) */
@media (max-width:899.98px){
  html body.chvf2.cl-content--wholesale .c3-root.h3[data-h3] .h3-ruo{max-width:260px;text-wrap:balance}
}

/* ---- 2. Cart and Build a Stack, phones: the bottom bars ---------------------------------------------------------------------
   a. The cart's Total + Checkout bar had lost its edge in the dark look (its ring and shadow are dark on dark), so it read as
      text printed over the list. It takes the stack bar's own edge (assets/v4/v2-stack.css). */
@media (max-width:899px){
  html:not(.no-js) body.chvf2 .cm-bar{box-shadow:0 0 0 1px rgba(255,255,255,.12),0 14px 36px -12px rgba(0,0,0,.7)}

  /* b. At first load a bar waits while the place it rests on holds one of the page's controls (the cart's second line, the
        first row's size chips); the first scroll, tap or key brings it in with its own slide (assets/v4/v2-fix2-fyd.js).
        Until that script has looked (html.fyd-bars) the bars stay back, so they never appear and vanish again; if the script
        never runs they come in after 4 s as before. */
  html:not(.no-js):not(.fyd-bars) body.chvf2 .cm-bar.is-on,
  html:not(.no-js):not(.fyd-bars) body.chvf2 .sx-page .sx-panel:not(.is-open){animation:fyd-hold 0s linear 4s backwards}
  html.fyd-bar-wait body.chvf2 .cm-bar.is-on,
  html.fyd-bar-wait body.chvf2 .sx-page .sx-panel:not(.is-open){visibility:hidden;transform:translateY(calc(100% + var(--cl3-pb,0px) + 24px));transition:none}
  html.fyd-bars body.chvf2 .sx-page .sx-panel:not(.is-open){transition:transform .3s cubic-bezier(.165,.84,.44,1),visibility 0s}
  html.fyd-bars-now body.chvf2 :is(.cm-bar,.sx-panel){transition:none!important} /* decided at load with nothing under it: no slide */

  /* c. Keyboard focus and anchors stop above the bar as well as above the tab bar */
  html.fyd2.cm-bar-on{scroll-padding-bottom:calc(var(--cl3-pb,0px) + var(--cm-bar-h,72px) + 20px)}
  html.fyd2.fyd-sx{scroll-padding-bottom:calc(var(--cl3-pb,0px) + 84px)}
}
@keyframes fyd-hold{from{visibility:hidden;transform:translateY(calc(100% + 120px))}}
@media (max-width:899px) and (prefers-reduced-motion:reduce){
  html.fyd-bars body.chvf2 .sx-page .sx-panel:not(.is-open){transition:none}
}

/* ---- 3. Computer and tablet: the WhatsApp button rises above the "Added to cart" message ----------------------------------------
   The message (#cl-toast, z 125) sat on the button's lower half and on its own close circle. While it is up and would meet the
   button, v2-fix2-fyd.js sets html.fyd-wa-up and --fyd-wa-lift (the message's height + 12 px, measured). It moves with translate,
   so the button's own fade and step-aside (transform, chrome.css) are untouched; up at once, down a little after the message
   has gone. Reduced motion: no movement, it just stands in its new place. Phones are as before: the message is as wide as the
   screen and the button is under it. */
@media (min-width:600px){
  body.chvf2 .cl-wa{transition:background-color .15s ease,opacity .25s ease,transform .25s ease,visibility 0s linear 0s,translate .3s cubic-bezier(.165,.84,.44,1) .12s}
  html.cl3-wa-off body.chvf2 .cl-wa{transition:opacity .2s ease,transform .2s ease,visibility 0s linear .2s,translate .3s cubic-bezier(.165,.84,.44,1) .12s}
  html.fyd-wa-up body.chvf2 .cl-wa{translate:0 calc(-1 * var(--fyd-wa-lift,0px));
    transition:background-color .15s ease,opacity .25s ease,transform .25s ease,visibility 0s linear 0s,translate .3s cubic-bezier(.165,.84,.44,1)}
  html.fyd-wa-up.cl3-wa-off body.chvf2 .cl-wa{transition:opacity .2s ease,transform .2s ease,visibility 0s linear .2s,translate .3s cubic-bezier(.165,.84,.44,1)}
}
@media (min-width:600px) and (prefers-reduced-motion:reduce){
  body.chvf2 .cl-wa,html.cl3-wa-off body.chvf2 .cl-wa,html.fyd-wa-up body.chvf2 .cl-wa,html.fyd-wa-up.cl3-wa-off body.chvf2 .cl-wa{transition:none}
}
