/* ============================================================
   css/animations.css
   Keyframes, scroll-reveal, hover transitions, and
   all motion effects. Respects prefers-reduced-motion.
============================================================ */

/* ── 1. KEYFRAMES ── */

/* Pulse — availability dot in hero card */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

/* Fade up — generic entrance */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in — simple opacity entrance */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide in from left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Blink — terminal cursor */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Gradient shift — accent text shimmer */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Float — subtle up/down on hero card */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Glow pulse — timeline dot */
@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 0 8px var(--accent);
  }
  50% {
    box-shadow:
      0 0 20px var(--accent),
      0 0 40px rgba(108, 99, 255, 0.3);
  }
}

/* ── 2. SCROLL REVEAL ── */

/* Initial hidden state — applied via JS to all .reveal elements */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.65s ease,
    transform 0.65s ease;
}

.reveal.reveal--left {
  transform: translateX(-28px);
}

.reveal.reveal--right {
  transform: translateX(28px);
}

/* Visible state — toggled by IntersectionObserver in main.js */
.reveal.visible {
  opacity: 1;
  transform: translate(0, 0);
}

/* Staggered children — each child delays by 100ms more */
.reveal-stagger > *:nth-child(1) {
  transition-delay: 0.05s;
}
.reveal-stagger > *:nth-child(2) {
  transition-delay: 0.15s;
}
.reveal-stagger > *:nth-child(3) {
  transition-delay: 0.25s;
}
.reveal-stagger > *:nth-child(4) {
  transition-delay: 0.35s;
}
.reveal-stagger > *:nth-child(5) {
  transition-delay: 0.45s;
}
.reveal-stagger > *:nth-child(6) {
  transition-delay: 0.55s;
}

/* ── 3. HERO ENTRANCE ── */

.hero-left {
  animation: fadeUp 0.8s ease both;
  animation-delay: 0.2s;
}

.hero-right {
  animation: slideInRight 0.8s ease both;
  animation-delay: 0.4s;
}

/* ── 4. AVAILABILITY DOT ── */
.availability-dot {
  animation: pulse 1.6s ease-in-out infinite;
}

/* ── 5. HERO CARD FLOAT ── */
.hero-card {
  animation: float 5s ease-in-out infinite;
  animation-delay: 1s;
}

/* ── 6. TIMELINE DOT GLOW ── */
.tl-dot {
  animation: glowPulse 2.5s ease-in-out infinite;
}

.tl-dot--cyan {
  animation: none;
  box-shadow: 0 0 12px var(--accent2);
}

/* ── 7. NAVBAR ENTRANCE ── */
#navbar {
  animation: fadeIn 0.5s ease both;
}

/* ── 8. SECTION TAG SHIMMER ── */
.section-tag {
  background: linear-gradient(
    90deg,
    var(--accent),
    var(--accent2),
    var(--accent)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s linear infinite;
}

/* ── 9. TERMINAL CURSOR ── */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent2);
  margin-left: 3px;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}

/* ── 10. SKILL TAG HOVER ── */
.skill-tag {
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.skill-tag:hover {
  background: rgba(108, 99, 255, 0.12);
  border-color: rgba(108, 99, 255, 0.4);
  color: var(--accent);
}

/* ── 11. NAV LINK ACTIVE INDICATOR ── */
.nav-link.active {
  color: var(--accent2);
}

/* ── 12. FORM INPUT FOCUS ANIMATION ── */
.form-group input,
.form-group textarea {
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  background: rgba(108, 99, 255, 0.04);
}

/* ── 13. BUTTON RIPPLE EFFECT ── */
.btn-primary,
.btn-secondary,
.form-btn {
  position: relative;
  overflow: hidden;
}

.btn-primary::after,
.btn-secondary::after,
.form-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn-primary:hover::after,
.btn-secondary:hover::after,
.form-btn:hover::after {
  opacity: 1;
}

/* ── 14. HAMBURGER MENU ANIMATION (MOBILE) ── */
.nav-toggle[aria-expanded='true'] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle[aria-expanded='true'] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── 15. PREFERS REDUCED MOTION ── */
/* Respects OS-level accessibility setting — disables all motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .hero-card {
    animation: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none;
  }
}