/* ══════════════════════════════════════════════════════════════════
   SITE TRANSITION — cinematic cyan-ring kickoff overlay
   Plays on every internal link click with a destination-aware
   message. Extracted from the old inline register-transition in
   index.html so all pages share the same language.
   Total run: ~1400ms from click → navigate.
   ══════════════════════════════════════════════════════════════════ */

.site-transition {
  position: fixed;
  inset: 0;
  background: #04031C;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}
.site-transition.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Expanding cyan rings — three staggered loops behind the crest */
.st-rings {
  position: absolute;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.st-ring {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 1.5px solid #0BADFF;
  opacity: 0;
}
@keyframes st-ring-expand {
  from { transform: scale(0.4); opacity: 0.6; }
  to   { transform: scale(1.8); opacity: 0; }
}
.is-active .st-ring:nth-child(1) { animation: st-ring-expand 900ms ease-out 0ms    infinite; }
.is-active .st-ring:nth-child(2) { animation: st-ring-expand 900ms ease-out 225ms  infinite; }
.is-active .st-ring:nth-child(3) { animation: st-ring-expand 900ms ease-out 450ms  infinite; }

/* Crest pops in with a slight overshoot, then slow-spins */
.st-crest {
  width: 140px;
  height: 140px;
  transform: scale(0.9);
  opacity: 0;
  filter: drop-shadow(0 12px 48px rgba(11,173,255,0.4));
  position: relative;
  z-index: 1;
}
.is-active .st-crest {
  animation: st-crest-in 420ms cubic-bezier(0.34, 1.56, 0.64, 1) 40ms forwards,
             st-crest-spin 20s linear infinite 460ms;
}
@keyframes st-crest-in {
  0%   { transform: scale(0.9);  opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}
@keyframes st-crest-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Label — destination-specific message, three phases via JS swap */
.st-label {
  font-family: 'Anton', 'Inter', sans-serif;
  font-size: 14px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  opacity: 0;
  transform: translateY(8px);
  display: flex;
  align-items: center;
  margin-top: 28px;
  transition: opacity 100ms ease-out;
  text-align: center;
  padding: 0 24px;
}
.is-active .st-label {
  animation: st-label-in 220ms ease-out 180ms forwards;
}
@keyframes st-label-in {
  to { opacity: 1; transform: translateY(0); }
}

/* Thin cyan progress bar underneath */
.st-progress-track {
  width: 240px;
  height: 1px;
  background: rgba(255,255,255,0.1);
  border-radius: 1px;
  margin-top: 24px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 150ms ease-out 240ms;
}
.is-active .st-progress-track { opacity: 1; }
.st-progress-fill {
  height: 100%;
  width: 0;
  background: #0BADFF;
  border-radius: 1px;
}
@keyframes st-progress {
  from { width: 0; }
  to   { width: 100%; }
}
.is-active .st-progress-fill {
  animation: st-progress 1150ms ease-out 120ms forwards;
}

/* Pulsing dots next to the label */
.st-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 12px;
}
.st-dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
}
.is-active .st-dots span:nth-child(1) { animation: st-dot 0.9s ease-in-out 400ms infinite; }
.is-active .st-dots span:nth-child(2) { animation: st-dot 0.9s ease-in-out 520ms infinite; }
.is-active .st-dots span:nth-child(3) { animation: st-dot 0.9s ease-in-out 640ms infinite; }
@keyframes st-dot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-2px); }
}

/* Reduced motion: skip the cinematic, snap to a brief plain fade */
@media (prefers-reduced-motion: reduce) {
  .site-transition,
  .site-transition.is-active { transition: opacity 80ms ease-out; }
  .is-active .st-rings,
  .is-active .st-crest,
  .is-active .st-progress-track,
  .is-active .st-dots { animation: none; opacity: 0.8; }
}
