/* Sample box motion [sbmotion 10-15] (owner 10-15: "make sample order page smoother with satisfying animations and all smooth and fun").
   Loaded by src/pages/sample-box.html and src/pages/sample-box/thanks.html after site.css; the moving parts are public/js/sb-motion.js.
   Transform and opacity only (a growing card opens with clip-path, paint only), 150 to 400 ms, ease-out. Everything that moves sits
   under html.ib-motion, which site.js sets in <head> only when motion is welcome; site.css already stops every animation and
   transition with prefers-reduced-motion. Nothing here changes a size or a position, so no layout shift. */
.p-sbx{--sbm-out:cubic-bezier(.2,.8,.2,1);--sbm-spring:cubic-bezier(.34,1.4,.64,1)}

/* the check badge on a picked single choice chip (container, bulk size, scent, bulk order) and on the viscosity cards.
   Drawn on pseudo elements over the corner, so no chip changes its width. */
.p-sbx .sbx-chip input[type=radio]+span{position:relative}
.p-sbx .sbx-chip input[type=radio]:checked+span::before{content:"";position:absolute;top:-6px;inset-inline-end:-5px;width:16px;height:16px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 2px #fff;pointer-events:none}
.p-sbx .sbx-vc:has(input:checked)::before{content:"";position:absolute;top:-6px;inset-inline-end:-5px;width:16px;height:16px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 2px #fff;pointer-events:none}
.p-sbx .sbx-chip input[type=radio]:checked+span::after{content:"";position:absolute;top:-6px;inset-inline-end:-5px;width:16px;height:16px;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.4 8.3l2.3 2.3 4.9-5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px 16px no-repeat;pointer-events:none}
.p-sbx .sbx-vc:has(input:checked)::after{content:"";position:absolute;top:-6px;inset-inline-end:-5px;width:16px;height:16px;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.4 8.3l2.3 2.3 4.9-5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px 16px no-repeat;pointer-events:none}
.p-sbx .sbx-vc:has(input:checked)::before,.p-sbx .sbx-vc:has(input:checked)::after{top:6px;inset-inline-end:6px}

@media (prefers-reduced-motion:no-preference){
  /* page entrance: the head, the form and the side cards fade up in a short stagger */
  html.ib-motion .p-sbx .sbx-head .eyebrow,html.ib-motion .p-sbx .sbx-head .lead,html.ib-motion .p-sbx .sbx-facts li,
  html.ib-motion .p-sbx .sbx-main .sbx-form,html.ib-motion .p-sbx .sbx-side>*{animation:sbm-up .4s var(--sbm-out) backwards}
  html.ib-motion .p-sbx .sbx-head .lead{animation-delay:.05s}
  html.ib-motion .p-sbx .sbx-facts li:nth-child(1){animation-delay:.09s}
  html.ib-motion .p-sbx .sbx-facts li:nth-child(2){animation-delay:.13s}
  html.ib-motion .p-sbx .sbx-facts li:nth-child(3){animation-delay:.17s}
  html.ib-motion .p-sbx .sbx-main .sbx-form{animation-delay:.12s}
  html.ib-motion .p-sbx .sbx-side>*:nth-child(1){animation-delay:.18s}
  html.ib-motion .p-sbx .sbx-side>*:nth-child(2){animation-delay:.23s}
  html.ib-motion .p-sbx .sbx-side>*:nth-child(3){animation-delay:.28s}
  /* the steps come in child by child (sb-motion.js), so the whole step does not fade as well (site.js .ib-appear) */
  html.ib-motion .p-sbx .sbx-step.ib-appear{animation:none}

  /* press feedback: route cards, chips, tiles, formula cards, viscosity cards and the buttons give a little under the finger */
  html.ib-motion .p-sbx .sbx-rt{transition:border-color .16s var(--ease),background-color .16s var(--ease),transform .18s var(--sbm-out)}
  html.ib-motion .p-sbx .sbx-rt:active{transform:scale(.985)}
  html.ib-motion .p-sbx .sbx-chip span{transition:border-color .2s,background-color .2s,color .2s,transform .15s var(--sbm-out)}
  html.ib-motion .p-sbx .sbx-chip:active span,html.ib-motion .p-sbx .sbx-chip-add:active{transform:scale(.94)}
  html.ib-motion .p-sbx .sbx-chip-add{transition:border-color .2s,color .2s,transform .15s var(--sbm-out)}
  html.ib-motion .p-sbx .sbx-tile{transition:border-color .2s,background-color .2s,opacity .2s,transform .16s var(--sbm-out)}
  html.ib-motion .p-sbx .sbx-tile:active,html.ib-motion .p-sbx .sbx-f:active{transform:scale(.98)}
  html.ib-motion .p-sbx .sbx-f{transition:border-color .2s,background-color .2s,transform .16s var(--sbm-out)}
  html.ib-motion .p-sbx .sbx-vc{transition:border-color .16s var(--ease),background-color .16s var(--ease),transform .16s var(--sbm-out)}
  html.ib-motion .p-sbx .sbx-vc:active{transform:scale(.96)}
  html.ib-motion .p-sbx .sbx-pk-add:active,html.ib-motion .p-sbx .sbx-nav .btn:active{transform:scale(.97)}

  /* the check badges pop and the tick wipes in, left to right */
  html.ib-motion .p-sbx .sbx-chip input[type=radio]:checked+span::before{animation:sbm-badge .3s var(--sbm-spring) backwards}
  html.ib-motion .p-sbx .sbx-vc:has(input:checked)::before{animation:sbm-badge .3s var(--sbm-spring) backwards}
  html.ib-motion .p-sbx .sbx-chip input[type=radio]:checked+span::after{animation:sbm-tick .26s .08s var(--sbm-out) backwards}
  html.ib-motion .p-sbx .sbx-vc:has(input:checked)::after{animation:sbm-tick .26s .08s var(--sbm-out) backwards}
  html.ib-motion .p-sbx .sbx-tile.on .sbx-ck{animation:sbx-pop .22s var(--ease)}
  /* the formula counter turning amber at 4 or 5, a step marked done, error lines and the alert slide in softly */
  html.ib-motion .p-sbx .sbx-fn.over{animation:sbm-nudge .3s var(--sbm-out)}
  html.ib-motion .p-sbx .sbx-stepper .done i{animation:sbm-badge .32s var(--sbm-spring)}
  html.ib-motion .p-sbx .sbx-err.show,html.ib-motion .p-sbx .field.invalid .error,html.ib-motion .p-sbx .sbx-pf.invalid .error,html.ib-motion .p-sbx .sbx-form .alert.show{animation:sbm-msg .24s var(--sbm-out)}
}

/* the totals pulse once when they change (sb-motion.js adds .sbm-pulse for one run) */
.p-sbx .sbx-total,.p-sbx .sbx-pay .sbx-sum{position:relative}
.p-sbx .sbx-total::after,.p-sbx .sbx-pay .sbx-sum::after{content:"";position:absolute;inset:-1px;border-radius:12px;box-shadow:0 0 0 3px var(--accent-soft),0 0 0 1px var(--accent);opacity:0;pointer-events:none}
.p-sbx .sbx-pay .sbx-sum::after{inset:-6px -8px;border-radius:12px}
.p-sbx .sbm-pulse::after{animation:sbm-ring .7s var(--sbm-out)}
.p-sbx .sbm-pulse>b:last-child,.p-sbx .sbm-pulse .sbx-tt b+b{display:inline-block;transform-origin:100% 50%;animation:sbm-bump .34s var(--sbm-out)}

/* a soft ring around the first field to fix, after the page scrolls to it (sb-motion.js draws it in its own layer) */
.sbm-layer{position:absolute;top:0;left:0;width:0;height:0;z-index:30;pointer-events:none}
.sbm-ring{position:absolute;border-radius:14px;box-shadow:0 0 0 2px var(--accent),0 0 0 7px var(--accent-soft);opacity:0;pointer-events:none}

/* the pay button: the lock turns into a spinner while the order goes out, then a check. The indicator overlaps the lock exactly
   (its negative margin is the lock plus the gap), so the button keeps its size. */
.p-sbx [data-pay]>svg:first-child{transition:opacity .16s var(--sbm-out),transform .2s var(--sbm-out)}
.p-sbx [data-pay] [data-pay-label]{transition:opacity .16s var(--sbm-out)}
.sbm-ind{display:inline-grid;flex:none;width:18px;height:18px;margin-inline-start:-26px;place-items:center}
.sbm-ind svg{grid-area:1/1;width:18px;height:18px;opacity:0;transform:scale(.6);transition:opacity .16s var(--sbm-out),transform .2s var(--sbm-out)}
.p-sbx [data-pay].sbm-busy>svg:first-child,.p-sbx [data-pay].sbm-done>svg:first-child{opacity:0;transform:scale(.6)}
.p-sbx [data-pay].sbm-busy .sbm-spin{opacity:1;transform:none}
.p-sbx [data-pay].sbm-busy .sbm-spin circle{transform-origin:12px 12px;animation:sbm-rot .8s linear infinite}
.p-sbx [data-pay].sbm-done .sbm-ok{opacity:1;transform:none}
.p-sbx [data-pay].sbm-done .sbm-ok path{stroke-dasharray:1 1;animation:sbm-draw .32s .04s var(--sbm-out) backwards}
.p-sbx [data-pay].sbm-busy[disabled],.p-sbx [data-pay].sbm-done[disabled]{opacity:.85;cursor:progress}

/* thanks page confetti (once per order, sb-motion.js) */
.sbm-cf{position:fixed;inset:0;z-index:70;overflow:hidden;pointer-events:none;contain:strict}
.sbm-cf i{position:absolute;left:0;top:0;width:7px;height:7px;border-radius:2px;will-change:transform,opacity}

@keyframes sbm-up{from{opacity:0;transform:translate3d(0,10px,0)}}
@keyframes sbm-badge{from{opacity:0;transform:scale(.3)}}
@keyframes sbm-tick{from{clip-path:inset(0 100% 0 0)}}
@keyframes sbm-nudge{40%{transform:scale(1.08)}}
@keyframes sbm-msg{from{opacity:0;transform:translate3d(0,-4px,0)}}
@keyframes sbm-ring{from{opacity:0}25%{opacity:1}to{opacity:0}}
@keyframes sbm-bump{45%{transform:scale(1.06)}}
@keyframes sbm-rot{to{transform:rotate(360deg)}}
@keyframes sbm-draw{from{stroke-dashoffset:1}}
/* reduced motion: instant everywhere on these pages, the pseudo elements too (site.css stops the elements themselves) */
@media (prefers-reduced-motion:reduce){.p-sbx .sbm-pulse::after,.sbm-ring{display:none}.p-sbx *::before,.p-sbx *::after{animation:none!important;transition:none!important}}
