/* ============================================================
   ANIMATIONS.CSS — Keyframes, Motion, Scroll Fx
   Sandesh Kadel Portfolio
   ============================================================ */

/* ── Loader: Letter Pop ─────────────────────────────────────── */
@keyframes letterPop {
  0%   { opacity: 0; transform: translateY(30px) scale(0.7); }
  60%  { transform: translateY(-6px) scale(1.08); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Hero: Orb Floats ───────────────────────────────────────── */
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(-60px, 40px) scale(1.05); }
  66%       { transform: translate(40px, -30px) scale(0.97); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%       { transform: translate(80px, -50px) scale(1.08); }
  70%       { transform: translate(-30px, 30px) scale(0.95); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(-40px, 50px) scale(1.1); }
}

/* ── Scroll Indicator ───────────────────────────────────────── */
@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(10px); }
}

@keyframes scrollWheel {
  0%   { opacity: 1; transform: translateY(0); }
  50%  { opacity: 0.5; transform: translateY(6px); }
  100% { opacity: 0; transform: translateY(12px); }
}

/* ── Avatar & Badge ─────────────────────────────────────────── */
@keyframes spinRing {
  from { transform: scale(1.15) rotate(0deg); }
  to   { transform: scale(1.15) rotate(360deg); }
}

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

/* ── Pulsing Dot ────────────────────────────────────────────── */
@keyframes pulse-dot {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
}

/* ── General Glow Pulse ─────────────────────────────────────── */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(28, 124, 255, 0.3); }
  50%       { box-shadow: 0 0 40px rgba(0, 229, 255, 0.6); }
}

/* ── Floating (for avatar and skill spheres) ────────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

/* ── Gradient Shift ─────────────────────────────────────────── */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Fade In ────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Slide Up ───────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Slide In Left ──────────────────────────────────────────── */
@keyframes slideLeft {
  from { opacity: 0; transform: translateX(-50px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Slide In Right ─────────────────────────────────────────── */
@keyframes slideRight {
  from { opacity: 0; transform: translateX(50px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Spin ───────────────────────────────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Scale In ───────────────────────────────────────────────── */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Shimmer ────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

/* ── Timeline Dot Pulse ─────────────────────────────────────── */
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.6); }
  50%       { box-shadow: 0 0 0 10px rgba(0, 229, 255, 0); }
}

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

/* ─────────────────────────────────────────────────────────────
   APPLIED ANIMATIONS & UTILITY CLASSES
───────────────────────────────────────────────────────────── */

/* Animated gradient text (hero name) */
.hero-name {
  background: linear-gradient(90deg, #1C7CFF, #00E5FF, #7F5AF0, #F80A4A, #00E5FF, #1C7CFF);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 5s linear infinite;
}

/* Section background gradient (animated) */
.section-bg-animated {
  background: linear-gradient(135deg, var(--color-bg), var(--color-bg-alt), var(--color-bg));
  background-size: 200% 200%;
  animation: gradientShift 10s ease infinite;
}

/* Glow effect on skill bars (after they animate in) */
.skill-bar__fill.animated {
  animation: glowPulse 2s ease-in-out infinite;
}

/* Timeline dot pulse */
.timeline-dot {
  animation: dotPulse 2s infinite;
}

/* Resume preview card float */
.resume-preview-card {
  animation: float 4s ease-in-out infinite;
}

/* Hero badge dot */
.hero-badge__dot {
  animation: pulse-dot 2s infinite;
}

/* Avatar ring rotation — applied inline in main.css but reinforced */
.about-avatar-ring--1 { animation: spinRing 12s linear infinite !important; }
.about-avatar-ring--2 { animation: spinRing 18s linear infinite reverse !important; }

/* Keyframe for skill bar entry */
@keyframes skillFillIn {
  from { width: 0; }
  to   { width: var(--target-width, 0%); }
}

/* ─────────────────────────────────────────────────────────────
   SCROLL-TRIGGERED REVEAL (handled via JS IntersectionObserver)
   CSS definitions for states
───────────────────────────────────────────────────────────── */

/* Staggered children in grid */
.skills-grid .skill-card:nth-child(1)  { --delay: 0.00s; }
.skills-grid .skill-card:nth-child(2)  { --delay: 0.05s; }
.skills-grid .skill-card:nth-child(3)  { --delay: 0.10s; }
.skills-grid .skill-card:nth-child(4)  { --delay: 0.15s; }
.skills-grid .skill-card:nth-child(5)  { --delay: 0.20s; }
.skills-grid .skill-card:nth-child(6)  { --delay: 0.25s; }

.timeline-item:nth-child(1) { --delay: 0.0s; }
.timeline-item:nth-child(2) { --delay: 0.1s; }
.timeline-item:nth-child(3) { --delay: 0.2s; }
.timeline-item:nth-child(4) { --delay: 0.3s; }

/* ─────────────────────────────────────────────────────────────
   3D TILT on hover (applied via JS VanillaTilt-style)
───────────────────────────────────────────────────────────── */
.tilt-card {
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
  transition: transform 0.1s ease-out, box-shadow 0.2s ease;
  will-change: transform;
}

/* ─────────────────────────────────────────────────────────────
   PAGE TRANSITION HELPER
───────────────────────────────────────────────────────────── */
.page-enter {
  animation: fadeIn 0.6s var(--ease-out) both;
}

/* ─────────────────────────────────────────────────────────────
   SHIMMER SKELETON (for lazy-load placeholders)
───────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--glass-bg) 25%,
    rgba(255,255,255,0.12) 50%,
    var(--glass-bg) 75%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
  border-radius: var(--radius-md);
}

/* ─────────────────────────────────────────────────────────────
   SECTION DIVIDER (optional wave)
───────────────────────────────────────────────────────────── */
.section-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  transform: rotate(180deg);
}

.section-wave svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px);
  height: 48px;
}

/* ─────────────────────────────────────────────────────────────
   PARTICLE CANVAS (Hero background)
───────────────────────────────────────────────────────────── */
#heroCanvas {
  opacity: 0;
  transition: opacity 1s ease;
}

