/* ============================================================
   assets/css/page-transition.css
   Para-App — Enterprise Cinematic 3.8s Volleyball Page Transition
   ============================================================ */

/* Main Overlay Container */
#page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, visibility;
}

/* Active State */
#page-transition.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Exit State (Dissolve Out) */
#page-transition.exiting {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Glass Backdrop with Vignette */
.transition-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(26, 58, 107, 0.97) 0%, rgba(15, 36, 68, 0.98) 60%, rgba(6, 14, 28, 0.99) 100%);
  backdrop-filter: blur(22px) saturate(190%);
  -webkit-backdrop-filter: blur(22px) saturate(190%);
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.88);
}

/* Volleyball Court Perspective Lines (Subtle) */
.volleyball-court-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 90px 90px;
  transform: perspective(600px) rotateX(55deg) scale(1.5);
  transform-origin: center bottom;
  transition: opacity 0.6s ease;
}

#page-transition.active .volleyball-court-lines {
  opacity: 0.16;
}

/* Volleyball Net Visual Metaphor */
.volleyball-net {
  position: absolute;
  top: 42%;
  left: -10%;
  width: 120%;
  height: 100px;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.14) 0px,
      rgba(255, 255, 255, 0.14) 1.5px,
      transparent 1.5px,
      transparent 14px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.14) 0px,
      rgba(255, 255, 255, 0.14) 1.5px,
      transparent 1.5px,
      transparent 14px
    );
  border-top: 3px solid rgba(255, 255, 255, 0.45);
  border-bottom: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.35);
  transform: perspective(800px) rotateX(16deg) skewX(-12deg);
  transition: opacity 0.5s ease;
}

#page-transition.net-active .volleyball-net {
  opacity: 0.38;
  animation: netPulse 3s ease-in-out infinite alternate;
}

/* Central Core Container — Mathematical Center */
.transition-core {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 380px;
  height: 380px;
  pointer-events: none;
}

#page-transition.spike-impact .transition-core {
  animation: microScreenShake 0.3s ease-in-out;
}

/* Radial Light Glow behind Logo */
.logo-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 160, 32, 0.55) 0%, rgba(36, 86, 164, 0.35) 45%, rgba(0, 0, 0, 0) 75%);
  filter: blur(35px);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

#page-transition.logo-revealed .logo-glow {
  opacity: 1;
  animation: glowPulse 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

/* Spike Shockwave Energy Wave */
.spike-shockwave {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3.5px solid rgba(232, 160, 32, 0.95);
  box-shadow: 0 0 50px rgba(232, 160, 32, 0.85), inset 0 0 30px rgba(232, 160, 32, 0.6);
  opacity: 0;
  pointer-events: none;
}

#page-transition.spike-impact .spike-shockwave {
  animation: shockwaveExpand 0.85s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

/* Logo Image Styling & Floating Badge (EXACT EXISTING logo.png) */
.transition-logo-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 50%;
  box-shadow: 0 0 50px rgba(232, 160, 32, 0.45),
              0 18px 50px rgba(0, 0, 0, 0.55),
              inset 0 0 25px rgba(255, 255, 255, 0.95);
  opacity: 0;
  transform: scale(0.65);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.45s ease;
}

#page-transition.logo-revealed .transition-logo-wrapper {
  opacity: 1;
  transform: scale(1);
  animation: logoSoftBounce 2.5s ease-in-out infinite alternate;
}

.transition-logo {
  max-width: 160px;
  max-height: 160px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.18));
}

/* 🏐 VOLLEYBALL GRAPHIC & 3.8s TRAJECTORY 🏐 */
.volleyball-object {
  position: fixed;
  z-index: 120;
  width: 95px;
  height: 95px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.65));
  will-change: transform, opacity, filter;
}

.volleyball-svg {
  width: 100%;
  height: 100%;
  animation: ballSpin 1.6s linear infinite;
}

/* Motion Blur Trail */
.volleyball-object::after {
  content: '';
  position: absolute;
  top: 10%;
  left: -45%;
  width: 145%;
  height: 80%;
  border-radius: 50%;
  background: linear-gradient(90deg, rgba(232, 160, 32, 0) 0%, rgba(232, 160, 32, 0.38) 60%, rgba(255, 255, 255, 0.7) 100%);
  filter: blur(8px);
  opacity: 0.65;
  pointer-events: none;
  transform: rotate(-15deg);
}

/* Volleyball 3.8-Second Complete Trajectory Sequence */
#page-transition.active .volleyball-object {
  animation: volleyball38sTrajectory 3.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

/* Energy Rings Composition */
.energy-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#page-transition.logo-revealed .energy-ring {
  opacity: 1;
}

.ring-1 {
  width: 330px;
  height: 330px;
  border: 2px dashed rgba(232, 160, 32, 0.55);
  box-shadow: 0 0 28px rgba(232, 160, 32, 0.25);
  animation: rotateCounter 15s linear infinite;
}

