/* Kadabra Room v26 — VCR intake mechanism
   The cassette is visible only while entering/exiting the mouth. Once loaded,
   it is physically inside the VCR and the intake flap is closed. */

/* Override the older v25 slot animation; v26 drives the door from explicit
   mechanism classes so it cannot remain visually open after loading. */
.vcr-slot.is-loading .slot-mouth {
  animation: none !important;
}

.vcr-slot .slot-mouth {
  transform: scaleY(1);
  transform-origin: center;
  transition: transform .22s cubic-bezier(.3,.72,.25,1), background .22s ease, box-shadow .22s ease;
}

.vcr-slot-bay.is-intaking .slot-mouth,
.vcr-slot-bay.is-ejecting .slot-mouth {
  transform: scaleY(.16);
  background: linear-gradient(#000,#020202 47%,#000 53%);
  box-shadow: inset 0 0 9px #000, 0 0 0 1px rgba(255,255,255,.025);
}

.vcr-slot.is-intake-closed .slot-mouth,
.vcr-slot-bay.has-loaded-tape .slot-mouth {
  transform: scaleY(1);
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 28%),
    linear-gradient(#10100f 0 44%, #020202 45% 56%, #0b0b0a 57% 100%);
  box-shadow:
    inset 0 3px 6px rgba(0,0,0,.96),
    inset 0 -1px rgba(255,255,255,.025),
    0 1px 0 rgba(255,255,255,.02);
}

/* This helper cassette is a short loading-carriage animation only. It must
   never remain parked above the slot in a steady loaded/playing state. */
.loaded-cassette-3d {
  display: none !important;
}
.loaded-cassette-3d.is-mechanism-visible {
  display: block !important;
  z-index: 12 !important;
  top: 2px !important;
  width: min(72%, 610px) !important;
  height: 64px !important;
  opacity: 1;
  transform: translate(-50%, -47px) perspective(760px) rotateX(48deg) rotateY(-1deg) scale(.96) !important;
  transform-origin: center bottom !important;
  pointer-events: none !important;
}
.loaded-cassette-3d.is-mechanism-visible.is-intaking {
  animation: cassette-intake-v26 .52s cubic-bezier(.26,.72,.18,1) forwards !important;
}

@keyframes cassette-intake-v26 {
  0% {
    opacity: .92;
    transform: translate(-50%, -47px) perspective(760px) rotateX(48deg) rotateY(-1deg) scale(.96);
  }
  48% {
    opacity: .82;
    transform: translate(-50%, -21px) perspective(760px) rotateX(62deg) rotateY(-.4deg) scale(.78);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 6px) perspective(760px) rotateX(78deg) rotateY(0deg) scale(.52);
  }
}

/* While the carriage closes, hide the text rather than leaving a label floating
   over the mouth. The normal slot label returns once loading finishes. */
.vcr-slot-bay.is-intaking .slot-label,
.vcr-slot-bay.is-ejecting .slot-label {
  opacity: .32;
}

@media (max-width:870px) {
  .loaded-cassette-3d.is-mechanism-visible {
    width: 74% !important;
    height: 56px !important;
    transform: translate(-50%, -40px) perspective(650px) rotateX(49deg) scale(.94) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vcr-slot .slot-mouth { transition: none !important; }
  .loaded-cassette-3d.is-mechanism-visible.is-intaking { animation: none !important; opacity: 0 !important; }
}
