/* V3 round 2, lane J: Bonbon chapter handoff and the Your Order box float-in. Variant group bbhand (a, b, c).
   Motion: transforms and opacity only, 0.7 to 0.9 s ease-out, no bounce. html.glz-static or reduced motion: nothing moves or hides. */

/* ---------- ownership: while bbhand is a or b, lane J owns the handoff and the box float ---------- */
html:is([data-v-bbhand="a"], [data-v-bbhand="b"]) .ld-chapter { display: none; }
html:is([data-v-bbhand="a"], [data-v-bbhand="b"]) .hfx-bonbon { display: none; }
html:is([data-v-bbhand="a"], [data-v-bbhand="b"]) #order .cart-section.ld-float-ready { opacity: 1; transform: none; transition: none; }

/* ---------- Bonbon perch: sits inside the top padding of each chapter, never over the seam ---------- */
.bbh-perch { display: none; }
html.bbh-on:not(.glz-static):is([data-v-bbhand="a"], [data-v-bbhand="b"]) .bbh-perch {
  display: flex; position: absolute; z-index: 2; top: .5rem; left: clamp(.6rem, 3.5vw, 3.5rem);
  flex-direction: row; align-items: center; gap: .45rem; max-width: min(70%, 22rem); pointer-events: none;
}
.bbh-bon { flex: none; display: block; width: 3.25rem; height: 3.25rem; opacity: 0; transform: translate3d(0, -115%, 0); }
.bbh-bon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bbh-tag {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: .32rem .7rem; border-radius: 999px 999px 999px 4px;
  background: var(--cream, #FDF8F0); border: 1px solid var(--linen, #EADFCB); box-shadow: 0 6px 16px -10px rgba(45, 25, 40, .45);
  font: 700 .72rem/1.2 'DM Sans', sans-serif; letter-spacing: .02em; color: var(--plum, #4A1942);
  opacity: 0;
}
.bbh-notag .bbh-tag { display: none; }

/* A: Bonbon hops down. He drops in through the seam from the chapter above; the last perch hops down and out. */
.bbh-perch.is-on .bbh-bon { opacity: 1; transform: none; transition: transform .85s cubic-bezier(.22, 1, .36, 1), opacity .7s ease-out; }
.bbh-perch.is-on .bbh-tag { opacity: 1; transition: opacity .7s ease-out .45s; }
.bbh-perch.is-off .bbh-bon { opacity: 0; transform: translate3d(0, 2.5rem, 0); transition: transform .75s ease-out, opacity .7s ease-out; }
.bbh-perch.is-off .bbh-tag { opacity: 0; transition: opacity .7s ease-out; }

/* B: Bonbon and tag. He fades up in place and the tag lifts beside him; no travel. */
html[data-v-bbhand="b"] .bbh-bon { transform: translate3d(0, .6rem, 0) scale(.92); }
html[data-v-bbhand="b"] .bbh-tag { transform: translate3d(0, .5rem, 0); }
html[data-v-bbhand="b"] .bbh-perch.is-on .bbh-bon { transform: none; transition: transform .8s ease-out, opacity .8s ease-out; }
html[data-v-bbhand="b"] .bbh-perch.is-on .bbh-tag { transform: none; transition: transform .75s ease-out .3s, opacity .75s ease-out .3s; }
html[data-v-bbhand="b"] .bbh-perch.is-off .bbh-bon { transform: scale(.92); }
html[data-v-bbhand="b"] .bbh-perch.is-off .bbh-tag { transform: none; }

@media (max-width: 760px) {
  .bbh-bon { width: 2.6rem; height: 2.6rem; }
  .bbh-tag { font-size: .68rem; padding: .28rem .6rem; }
  html.bbh-on:not(.glz-static):is([data-v-bbhand="a"], [data-v-bbhand="b"]) .bbh-perch { top: .3rem; max-width: 62%; }
}

/* ---------- Your Order: the box floats in (only the box element; #order itself is never restyled) ---------- */
html.bbh-on:not(.glz-static):is([data-v-bbhand="a"], [data-v-bbhand="b"]) #order .bbh-box.bbh-box-ready:not(.bbh-box-in) {
  opacity: 0; transform: translate3d(0, 2.75rem, 0) scale(.975);
}
html.bbh-on:not(.glz-static):is([data-v-bbhand="a"], [data-v-bbhand="b"]) #order .bbh-box.bbh-box-in {
  opacity: 1; transform: none; transition: transform .9s cubic-bezier(.22, 1, .36, 1), opacity .75s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .bbh-perch { display: none !important; }
  #order .bbh-box { opacity: 1 !important; transform: none !important; transition: none !important; }
}
html.glz-static #order .bbh-box { opacity: 1; transform: none; transition: none; }

/* Codex must-fixes: one moving thing per screenful. While lane J owns the chapters, Grok's section rise and heading
   wipe stay still, and a new Bonbon waits for the outgoing one to leave when that one is still on screen. */
html:is([data-v-bbhand="a"], [data-v-bbhand="b"]).hfx-on .hfx-ch { opacity: 1; transform: none; transition: none; will-change: auto; }
html:is([data-v-bbhand="a"], [data-v-bbhand="b"]).hfx-on .hfx-ch > .container > h2,
html:is([data-v-bbhand="a"], [data-v-bbhand="b"]).hfx-on .hfx-ch h2.section-title { clip-path: none; transition: none; }
.bbh-perch.is-on.bbh-wait .bbh-bon { transition-delay: .75s; }
.bbh-perch.is-on.bbh-wait .bbh-tag { transition-delay: 1.2s; }
/* Focus reached the box before it floated in: show it at once. */
#order .bbh-box.bbh-box-now { transition: none !important; }