.ring-2 {
  width: 270px;
  height: 270px;
  border: 1.5px solid rgba(255, 255, 255, 0.32);
  border-top-color: rgba(232, 160, 32, 0.95);
  border-bottom-color: rgba(36, 86, 164, 0.95);
  box-shadow: 0 0 22px rgba(36, 86, 164, 0.35);
  animation: rotateClockwise 7s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.ring-3 {
  width: 210px;
  height: 210px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-left-color: rgba(232, 160, 32, 0.88);
  border-right-color: rgba(255, 255, 255, 0.65);
  animation: rotateElliptical 5s ease-in-out infinite;
}

/* Ambient Dust Particles */
.energy-particles {
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  pointer-events: none;
}

.energy-particles::before,
.energy-particles::after {
  content: '';
  position: absolute;
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: var(--accent, #e8a020);
  box-shadow: 0 0 14px var(--accent, #e8a020),
              130px -90px 0 1px rgba(255, 255, 255, 0.75),
              -100px 120px 0 1px rgba(232, 160, 32, 0.88),
              90px 110px 0 1.5px rgba(36, 86, 164, 0.85),
              -120px -80px 0 1px rgba(255, 255, 255, 0.65),
              70px -130px 0 1px rgba(232, 160, 32, 0.75),
              -80px -110px 0 1.5px rgba(255, 255, 255, 0.85);
  animation: particleFloat 5s ease-in-out infinite alternate;
}

/* Progress Status Bar */
.transition-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-light, #2456a4), var(--accent, #e8a020), #ffffff);
  box-shadow: 0 0 14px rgba(232, 160, 32, 0.95);
  z-index: 1000000;
  transition: width 0.3s ease;
}

#page-transition.active .transition-progress-bar {
  width: 95%;
  transition: width 3.7s cubic-bezier(0.1, 0.6, 0.1, 1);
}

/* KEYFRAME ANIMATIONS (3.8s Timeline Sequence) */

@keyframes volleyball38sTrajectory {
  /* 0ms – 500ms: Serve Preparation & Entrance from Bottom-Left */
  0% {
    top: 92vh;
    left: -110px;
    transform: scale(0.55) rotate(-25deg);
    opacity: 0;
  }
  13% {
    top: 60vh;
    left: 12vw;
    transform: scale(0.8) rotate(-5deg);
    opacity: 1;
  }

  /* 500ms – 1000ms: Flight Entrance Across Lower Field */
  26% {
    top: 35vh;
    left: 30vw;
    transform: scale(1.0) rotate(15deg);
    opacity: 1;
  }

  /* 1000ms – 1500ms: Curved Arc Over Volleyball Net */
  39% {
    top: 25vh;
    left: 52vw;
    transform: scale(1.15) rotate(35deg);
    opacity: 1;
  }

  /* 1500ms – 2000ms: Net Crossing & Downward Setup for Spike */
  52% {
    top: 44vh;
    left: 47vw;
    transform: scale(1.3) rotate(55deg);
    opacity: 1;
  }

  /* 2000ms – 2500ms: SPIKE ACCELERATION INTO CENTER (50%, 50%) */
  65% {
    top: 50vh;
    left: 50vw;
    transform: translate(-50%, -50%) scale(1.55) rotate(75deg);
    opacity: 1;
  }

  /* 2500ms – 2900ms: SPIKE IMPACT REBOUND */
  76% {
    top: 48vh;
    left: 50vw;
    transform: translate(-50%, -50%) scale(1.35) rotate(90deg);
    opacity: 1;
  }

  /* 2900ms – 3350ms: Orbit Arc Around logo.png */
  88% {
    top: 38vh;
    left: 62vw;
    transform: scale(0.9) rotate(140deg);
    opacity: 0.9;
  }

  /* 3350ms – 3800ms: Final Exit Off-Screen Top-Right */
  100% {
    top: -120px;
    left: 112vw;
    transform: scale(0.45) rotate(210deg);
    opacity: 0;
  }
}

@keyframes ballSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes shockwaveExpand {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(3.0);
    opacity: 0;
  }
}

@keyframes microScreenShake {
  0% { transform: translate(-50%, -50%); }
  20% { transform: translate(-47%, -53%); }
  40% { transform: translate(-53%, -47%); }
  60% { transform: translate(-48%, -52%); }
  80% { transform: translate(-52%, -48%); }
  100% { transform: translate(-50%, -50%); }
}

@keyframes logoSoftBounce {
  0% { transform: scale(0.98) translateY(0px); }
  50% { transform: scale(1.03) translateY(-7px); }
  100% { transform: scale(0.98) translateY(0px); }
}

@keyframes glowPulse {
  0% { transform: scale(0.85); opacity: 0.45; }
  100% { transform: scale(1.3); opacity: 0.95; }
}

@keyframes netPulse {
  0% { opacity: 0.28; }
  100% { opacity: 0.48; }
}

@keyframes rotateClockwise {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes rotateCounter {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}

@keyframes rotateElliptical {
  0% { transform: rotate(0deg) scale(0.98); }
  50% { transform: rotate(-180deg) scale(1.04); }
  100% { transform: rotate(-360deg) scale(0.98); }
}

@keyframes particleFloat {
  0% { transform: rotate(0deg) scale(0.9); opacity: 0.5; }
  100% { transform: rotate(180deg) scale(1.15); opacity: 1; }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .volleyball-object {
    width: 70px;
    height: 70px;
  }
  .transition-core {
    width: 280px;
    height: 280px;
  }
  .ring-1 { width: 250px; height: 250px; }
  .ring-2 { width: 210px; height: 210px; }
  .ring-3 { width: 170px; height: 170px; }
  .transition-logo {
    max-width: 120px;
    max-height: 120px;
  }
  .volleyball-net {
    height: 70px;
  }
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .volleyball-object, .volleyball-svg,
  .spike-shockwave, .ring-1, .ring-2, .ring-3,
  .logo-glow, .transition-logo-wrapper {
    animation: none !important;
  }
  #page-transition {
    transition: opacity 0.3s linear !important;
  }
}
