/* The supplied reference uses a 1672 × 941 gate image and two separate 134 ×
   422 door leaves. Percentages here come from those artwork dimensions. */
.entrance {
  container-type: size;
  background: #080e2c;
}
.gateway-scene {
  inset: auto;
  top: 50%;
  left: 50%;
  bottom: auto;
  width: max(100cqw, 177.683cqh);
  height: auto;
  aspect-ratio: 1672 / 941;
  background: url('assets/reference/gate/peacock.webp') center / 100% 100% no-repeat;
  transform-origin: 50.12% 69.18%;
  animation: royal-gate-idle 14s ease-in-out infinite alternate;
  opacity: 1;
}
.gateway-scene::after { display: none; }
.royal-door-window {
  position: absolute;
  left: 42.105%;
  top: 46.759%;
  width: 16.028%;
  height: 44.846%;
  perspective: 1400px;
  perspective-origin: 50% 50%;
  pointer-events: none;
}
.royal-door-opening {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 60%, #ffe4b3 55%, #dea645 115%);
  mask: url('assets/reference/gate/peacock-opening.png') center / 100% 100% no-repeat;
  -webkit-mask: url('assets/reference/gate/peacock-opening.png') center / 100% 100% no-repeat;
}
.royal-door-leaf {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  backface-visibility: hidden;
  will-change: transform;
  transition: transform 2.6s cubic-bezier(.65,0,.35,1) .9s,
              filter 2.6s cubic-bezier(.65,0,.35,1) .9s;
}
.royal-door-leaf.left { left: 0; transform-origin: left center; }
.royal-door-leaf.right { right: 0; transform-origin: right center; }
.royal-door-seam {
  position: absolute;
  left: 50.12%;
  top: 46.759%;
  width: .5%;
  height: 44.846%;
  background: white;
  border-radius: 100px;
  filter: blur(2px);
  opacity: 0;
  transform: translateX(-50%) scaleY(0);
  pointer-events: none;
}
.royal-gate-vignette {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(17,2,0,.75));
  opacity: .55;
  pointer-events: none;
  transition: opacity .9s;
}
.royal-gate-sparks { position: absolute; inset: 0; pointer-events: none; }
.royal-gate-sparks span {
  position: absolute;
  bottom: 0;
  left: var(--spark-x);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #dea645;
  filter: blur(1px);
  opacity: 0;
  animation: royal-gate-spark var(--spark-time) linear var(--spark-delay) infinite;
}
.entrance.opening .gateway-scene {
  animation: royal-gate-push 4.5s forwards;
  opacity: 1;
}
.entrance.opening .royal-door-leaf.left { transform: rotateY(86deg); filter: brightness(.5); }
.entrance.opening .royal-door-leaf.right { transform: rotateY(-86deg); filter: brightness(.5); }
.entrance.replaying .royal-door-leaf { transition: none; }
.entrance.opening .royal-door-seam { animation: royal-gate-seam 1.8s ease-out forwards; }
.entrance.opening .royal-gate-vignette { opacity: 1; }
.entrance.opening .gate-tap,
.entrance.opening .gate-copy,
.entrance.opening .gate-skip { opacity: 0; transition: opacity .5s; }
.entrance::after {
  content: '';
  position: absolute;
  z-index: 4;
  inset: 0;
  background: #ffe4b3;
  opacity: 0;
  pointer-events: none;
}
.entrance.opening::after { animation: royal-gate-flood 4.5s ease-in forwards; }
.entrance.opened { opacity: 0; pointer-events: none; transition: opacity 1.1s linear; }
.entrance .gate-skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.entrance .gate-skip:focus-visible {
  z-index: 5;
  width: auto;
  height: auto;
  right: 15px;
  bottom: 8px;
  padding: 8px;
  margin: 0;
  overflow: visible;
  clip-path: none;
  background: #080e2c;
}
@keyframes royal-gate-idle {
  0% { transform: translate(-50%,-50%) scale(1.12); }
  20% { transform: translate(-50%,-50%) scale(1); }
  60% { transform: translate(-50%,-50%) scale(1.05); }
  100% { transform: translate(-50%,-50%) scale(1); }
}
@keyframes royal-gate-push {
  0% { transform: translate(-50%,-50%) scale(1); animation-timing-function: ease-out; }
  33.333% { transform: translate(-50%,-50%) scale(1.1); animation-timing-function: cubic-bezier(.7,0,.3,1); }
  100% { transform: translate(-50%,-50%) scale(7); }
}
@keyframes royal-gate-seam {
  0% { opacity: 0; transform: translateX(-50%) scaleY(0); }
  45%,80% { opacity: 1; transform: translateX(-50%) scaleY(1); }
  100% { opacity: 0; transform: translateX(-50%) scaleY(1); }
}
@keyframes royal-gate-flood {
  0%,73.333% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes royal-gate-spark {
  0% { opacity: 0; transform: translateY(0) translateX(0); }
  15% { opacity: .9; }
  100% { opacity: 0; transform: translateY(-95vh) translateX(-10px); }
}
@media (prefers-reduced-motion: reduce) {
  .gateway-scene, .entrance.opening .gateway-scene { animation: none; transform: translate(-50%,-50%); }
  .royal-gate-sparks span { animation: none; }
  .royal-door-leaf { transition: none; }
  .entrance.opening::after { animation: none; }
}
