/* Box-opening lab (Nov 10, 2026). Engine + V1 to V3 by Fable. V4 to V6 slots are marked for Astra.
   One box: closed it is the lid drawn here, open it is the real builder tray already on the page.
   This file never draws wells and never restyles the tray. Overlay parts animate transform only. */

/* Old overlay stays off while the lab is on. */
html[data-boxopen] #wpBoxOpen,
html[data-boxopen] .wp-boxopen,
html[data-boxopen] .mix-boxopen { display: none !important; }

/* ───────── Overlay skeleton ───────── */
.bxl-layer {
  --bxl-gold: linear-gradient(180deg, #e0c16e 0%, #c8a15a 48%, #b8902d 100%);
  --bxl-gold-hi: inset 0 1px 0 rgba(255, 248, 230, 0.55);
  --bxl-gold-line: #d4a843;
  --bxl-coin: #5b2a4a;
  --bxl-plum: #4a1942;
  --bxl-lid: linear-gradient(180deg, #f3e6d2, #e9d7bc);
  --bxl-paper: #fffdf8;
  --bxl-wall: linear-gradient(180deg, #e2ceae, #d2ba95);
  --bxl-r: 22px;
  --bxl-p: 900px;
  position: fixed;
  inset: 0;
  z-index: 1190;
  margin: 0;
  padding: 0;
  background: none;
  pointer-events: none;
  contain: layout style;
}
.bxl-layer *,
.bxl-layer *::before,
.bxl-layer *::after { box-sizing: border-box; pointer-events: none; max-width: none; max-height: none; }

.bxl-mover {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 50%;
}
.bxl-layer.is-hot .bxl-mover,
.bxl-layer.is-hot .bxl-box,
.bxl-layer.is-hot .bxl-lid,
.bxl-layer.is-hot .bxl-tabwrap { will-change: transform; }

/* Fixed shadow on its own layer. It only ever moves and scales. */
.bxl-shadow {
  position: absolute;
  inset: 6% 5% 0;
  border-radius: var(--bxl-r);
  box-shadow: 0 34px 46px -16px rgba(74, 25, 66, 0.42), 0 12px 18px -10px rgba(74, 45, 20, 0.35);
  transform-origin: 50% 60%;
}

.bxl-stage,
.bxl-top,
.bxl-tuck-stage {
  perspective: var(--bxl-p);
  perspective-origin: 50% 50%;
}
.bxl-stage,
.bxl-top {
  position: absolute;
  inset: 0;
}
.bxl-stage { transform-style: preserve-3d; }

.bxl-box,
.bxl-tabwrap {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
}
.bxl-box { transform-style: preserve-3d; }

/* Box front wall. Edge-on when the box sits flat, shows while it is carried tilted. */
.bxl-wall-front {
  position: absolute;
  left: 3px;
  right: 3px;
  top: calc(100% - 2px);
  height: 40px;
  transform-origin: 50% 0;
  transform: rotateX(-90deg);
  border-radius: 0 0 10px 10px;
  background: var(--bxl-wall);
  box-shadow: inset 0 -6px 10px -4px rgba(120, 80, 40, 0.35);
}

/* "Glaze" tab twin. Geometry and type are copied from the real tray tab in JS. */
.bxl-tab {
  position: absolute;
  display: block;
  margin: 0;
  white-space: nowrap;
  text-align: center;
}

/* ───────── Lid parts shared by versions ───────── */
.bxl-lid {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.bxl-face,
.bxl-under {
  position: absolute;
  inset: 0;
  border-radius: var(--bxl-r);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.bxl-face {
  transform: translateZ(0); /* own stacking context, so band and coin stay on the face in 3D */
  background: var(--bxl-lid);
  border: 1px solid rgba(74, 25, 66, 0.14);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), inset 0 -3px 8px rgba(120, 80, 40, 0.14);
  overflow: hidden;
}
/* Gold hairline, 6px in from the lid edge. */
.bxl-face::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--bxl-gold-line);
  border-radius: calc(var(--bxl-r) - 6px);
}
/* Soft raised plate, same bevel family as the tray panel. */
.bxl-face::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: calc(var(--bxl-r) - 9px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 55%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 2px rgba(120, 80, 40, 0.16);
}
.bxl-under {
  transform: rotateX(180deg);
  background: linear-gradient(180deg, #f6ecdb, var(--bxl-paper) 70%);
  border: 1px solid rgba(74, 25, 66, 0.26);
  box-shadow: inset 0 0 0 6px #ead9bf, inset 0 0 0 7px rgba(74, 25, 66, 0.12), inset 0 16px 26px -12px rgba(120, 80, 40, 0.38);
}
.bxl-mark {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: 50%;
  margin-top: -0.62em;
  text-align: center;
  font: 400 clamp(1.5rem, calc(var(--bxl-h, 178px) * 0.22), 2.4rem) / 1.2 "Glaze Display", Georgia, serif;
  letter-spacing: -0.01em;
  color: var(--bxl-plum);
}
.bxl-coin {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bxl-coin);
  color: #fffaf3;
  box-shadow: 0 2px 5px -1px rgba(58, 20, 46, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.bxl-coin svg { display: block; width: 18px; height: 18px; }
.bxl-band {
  position: absolute;
  z-index: 1;
  background: var(--bxl-gold);
  box-shadow: var(--bxl-gold-hi), 0 1px 3px rgba(91, 42, 74, 0.3);
}

/* Static clip boxes. Never wrapped around a part that is mid-swing in 3D. */
.bxl-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--bxl-r);
}

/* === V1 Fable: Back hinge === */
.bxl-layer[data-v="1"] {
  --bxl-lid: linear-gradient(165deg, #fffaf1 0%, #f7ecd9 28%, #ead6b8 64%, #e0c6a3 100%);
  --bxl-wall: linear-gradient(180deg, #ead6b8, #d5be9a 58%, #c6ad86);
}
.bxl-layer[data-v="1"] .bxl-lid { transform-origin: 50% 0; }
.bxl-layer[data-v="1"] .bxl-face {
  border: 1px solid rgba(184, 144, 45, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -12px 20px -10px rgba(120, 80, 40, 0.24),
    inset 0 0 0 1px rgba(255, 248, 230, 0.28);
}
.bxl-layer[data-v="1"] .bxl-face::before {
  inset: 7px;
  border-color: rgba(212, 168, 67, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 248, 230, 0.4);
}
.bxl-layer[data-v="1"] .bxl-face::after {
  inset: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 58%);
}
.bxl-layer[data-v="1"] .bxl-under {
  box-shadow:
    inset 0 0 0 7px #ead9bf,
    inset 0 0 0 8px rgba(74, 25, 66, 0.1),
    inset 0 18px 28px -12px rgba(120, 80, 40, 0.34);
}
.bxl-layer[data-v="1"] .bxl-mark {
  margin-top: -0.95em;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.55);
}
.bxl-layer[data-v="1"] .bxl-band {
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  border-radius: 0 0 var(--bxl-r) var(--bxl-r);
  background: linear-gradient(180deg, #e0c16e 0%, #c8a15a 48%, #b8902d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 248, 230, 0.62), 0 -1px 0 rgba(154, 117, 36, 0.28);
}
.bxl-layer[data-v="1"] .bxl-coin {
  left: 50%;
  bottom: 3px;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  border: 2px solid #d4a843;
  box-shadow:
    0 2px 7px -1px rgba(58, 20, 46, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 0 0 1px rgba(184, 144, 45, 0.35);
}
.bxl-layer[data-v="1"] .bxl-tab {
  font-family: "Glaze Display", Georgia, serif;
  letter-spacing: 0.03em;
}
/* The lid's front lip. Hangs off the front edge, so it only shows once the lid lifts. */
.bxl-skirt {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 100%;
  height: 11px;
  transform-origin: 50% 0;
  transform: rotateX(-90deg);
  background: linear-gradient(180deg, #e0c16e, #b8902d);
  box-shadow: inset 0 1px 0 rgba(255, 248, 230, 0.4);
}
/* Tuck slot: everything above the tray's back edge. The standing lid drops out of it, behind the rim. */
.bxl-tuck {
  position: absolute;
  left: -30%;
  right: -30%;
  bottom: 100%;
  height: 150%;
  overflow: hidden;
}
.bxl-tuck-stage {
  position: absolute;
  inset: 0;
  /* same eye point as the main stage: the middle of the tray, which sits just below this slot */
  perspective-origin: 50% 133.3333%;
}
/* The standing lid again, as one flat panel: underside up, gold lip at the far end. */
.bxl-twin {
  position: absolute;
  left: 18.75%;
  width: 62.5%;
  top: 100%;
  height: 66.6667%;
  transform-origin: 50% 0;
  border-radius: var(--bxl-r);
  background: linear-gradient(0deg, #f6ecdb, var(--bxl-paper) 70%);
  border: 1px solid rgba(74, 25, 66, 0.26);
  box-shadow: inset 0 0 0 6px #ead9bf, inset 0 0 0 7px rgba(74, 25, 66, 0.12), inset 0 -16px 26px -12px rgba(120, 80, 40, 0.38);
  visibility: hidden;
}
.bxl-twin::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 10px;
  background: linear-gradient(0deg, #a57f24, #c8a15a);
}
/* === /V1 === */

/* === V2 Fable: Sleeve off === */
.bxl-sleeve {
  position: absolute;
  inset: 0;
}
.bxl-layer[data-v="2"] .bxl-mark { right: 34%; }
.bxl-layer[data-v="2"] .bxl-band {
  top: 0;
  bottom: 0;
  left: 66%;
  width: 30px;
  margin-left: -15px;
}
.bxl-layer[data-v="2"] .bxl-coin {
  left: 66%;
  top: 50%;
  margin: -18px 0 0 -18px;
}
/* Shaded trailing edge and the shadow it drops on the tray, so it reads as a sleeve with thickness. */
.bxl-sleeve-edge {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  right: 0;
  width: 10px;
  background: linear-gradient(90deg, rgba(120, 80, 40, 0), rgba(120, 80, 40, 0.34));
}
.bxl-sleeve-cast {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 100%;
  width: 18px;
  background: linear-gradient(90deg, rgba(74, 45, 20, 0.3), rgba(74, 45, 20, 0));
}
.bxl-layer[data-v="2"] .bxl-wall-front {
  background:
    linear-gradient(180deg, #c8a15a, #a57f24) calc(66% - 2px) 0 / 30px 100% no-repeat,
    var(--bxl-wall);
}
/* === /V2 === */

/* === V3 Fable: Four flaps === */
/* Box rim the flaps hinge on. It sits exactly on the real tray edge and stays to the end. */
.bxl-rim {
  position: absolute;
  inset: 0;
  border: 5px solid #ead9bf;
  border-top-color: #f1e3cd;
  border-bottom-color: #e3d0b2;
  border-radius: var(--bxl-r);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 0 1px rgba(74, 25, 66, 0.14);
}
.bxl-flaps {
  position: absolute;
  inset: 4px;
  transform-style: preserve-3d;
}
.bxl-flap {
  position: absolute;
  transform-style: preserve-3d;
}
.bxl-flap .bxl-face,
.bxl-flap .bxl-under { border: 0; box-shadow: none; }
.bxl-flap .bxl-face::before,
.bxl-flap .bxl-face::after { content: none; }
.bxl-flap-t { left: 0; right: 0; top: 0; height: 50%; transform-origin: 50% 0; }
.bxl-flap-b { left: 0; right: 0; bottom: 0; height: 50%; transform-origin: 50% 100%; }
.bxl-flap-l { left: 0; top: 0; bottom: 0; width: 50%; transform-origin: 0 50%; }
.bxl-flap-r { right: 0; top: 0; bottom: 0; width: 50%; transform-origin: 100% 50%; }
.bxl-flap-t > * { clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: calc(var(--bxl-r) - 4px) calc(var(--bxl-r) - 4px) 0 0; }
.bxl-flap-b > * { clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0 0 calc(var(--bxl-r) - 4px) calc(var(--bxl-r) - 4px); }
.bxl-flap-l > * { clip-path: polygon(0 0, 100% 50%, 0 100%); border-radius: calc(var(--bxl-r) - 4px) 0 0 calc(var(--bxl-r) - 4px); }
.bxl-flap-r > * { clip-path: polygon(100% 0, 100% 100%, 0 50%); border-radius: 0 calc(var(--bxl-r) - 4px) calc(var(--bxl-r) - 4px) 0; }
/* One light, four panels: the seams read because each flap takes the light differently. */
.bxl-flap-t .bxl-face { background: linear-gradient(180deg, #f8eddc, #efe0c8); }
.bxl-flap-l .bxl-face { background: linear-gradient(90deg, #f1e3cd, #e8d5b8); }
.bxl-flap-r .bxl-face { background: linear-gradient(270deg, #ecdbc0, #e3cfaf); }
.bxl-flap-b .bxl-face { background: linear-gradient(0deg, #e9d7bc, #dcc6a3); }
.bxl-flap .bxl-under { transform: rotateY(180deg); }
.bxl-flap-t .bxl-under,
.bxl-flap-b .bxl-under { transform: rotateX(180deg); }
.bxl-layer[data-v="3"] .bxl-mark {
  top: auto;
  bottom: 9%;
  margin: 0;
  font-size: clamp(0.95rem, calc(var(--bxl-h, 178px) * 0.11), 1.25rem);
}
.bxl-layer[data-v="3"] .bxl-coin {
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid #c8a15a;
  box-shadow: 0 0 0 1px #b8902d, 0 3px 6px -1px rgba(58, 20, 46, 0.5);
  transform: translateZ(2px);
}
/* === /V3 === */

/* === V4 Astra === */
 .bxl-door { position: absolute; top: 4px; bottom: 4px; width: calc(50% - 4px); transform-style: preserve-3d; }
.bxl-door-l { left: 4px; transform-origin: 0 50%; }
.bxl-door-r { right: 4px; transform-origin: 100% 50%; }
.bxl-door-l > .bxl-face, .bxl-door-l > .bxl-under { border-radius: var(--bxl-r) 0 0 var(--bxl-r); }
.bxl-door-r > .bxl-face, .bxl-door-r > .bxl-under { border-radius: 0 var(--bxl-r) var(--bxl-r) 0; }
.bxl-door .bxl-under { transform: rotateY(180deg); }
.bxl-door .bxl-mark { top: 35%; }
.bxl-door-l .bxl-mark { text-align: right; padding-right: 1px; }
.bxl-door-r .bxl-mark { text-align: left; padding-left: 1px; }
.bxl-door-latch { left: 30%; width: 40%; top: 58%; height: 18px; border: 1px solid #b8902d; border-radius: 9px; transform: translateZ(2px); }
.bxl-door-latch .bxl-coin { left: 50%; top: 50%; margin: -18px 0 0 -18px; }
.bxl-door-rim { transform: translateZ(-1px); }

  /* === /V4 === */

/* === V5 Astra === */
 .bxl-tear-cover { position: absolute; left: 0; right: 0; height: calc(50% + 1px); }
.bxl-tear-t { top: 0; }
.bxl-tear-b { bottom: 0; }
.bxl-tear-t .bxl-face { border-radius: var(--bxl-r) var(--bxl-r) 0 0; }
.bxl-tear-b .bxl-face { border-radius: 0 0 var(--bxl-r) var(--bxl-r); }
.bxl-tear-cover .bxl-face { box-shadow: inset 0 2px 0 #fff7e9, inset 0 -5px 0 #cdb695, 0 4px 6px #6f513b55; }
.bxl-tear-edge { position: absolute; left: 0; right: 0; height: 8px; background: linear-gradient(#fffdf8 0 45%, #c5ab88 46% 100%); clip-path: polygon(0 0,100% 0,100% 70%,96% 50%,92% 100%,87% 45%,81% 90%,76% 55%,70% 100%,64% 55%,58% 85%,52% 45%,46% 100%,40% 55%,34% 90%,28% 50%,22% 100%,16% 55%,10% 90%,5% 45%,0 80%); }
.bxl-tear-t .bxl-tear-edge { bottom: -4px; }
.bxl-tear-b .bxl-tear-edge { top: -4px; transform: rotate(180deg); }
.bxl-tear-slot { position: absolute; left: 0; right: 0; top: calc(50% - 21px); height: 42px; overflow: hidden; }
.bxl-tear-strip { left: 0; right: 0; top: 8px; height: 26px; border-top: 1px dashed #fff0bd; border-bottom: 1px dashed #96742a; }
.bxl-tear-pull { position: absolute; left: 6px; top: 3px; width: 44px; height: 36px; z-index: 3; }
.bxl-tear-pull .bxl-coin { left: 0; top: 0; }
.bxl-tear-fold { position: absolute; left: 21px; top: 5px; width: 24px; height: 26px; border-radius: 0 8px 8px 0; background: linear-gradient(90deg,#e0c16e,#fff0bd 55%,#a57f24); box-shadow: 3px 2px 3px #674c3266; transform: skewY(-12deg); }
.bxl-tear-rim { border-width: 7px; }

  /* === /V5 === */

/* === V6 Astra === */
 .bxl-iris-clip { inset: 5px; border-radius: calc(var(--bxl-r) - 5px); background: none; }
.bxl-iris-leaf { position: absolute; width: 56%; height: 56%; }
.bxl-iris-tl { left: 0; top: 0; transform-origin: 0 0; }
.bxl-iris-tr { right: 0; top: 0; transform-origin: 100% 0; }
.bxl-iris-br { right: 0; bottom: 0; transform-origin: 100% 100%; }
.bxl-iris-bl { left: 0; bottom: 0; transform-origin: 0 100%; }
.bxl-iris-plate { position: absolute; inset: 0; clip-path: polygon(0 0,100% 0,100% 80%,80% 100%,0 100%); background: var(--bxl-lid); border: 1px solid #c7ad88; box-shadow: inset 0 2px 0 #fff7e9, inset -4px -5px 0 #d4bd9b; }
.bxl-iris-plate::before { content: ''; position: absolute; inset: 8px; border: 1px solid #d4a843; border-radius: 12px; }
.bxl-iris-plate::after { content: ''; position: absolute; width: 45%; height: 6px; right: 0; bottom: 18%; transform: rotate(-35deg); background: #c6ab85; border-top: 2px solid #fff7e9; }
.bxl-iris-tr .bxl-iris-plate { transform: scaleX(-1); }
.bxl-iris-br .bxl-iris-plate { transform: scale(-1); }
.bxl-iris-bl .bxl-iris-plate { transform: scaleY(-1); }
.bxl-iris-seal { left: 50%; top: 50%; margin: -20px; width: 40px; height: 40px; border: 3px solid #c8a15a; }
.bxl-iris-rim { border-width: 7px; }
.bxl-iris-pin { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--bxl-gold); border: 1px solid #a57f24; box-shadow: inset 0 1px 0 #fff0bd, 0 1px 2px #674c3266; }
.bxl-iris-pin::after { content: ''; position: absolute; left: 2px; right: 2px; top: 3px; height: 1px; background: #96742a; transform: rotate(35deg); }
.bxl-iris-pin-tl { left: -5px; top: -5px; }
.bxl-iris-pin-tr { right: -5px; top: -5px; }
.bxl-iris-pin-br { right: -5px; bottom: -5px; }
.bxl-iris-pin-bl { left: -5px; bottom: -5px; }

  /* === /V6 === */

/* ───────── Lab chip: version switcher + Replay. Preview tool, not customer UI. ───────── */
.bxl-chip {
  position: fixed;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1150;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0 2px;
  max-width: calc(100vw - 96px);
  padding: 0 4px 0 12px;
  border: 1px solid #d4a843;
  border-radius: 999px;
  background: #fdf8f0;
  color: #4a1942;
  font: 600 0.8rem / 1 "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 8px 18px -12px rgba(74, 25, 66, 0.5);
}
.bxl-chip-tag {
  position: absolute;
  left: 14px;
  bottom: calc(100% + 4px);
  padding: 2px 8px;
  border-radius: 999px;
  background: #fdf8f0;
  border: 1px solid rgba(212, 168, 67, 0.7);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.bxl-chip select,
.bxl-chip button {
  min-height: 44px;
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.bxl-chip select {
  max-width: 9.2rem;
  padding: 0 4px 0 0;
  text-overflow: ellipsis;
}
.bxl-chip button {
  position: relative;
  padding: 0 14px;
  color: #fffaf3;
  z-index: 0;
}
.bxl-chip button::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 5px 0;
  border-radius: 999px;
  background: #4a1942;
}
.bxl-chip select:focus-visible,
.bxl-chip button:focus-visible { outline: 2px solid #4a1942; outline-offset: 1px; border-radius: 999px; }
.bxl-chip-note {
  margin-left: 6px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.bxl-chip-note:empty { display: none; }
.bxl-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* Never in the shot while a box is in flight. */
html[data-bxl-running] .bxl-chip { visibility: hidden; }


/* Lab-only: hide an emptied empty-state prompt under the tray. */
html[data-boxopen] .obx-guide:empty,
html[data-boxopen] .obx-guide[hidden],
html[data-boxopen] [data-bxl-hid-spin] { display: none !important; }

/* Keep the swinging lid from being clipped by the builder shells. The overlay itself is fixed. */
html[data-boxopen] #menu,
html[data-boxopen] #boxBuilder,
html[data-boxopen] #boxBuilder .box-stage,
html[data-boxopen] #boxBuilder .box-visual,
html[data-boxopen] #productBuilderRail {
  overflow: visible;
}
.bxl-layer { overflow: visible; }
