/* ============================================
   ANIMATIONS — Keyframes & Transition Classes
   All use transform/opacity for GPU compositing
   ============================================ */

/* --- Hotspot Pulse Ring --- */
@keyframes hotspotPulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* --- Hotspot Glow Breathing --- */
@keyframes hotspotGlow {
  0%   { opacity: 0.2; transform: scale(0.95); }
  100% { opacity: 0.5; transform: scale(1.1); }
}

/* --- Floating Bob (for markers) --- */
@keyframes floatBob {
  0%, 100% { transform: translate(-50%, -50%) translate3d(0, 0, 0); }
  50%      { transform: translate(-50%, -50%) translate3d(0, -6px, 0); }
}

/* Apply floating bob to all hotspots */
.hotspot {
  animation: floatBob 5s ease-in-out infinite;
}

/* Stagger the float animation per hotspot */
.hotspot[data-location="about"]        { animation-delay: 0s; }
.hotspot[data-location="skills"]       { animation-delay: 0.8s; }
.hotspot[data-location="projects"]     { animation-delay: 0.4s; }
.hotspot[data-location="experience"]   { animation-delay: 1.2s; }
.hotspot[data-location="certificates"] { animation-delay: 0.6s; }
.hotspot[data-location="contact"]      { animation-delay: 1.0s; }

/* --- Sparkle/Twinkle --- */
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50%      { opacity: 1; transform: scale(1); }
}

/* --- Map Entrance --- */
@keyframes mapFadeIn {
  0%   { opacity: 0; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

#map-wrapper {
  animation: mapFadeIn 1.2s var(--ease-dramatic) forwards;
}

/* --- Page Content Entrance is handled via transitions in pages.css --- */

/* --- Transition Overlay Flash --- */
@keyframes transitionFlash {
  0%   { opacity: 0; }
  40%  { opacity: 1; }
  100% { opacity: 0; }
}

#transition-flash {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) + 5);
  background: radial-gradient(
    ellipse at var(--flash-x, 50%) var(--flash-y, 50%),
    rgba(255, 215, 0, 0.3) 0%,
    rgba(201, 168, 76, 0.1) 30%,
    transparent 60%
  );
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
}

#transition-flash.active {
  animation: transitionFlash 0.8s var(--ease-smooth) forwards;
}

/* --- Title Glow (Loading → Map) ---
   Uses opacity on a pseudo-element instead of animating text-shadow,
   which triggers expensive repaints every frame.
   ----- */
@keyframes titleGlowPulse {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; }
}

.loading-title {
  /* Base text shadow — static, no animation */
  text-shadow: 0 0 20px var(--glow-gold), 0 2px 4px rgba(0,0,0,0.8);
  position: relative;
}

.loading-title::after {
  content: attr(data-text);
  /* Falls back to the same text via CSS — set via JS or leave as overlay */
  position: absolute;
  inset: 0;
  color: inherit;
  text-shadow: 0 0 40px var(--glow-gold), 0 0 80px rgba(201, 168, 76, 0.3), 0 2px 4px rgba(0,0,0,0.8);
  opacity: 0;
  animation: titleGlowPulse 2s ease-in-out infinite;
  will-change: opacity;
  pointer-events: none;
}

/* --- Loading Bar Shimmer ---
   Uses translateX instead of background-position for GPU compositing.
   ----- */
@keyframes barShimmer {
  0%   { transform: translate3d(-100%, 0, 0); }
  100% { transform: translate3d(100%, 0, 0); }
}

.loading-bar-container {
  /* Ensure shimmer pseudo-element doesn't overflow */
  overflow: hidden;
  position: relative;
}

.loading-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: barShimmer 1.5s linear infinite;
  will-change: transform;
}

/* --- Reduce Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #map-wrapper {
    animation: none;
    opacity: 1;
  }

  .hotspot {
    animation: none;
  }

  .loading-title::after {
    animation: none;
    opacity: 0;
  }
}

/* ============================================
   GLOBAL SCROLL REVEALS
   Managed by Animations.js IntersectionObserver
   ============================================ */

.reveal {
  opacity: 0;
  transform: translate3d(0, 40px, 0) scale(0.98);
  transition: opacity var(--duration-cinematic) var(--ease-cinematic),
              transform var(--duration-cinematic) var(--ease-cinematic);
  will-change: opacity, transform;
}

.reveal.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

/* Stagger children automatically if wrapped in .reveal-stagger */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 100ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 200ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 300ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 400ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 500ms; }
.reveal-stagger > .reveal:nth-child(7) { transition-delay: 600ms; }
.reveal-stagger > .reveal:nth-child(8) { transition-delay: 700ms; }
