/* =========================================================
   animations.css — 2KS Portfolio
   All Keyframe Animations & Transition Utilities
   ========================================================= */

/* ---- Fade & Slide ---- */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-left {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---- Float animations (hero cards) ---- */
@keyframes float-1 {
  0%   { transform: translateY(0px) rotate(0deg); }
  33%  { transform: translateY(-10px) rotate(0.5deg); }
  66%  { transform: translateY(-5px) rotate(-0.5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes float-2 {
  0%   { transform: translateY(-50%) translateX(0px); }
  50%  { transform: translateY(-52%) translateX(-8px); }
  100% { transform: translateY(-50%) translateX(0px); }
}

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

@keyframes float-4 {
  0%   { transform: translateY(0px) rotate(0deg); }
  40%  { transform: translateY(-8px) rotate(-0.5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

/* ---- Glow Pulse ---- */
@keyframes glow-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 8px currentColor;
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
  }
}

@keyframes glow-pulse-btn {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.5), 0 0 80px rgba(59, 130, 246, 0.2);
  }
}

/* ---- Scan line (Hero) ---- */
@keyframes scan-line {
  0%   { top: -2px; opacity: 0; }
  10%  { opacity: 0.4; }
  90%  { opacity: 0.4; }
  100% { top: 100%; opacity: 0; }
}

/* ---- Gradient shift ---- */
@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---- Name glow breathing ---- */
@keyframes name-breathe {
  0%, 100% {
    filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.4))
            drop-shadow(0 0 60px rgba(59, 130, 246, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 50px rgba(0, 212, 255, 0.6))
            drop-shadow(0 0 100px rgba(59, 130, 246, 0.3))
            drop-shadow(0 0 150px rgba(124, 58, 237, 0.15));
  }
}

.name-glow {
  animation: name-breathe 4s ease-in-out infinite;
}

/* ---- Typing cursor ---- */
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--cyan);
  margin-left: 3px;
  vertical-align: middle;
  animation: cursor-blink 0.8s ease-in-out infinite;
}

/* ---- Ring rotate (avatar) ---- */
@keyframes ring-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---- Orbit (avatar) ---- */
@keyframes orbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---- Scroll wheel ---- */
@keyframes scroll-wheel {
  0%   { transform: translateY(0); opacity: 1; }
  80%  { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ---- Orb drift (scene) ---- */
@keyframes orb-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.1); }
  66%       { transform: translate(-15px, 20px) scale(0.9); }
}

@keyframes orb-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(-25px, -20px) scale(1.15); }
}

/* ---- Dot pulse (timeline) ---- */
@keyframes dot-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* ---- Blob drift (contact) ---- */
@keyframes blob-drift-1 {
  0%, 100% { transform: translate(0, 0); }
  33%       { transform: translate(-30px, 20px); }
  66%       { transform: translate(20px, -30px); }
}

@keyframes blob-drift-2 {
  0%, 100% { transform: translate(0, 0); }
  50%       { transform: translate(40px, -20px); }
}

/* ---- Heartbeat (footer) ---- */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15%       { transform: scale(1.3); }
  30%       { transform: scale(1); }
  45%       { transform: scale(1.15); }
  60%       { transform: scale(1); }
}

/* ---- Letter reveal (individual chars) ---- */
@keyframes letter-reveal {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.char-animated {
  display: inline-block;
  animation: letter-reveal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ---- Service card stagger ---- */
.service-card:nth-child(1) { --stagger: 0ms; }
.service-card:nth-child(2) { --stagger: 60ms; }
.service-card:nth-child(3) { --stagger: 120ms; }
.service-card:nth-child(4) { --stagger: 180ms; }
.service-card:nth-child(5) { --stagger: 240ms; }
.service-card:nth-child(6) { --stagger: 300ms; }
.service-card:nth-child(7) { --stagger: 360ms; }

/* ---- Loading dots ---- */
@keyframes loading-dot {
  0%, 80%, 100% { transform: scale(0); opacity: 0; }
  40%            { transform: scale(1); opacity: 1; }
}

.loading-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bg);
  margin: 0 2px;
  animation: loading-dot 1.2s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

/* ---- Particle shimmer ---- */
@keyframes particle-shimmer {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 1; }
}

/* ---- Section background glow animation ---- */
@keyframes bg-pulse {
  0%, 100% { opacity: 0.04; transform: scale(1); }
  50%       { opacity: 0.08; transform: scale(1.1); }
}

/* ---- Magnetic button press ---- */
.magnetic-btn:active {
  transform: scale(0.97) !important;
}

/* ---- Nav link active state ---- */
.nav-link.active {
  color: var(--white);
}

.nav-link.active::after {
  transform: scaleX(1);
}

/* ---- Skill card tilt reset on mobile ---- */
@media (hover: none) {
  .skill-card {
    transform: none !important;
  }
  .float-card:hover {
    transform: none !important;
  }
}

/* ---- Smooth scroll progress bar ---- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--grad-blue-cyan);
  z-index: 9999;
  transition: width 0.05s linear;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
  pointer-events: none;
}

/* ---- Shake (form error) ---- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-6px); }
  30%       { transform: translateX(6px); }
  45%       { transform: translateX(-5px); }
  60%       { transform: translateX(5px); }
  75%       { transform: translateX(-3px); }
  90%       { transform: translateX(3px); }
}

/* ---- Preloader ---- */
#preloader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-logo {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  background: var(--grad-blue-cyan);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: name-breathe 2s ease-in-out infinite;
}

.preloader-bar {
  width: 200px;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.preloader-bar-fill {
  height: 100%;
  background: var(--grad-blue-cyan);
  animation: preloader-fill 1.5s ease forwards;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

@keyframes preloader-fill {
  from { width: 0%; }
  to   { width: 100%; }
}