#heroCanvas.ready {
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   LOADING OVERLAY FADE
───────────────────────────────────────────────────────────── */
.loader-overlay {
  animation: none; /* controlled via JS */
}

.loader-overlay.fade-out {
  animation: fadeIn 0.5s ease reverse both;
}

/* ─────────────────────────────────────────────────────────────
   NAVBAR SCROLL SHADOW
───────────────────────────────────────────────────────────── */
.site-navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-blue), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.site-navbar.scrolled::after {
  opacity: 0.4;
}

/* ─────────────────────────────────────────────────────────────
   ACTIVE NAV INDICATOR
───────────────────────────────────────────────────────────── */
.nav-item.active .nav-icon-btn {
  position: relative;
}

.nav-item.active .nav-icon-btn::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--color-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-cyan);
}

/* ─────────────────────────────────────────────────────────────
   CARD HOVER 3D DEPTH
───────────────────────────────────────────────────────────── */
.glass-card {
  transition:
    transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
}

.glass-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(0, 229, 255, 0.2);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(28, 124, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   BUTTON HOVER RING GLOW
───────────────────────────────────────────────────────────── */
.scroll-top-btn:focus-visible {
  ring: 2px solid var(--color-cyan);
  outline-offset: 3px;
}

/* ─────────────────────────────────────────────────────────────
   TOOLTIP ANIMATION (enhanced — for nav tooltips)
───────────────────────────────────────────────────────────── */
.group:hover span.scale-0 {
  animation: scaleIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ─────────────────────────────────────────────────────────────
   SECTION HEADER TAG GLOW
───────────────────────────────────────────────────────────── */
.section-tag {
  animation: glowPulse 3s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────────────────
   CONTACT FORM STATUS ANIMATION
───────────────────────────────────────────────────────────── */
.contact-status.success {
  animation: slideUp 0.4s var(--ease-bounce) both;
}

.contact-status.error {
  animation: slideUp 0.4s var(--ease-bounce) both;
}

/* ─────────────────────────────────────────────────────────────
   MODAL ANIMATION (handled by lb-img transition in main.css)
───────────────────────────────────────────────────────────── */
.lb-overlay.open .lb-content {
  animation: scaleIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE MOTION REDUCTION CHECK
───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-orb,
  .loader,
  .loader::before,
  .loader::after,
  .about-avatar-ring--1,
  .about-avatar-ring--2,
  .about-float-badge,
  .resume-preview-card,
  .scroll-indicator,
  .hero-badge__dot,
  .timeline-dot,
  .section-tag,
  .hero-name {
    animation: none !important;
    transition: none !important;
  }
}
