/* Native-panel lift-off box. One em is one assembly unit (nominally 1mm).
   The presentation scale is font-size; all source artwork keeps its proportion.
   The static state is open. JavaScript owns the optional opening timeline. */
.hero-stage.unboxing {
  height: 520px;
  margin-top: 32px;
  perspective: 1200px;
  perspective-origin: 50% 45%;
  overflow: visible;
}
.hero-stage.unboxing > button.hero-card { top: 8px; transform-origin: 50% 50%; }
.hero-stage.unboxing .hero-orbit { display: none; }

.packaging-assembly {
  --box-paper: #f7f2e8;
  --box-edge: #d9d0c0;
  --box-inside: #e9e1d3;
  position: absolute;
  z-index: 0;
  left: 60%;
  top: 66%;
  width: 200em;
  height: 278em;
  font-size: 1px;
  line-height: 1;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  pointer-events: none;
}
.unbox-world, .unbox-tray, .unbox-lid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}
.unbox-world {
  transform-origin: 50% 50%;
  transform: rotateX(42deg) rotateZ(-10deg);
}
.tray-floor {
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, #e5dccb, #f3eddf 42%, #e7dece);
  border: 1em solid #d7cbb8;
  transform: translateZ(-27em);
}

/* Coordinates place the rim at z=0 and the floor at z=-27. */
.box-wall {
  position: absolute;
  display: block;
  background: var(--box-paper);
  transform-style: preserve-3d;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  outline: .35em solid #ddd4c5;
  outline-offset: -.2em;
}
.box-wall > img {
  position: absolute;
  display: block;
  max-width: none;
  object-fit: contain;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
}
.tray-front {
  left: 0;
  top: 278em;
  width: 200em;
  height: 28em;
  transform-origin: top left;
  transform: rotateX(-90deg);
  background: linear-gradient(#f7f2e8, #e9e0d1);
}
.tray-back {
  left: 0;
  top: 0;
  width: 200em;
  height: 28em;
  transform-origin: top left;
  transform: translateZ(-28em) rotateX(90deg);
  background: #e4dac9;
}
.tray-left {
  left: 0;
  top: 0;
  width: 28em;
  height: 278em;
  transform-origin: top left;
  transform: translateZ(-28em) rotateY(-90deg);
  background: #e9dfcf;
}
.tray-right {
  left: 200em;
  top: 0;
  width: 28em;
  height: 278em;
  transform-origin: top left;
  transform: rotateY(90deg);
  background: #f0e8db;
}
:is(.tray-front, .tray-back) > img {
  inset: 0;
  width: 200em;
  height: 28em;
}
:is(.tray-left, .tray-right) > img {
  left: 50%;
  top: 50%;
  width: 278em;
  height: 28em;
  transform: translate(-50%, -50%) rotate(90deg);
}

/* Four actual guide cards and their native belly-band panels. */
.tray-decks {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateZ(-6em);
}
.boxed-deck {
  position: absolute;
  width: 89em;
  height: 127em;
  border-radius: 1.8em;
  background: var(--box-paper);
  transform-style: preserve-3d;
}
.boxed-B { left: 7em; top: 8em; }
.boxed-S { left: 104em; top: 8em; }
.boxed-P { left: 7em; top: 143em; }
.boxed-A { left: 104em; top: 143em; }
.boxed-deck::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #e6dfd2;
  box-shadow: 0 1.4em 0 #cfc6b6, 0 2.8em 0 #e9e2d6, 0 4em 0 #cec5b6;
  transform: translateZ(-3em);
}
.boxed-deck > img.full-card {
  position: absolute;
  inset: 0;
  width: 89em;
  height: 127em;
  max-width: none;
  object-fit: contain;
  border-radius: inherit;
  backface-visibility: hidden;
}
.boxed-deck > img.deck-band {
  position: absolute;
  left: 0;
  top: 59em;
  width: 89em;
  height: 32em;
  max-width: none;
  object-fit: contain;
  transform: translateZ(.6em);
  backface-visibility: hidden;
}

/* Thin paperboard separators sit between the stacks, below the outer rim. */
.tray-divider {
  position: absolute;
  background: #f4eee4;
  transform: translateZ(-5em);
  transform-style: preserve-3d;
}
.divider-x { left: 99.5em; top: 5em; width: 1em; height: 268em; }
.divider-y { left: 5em; top: 138.5em; width: 190em; height: 1em; }
.tray-divider::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  background: #d8cdbb;
  transform-origin: top left;
}
.divider-x::before { width: 22em; height: 100%; transform: rotateY(90deg); }
.divider-y::before { width: 100%; height: 22em; transform: rotateX(-90deg); }

