/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   THE 3D STAGE — 2026-11-03, after the owner's reference ("3D designs like the model I gave you").
   Pure CSS 3D: a perspective neon floor, a pedestal of rings that takes the rank's colour, a light
   beam, the crest floating and turning above it, and the seven ranks orbiting it. No library: three.js
   would cost ~600 KB on a phone that arrived from a TikTok link, and this costs none.
   The crest art is flat, so "3D" here is depth by STAGING — a floor to stand on, light to stand in,
   and motion in Z — which is how the reference reads too: the camera moves, the photo does not.
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */
.stage3d {
  --tone: #c8ff00; --tone-a: rgba(200,255,0,.55);
  position: relative; height: clamp(300px, 78vw, 520px); margin: -10px 0 0;
  perspective: 900px; perspective-origin: 50% 30%;
  transform-style: preserve-3d; isolation: isolate;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.stage3d .floor {
  position: absolute; left: -60%; right: -60%; bottom: -6%; height: 140%;
  transform-origin: 50% 100%; transform: rotateX(78deg);
  background:
    linear-gradient(transparent 0 96%, var(--tone-a) 96% 100%) 0 0 / 100% 46px,
    linear-gradient(90deg, transparent 0 96%, var(--tone-a) 96% 100%) 0 0 / 46px 100%;
  opacity: .32;
  -webkit-mask-image: radial-gradient(ellipse 46% 60% at 50% 100%, #000 30%, transparent 72%);
          mask-image: radial-gradient(ellipse 46% 60% at 50% 100%, #000 30%, transparent 72%);
  animation: floorRun 6s linear infinite;
}
@keyframes floorRun { to { background-position: 0 46px, 0 0; } }

.stage3d .beam {
  position: absolute; left: 50%; bottom: 17%; width: 46%; height: 78%; transform: translateX(-50%);
  background: linear-gradient(to top, var(--tone-a), transparent 78%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
  filter: blur(14px); opacity: .55; animation: beam 3.2s ease-in-out infinite;
}
@keyframes beam { 50% { opacity: .85; } }

/* the pedestal: three rings lying flat on the floor, pulsing outwards */
.stage3d .ped { position: absolute; left: 50%; bottom: 13%; width: 0; height: 0; transform-style: preserve-3d; }
.stage3d .ring {
  position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 3px solid var(--tone);
  transform: translate(-50%, -50%) rotateX(76deg);
  box-shadow: 0 0 22px var(--tone), inset 0 0 22px var(--tone-a);
}
.stage3d .ring.r1 { width: 230px; height: 230px; }
.stage3d .ring.r2 { width: 300px; height: 300px; border-width: 1.5px; opacity: .55; }
.stage3d .ring.r3 { width: 230px; height: 230px; border-width: 2px; animation: pulse 2.6s ease-out infinite; }
@keyframes pulse { from { width: 230px; height: 230px; opacity: .9; } to { width: 440px; height: 440px; opacity: 0; } }
.stage3d .disc {
  position: absolute; left: 50%; top: 50%; width: 210px; height: 210px; border-radius: 50%;
  transform: translate(-50%, -50%) rotateX(76deg);
  background: radial-gradient(circle, var(--tone-a), transparent 66%); filter: blur(4px);
}

/* the hero crest: floats, turns, and casts a shadow that breathes with it */
.stage3d .hero-crest {
  position: absolute; left: 50%; bottom: 23%; width: min(58%, 300px); height: auto;
  transform: translateX(-50%); transform-style: preserve-3d;
  filter: drop-shadow(0 26px 30px rgba(0,0,0,.65)) drop-shadow(0 0 26px var(--tone-a));
  animation: float 5s ease-in-out infinite, turn 9s ease-in-out infinite;
}
@keyframes float { 50% { translate: 0 -16px; } }
@keyframes turn { 0%, 100% { transform: translateX(-50%) rotateY(-22deg) rotateX(6deg); } 50% { transform: translateX(-50%) rotateY(22deg) rotateX(-4deg); } }

/* the orbit: all seven ranks circling the pedestal in a tilted plane */
.stage3d .orbit {
  position: absolute; left: 50%; bottom: 36%; width: 0; height: 0; transform-style: preserve-3d;
  transform: rotateX(-10deg) rotateY(0deg); animation: orbit 34s linear infinite;
}
@keyframes orbit { to { transform: rotateX(-10deg) rotateY(-360deg); } }
.stage3d .sat {
  position: absolute; left: 0; top: 0; width: 66px; margin: -24px 0 0 -33px; transform-style: preserve-3d;
  transform: rotateY(var(--a)) translateZ(var(--R, 168px));
}
.stage3d .sat img { width: 100%; height: auto; animation: face 34s linear infinite; filter: drop-shadow(0 8px 10px rgba(0,0,0,.7)); }
/* each crest counter-turns so it always faces the camera while the ring carries it round */
@keyframes face { from { transform: rotateY(calc(-1 * var(--a))); } to { transform: rotateY(calc(-1 * var(--a) + 360deg)); } }
.stage3d .sat:nth-child(1) { --a: 0deg; }      .stage3d .sat:nth-child(2) { --a: 51.43deg; }
.stage3d .sat:nth-child(3) { --a: 102.86deg; } .stage3d .sat:nth-child(4) { --a: 154.29deg; }
.stage3d .sat:nth-child(5) { --a: 205.71deg; } .stage3d .sat:nth-child(6) { --a: 257.14deg; }
.stage3d .sat:nth-child(7) { --a: 308.57deg; }
@media (min-width: 600px) { .stage3d .sat { --R: 230px; width: 80px; margin: -30px 0 0 -40px; } }

/* sparks rising off the pedestal */
.stage3d .sparks i {
  position: absolute; left: 50%; bottom: 18%; width: 4px; height: 4px; border-radius: 50%;
  background: var(--tone); box-shadow: 0 0 10px var(--tone); opacity: 0;
  animation: spark 3.6s linear infinite;
}
@keyframes spark { 10% { opacity: 1; } 100% { transform: translate(var(--dx), -260px) scale(.3); opacity: 0; } }
.stage3d .sparks i:nth-child(1) { --dx: -70px; margin-left: -40px; animation-delay: 0s; }
.stage3d .sparks i:nth-child(2) { --dx: 40px;  margin-left: 30px;  animation-delay: .5s; }
.stage3d .sparks i:nth-child(3) { --dx: -20px; margin-left: -80px; animation-delay: 1.1s; }
.stage3d .sparks i:nth-child(4) { --dx: 80px;  margin-left: 70px;  animation-delay: 1.6s; }
.stage3d .sparks i:nth-child(5) { --dx: -50px; margin-left: 10px;  animation-delay: 2.2s; }
.stage3d .sparks i:nth-child(6) { --dx: 30px;  margin-left: -20px; animation-delay: 2.7s; }
.stage3d .sparks i:nth-child(7) { --dx: 60px;  margin-left: 50px;  animation-delay: 3.1s; }
.stage3d .sparks i:nth-child(8) { --dx: -90px; margin-left: -60px; animation-delay: 1.9s; }

@media (prefers-reduced-motion: reduce) {
  .stage3d, .stage3d * { animation: none !important; transition: none !important; }
  .stage3d .ring.r3 { display: none; }
}
