/* ============================================================
   animations.css — Loader, Keyframes, Reveal
   ============================================================ */

/* ── Loader / Splash screen ─────────────────────────────────── */
#mxr-loader {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Particle burst dots behind logo */
.loader-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.lp {
  position: absolute;
  border-radius: 50%;
  background: #d4d4d8;
  opacity: 0;
  animation: lpFly var(--d,1.4s) var(--delay,0s) ease-out forwards;
}
@keyframes lpFly {
  0%   { transform: translate(0,0) scale(1); opacity: 0.8; }
  100% { transform: translate(var(--tx,60px),var(--ty,-80px)) scale(0); opacity: 0; }
}

/* Grid scan-line behind everything */
.loader-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridFade 3s ease forwards;
}
@keyframes gridFade {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Horizontal sweep line */
.loader-sweep {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  top: 0;
  animation: sweepDown 1.8s cubic-bezier(.4,0,.2,1) forwards;
  opacity: 0.7;
}
@keyframes sweepDown {
  0%   { top: 0; }
  100% { top: 100%; }
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  position: relative;
  z-index: 2;
}

/* Logo ring animation */
.loader-ring {
  width: 90px; height: 90px;
  position: relative;
}
.loader-ring svg.ring-svg {
  width: 100%; height: 100%;
  animation: ringRotate 2s linear infinite;
}
@keyframes ringRotate {
  to { transform: rotate(360deg); }
}
.loader-ring .inner-logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: logoAppear 0.7s 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.loader-ring .inner-logo .loader-squid-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 24px rgba(200, 225, 255, 0.5));
  animation: squidBreathing 2.4s ease-in-out infinite alternate;
}
@keyframes squidBreathing {
  0% {
    transform: scale(0.95);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 20px rgba(180, 210, 255, 0.4));
  }
  100% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 18px rgba(255, 255, 255, 1)) drop-shadow(0 0 35px rgba(220, 240, 255, 0.75));
  }
}
@keyframes logoAppear {
  from { opacity: 0; transform: scale(0.4) rotate(-20deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.loader-wordmark {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: #fff;
  animation: wdAppear 0.6s 0.7s ease forwards;
  opacity: 0;
}
.loader-wordmark em { font-style: normal; color: #a1a1aa; }
@keyframes wdAppear {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Progress bar */
.loader-bar-wrap {
  width: 200px;
  height: 2px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  animation: wdAppear 0.4s 0.9s ease forwards;
  opacity: 0;
}
.loader-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #52525b, #ffffff);
  border-radius: 2px;
  animation: barFill 1.6s 1s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes barFill {
  to { width: 100%; }
}

.loader-status {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  animation: wdAppear 0.4s 1s ease forwards;
  opacity: 0;
}

/* Loader exit animation */
#mxr-loader.exit {
  animation: loaderExit 0.7s ease forwards;
}
@keyframes loaderExit {
  0%   { opacity: 1; clip-path: inset(0 0 0 0); }
  100% { opacity: 0; clip-path: inset(0 0 100% 0); pointer-events: none; }
}

/* ── Scroll reveal ──────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s cubic-bezier(.16,1,.3,1),
    transform 0.6s cubic-bezier(.16,1,.3,1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays applied via JS data-delay */
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
.reveal[data-delay="5"] { transition-delay: 0.40s; }

/* ── Misc shared keyframes ──────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