/* The lid is a removable rigid shell, not a hinged cover. */
.unbox-lid {
  transform-origin: 50% 50%;
  transform: translate3d(-220em, -8em, 18em) rotateY(-165deg) rotateZ(4deg);
}
.lid-outside, .lid-inside {
  position: absolute;
  inset: 0;
  width: 200em;
  height: 278em;
  background: var(--box-paper);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  outline: .5em solid #ded5c6;
  outline-offset: -.25em;
}
.lid-outside { transform: translateZ(2em); }
.lid-outside > img {
  display: block;
  width: 200em;
  height: 278em;
  max-width: none;
  object-fit: contain;
}
.lid-inside { transform: translateZ(-2em) rotateY(180deg); }
.lid-inside > img {
  position: absolute;
  top: 5em;
  left: 5em;
  display: block;
  width: 190em;
  height: 268em;
  max-width: none;
  object-fit: contain;
}
.lid-wall-front {
  left: 0;
  top: 278em;
  width: 200em;
  height: 20em;
  transform-origin: top left;
  transform: rotateX(-90deg);
}
.lid-wall-back {
  left: 0;
  top: 0;
  width: 200em;
  height: 20em;
  transform-origin: top left;
  transform: translateZ(-20em) rotateX(90deg);
}
.lid-wall-left {
  left: 0;
  top: 0;
  width: 20em;
  height: 278em;
  transform-origin: top left;
  transform: translateZ(-20em) rotateY(-90deg);
}
.lid-wall-right {
  left: 200em;
  top: 0;
  width: 20em;
  height: 278em;
  transform-origin: top left;
  transform: rotateY(90deg);
}
:is(.lid-wall-front, .lid-wall-back) > img {
  inset: 0;
  width: 200em;
  height: 20em;
  object-fit: contain;
}
:is(.lid-wall-left, .lid-wall-right) > img {
  left: 50%;
  top: 50%;
  width: 278em;
  height: 20em;
  object-fit: contain;
  transform: translate(-50%, -50%) rotate(90deg);
}

.unboxing > .unbox-shadow {
  position: absolute;
  z-index: -1;
  left: 54%;
  top: 82%;
  width: 470px;
  height: 75px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #00000021 0%, #0000000a 44%, transparent 72%);
  transform: translate(-50%, -50%) rotate(-8deg);
  pointer-events: none;
}
.unbox-fallback {
  position: absolute;
  z-index: 0;
  display: none;
  left: 50%;
  top: 70%;
  width: min(440px, 90%);
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.unboxing.use-fallback .packaging-assembly,
.unboxing.use-fallback > .unbox-shadow { display: none; }
.unboxing.use-fallback .unbox-fallback { display: block; }
.unbox-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  max-width: 750px;
  margin: -6px auto 23px;
}
.unbox-controls > p, .unbox-controls .unbox-caption {
  margin: 0 7px 0 0;
  color: var(--muted);
  font: 10px/1.6 var(--sans);
}
.unbox-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 11px/20px var(--sans);
  transition: background-color 150ms ease, border-color 150ms ease;
}
.unbox-controls button:hover { background: var(--field); border-color: var(--border-hover); }
.unbox-controls button:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.unbox-controls button:disabled { opacity: .45; cursor: default; }

@media (min-width: 1280px) {
  .packaging-assembly { font-size: 1.1px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .hero-stage.unboxing { height: 470px; }
  .packaging-assembly { left: 62%; top: 69%; font-size: .85px; }
  .unboxing > .unbox-shadow { width: 355px; height: 58px; top: 84%; }
}
@media (max-width: 767px) {
  .hero-stage.unboxing { height: 400px; margin-top: 25px; }
  .hero-stage.unboxing > button.hero-card { top: 5px; }
  .packaging-assembly { left: 64%; top: 72%; font-size: .6px; }
  .unboxing > .unbox-shadow { left: 53%; top: 84%; width: min(300px, 100%); height: 44px; }
  .unbox-fallback { top: 72%; width: min(300px, 90%); }
  .unbox-controls { margin-top: -7px; margin-bottom: 20px; gap: 3px 8px; }
  .unbox-controls > p, .unbox-controls .unbox-caption { flex-basis: 100%; margin: 0 0 4px; font-size: 9px; }
  .unbox-controls button { padding-inline: 12px; font-size: 10px; }
}
@media (min-width: 550px) and (max-width: 767px) {
  .hero-stage.unboxing { height: 440px; }
  .packaging-assembly { left: 62%; top: 72%; font-size: .72px; }
  .unboxing > .unbox-shadow { width: 355px; height: 55px; }
  .unbox-fallback { width: min(360px, 90%); }
}
@media (max-width: 359px) {
  .hero-stage.unboxing { height: 385px; }
  .packaging-assembly { left: 65%; top: 72%; font-size: .54px; }
  .unboxing > .unbox-shadow { width: min(260px, 100%); height: 39px; }
  .unbox-fallback { width: min(260px, 90%); }
}
@media (prefers-reduced-motion: reduce) {
  .unbox-controls button { transition: none; }
}
@media (forced-colors: active) {
  .unbox-controls button { border: 1px solid ButtonText; }
  .unbox-controls button:focus-visible { outline-color: Highlight; }
}

@supports not (transform-style: preserve-3d) {
  .unboxing .packaging-assembly, .unboxing > .unbox-shadow { display: none; }
  .unboxing .unbox-fallback { display: block; }
}
