/* ==========================================================================
   Python Animation Learning — Keyframe Animations
   ========================================================================== */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-18px) rotate(3deg); }
}

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

@keyframes floatBlobA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(60px, 40px) scale(1.08); }
  66%      { transform: translate(-30px, 70px) scale(0.94); }
}

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

@keyframes floatBlobC {
  0%, 100% { transform: translate(-50%, 0) scale(1); }
  50%      { transform: translate(-50%, -60px) scale(1.12); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(1.4); }
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

@keyframes scrollDot {
  0%   { top: 6px; opacity: 1; }
  70%  { top: 20px; opacity: 0; }
  100% { top: 6px; opacity: 0; }
}

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

.scroll-indicator {
  animation: fadeUp 0.9s ease 0.7s forwards, bounceDown 2.2s ease-in-out 1.6s infinite;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Placeholder page ambient animation (shared with lesson pages) */
@keyframes softGlow {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.9; }
}

@keyframes drift {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(24px, -30px); }
  100% { transform: translate(0, 0); }
}

/* ==========================================================================
   Topic icon animations — every card's icon keeps animating at rest,
   each style picked to echo what its topic actually does.
   ========================================================================== */

/* Loops, iterators, type-casting, modules — things that cycle */
@keyframes iconSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.icon-anim-spin svg { animation: iconSpin 5s linear infinite; }

/* Introduction, operators, match-case — a value pulsing/evaluating */
@keyframes iconPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.16); }
}
.icon-anim-pulse svg { animation: iconPulse 2.1s ease-in-out infinite; }

/* Variables, functions — something being assigned/returned, a soft bob */
@keyframes iconBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.icon-anim-bounce svg { animation: iconBounce 1.8s ease-in-out infinite; }

/* Strings, input/output — a blinking cursor/typing rhythm */
@keyframes iconBlink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}
.icon-anim-blink svg { animation: iconBlink 1.3s steps(1) infinite; }

/* Tuples, lambda, decorators — a gentle side-to-side swing (wrapping/locking) */
@keyframes iconSwing {
  0%, 100% { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
}
.icon-anim-swing svg { animation: iconSwing 2.4s ease-in-out infinite; }

/* Exception handling, generators — an alert/spark flicker */
@keyframes iconFlicker {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 0 transparent); }
  45%      { opacity: 0.5; }
  50%      { opacity: 1; filter: drop-shadow(0 0 6px currentColor); }
  55%      { opacity: 0.7; }
}
.icon-anim-flicker svg { animation: iconFlicker 2.6s ease-in-out infinite; }

/* Lists, dictionaries, data-types, file-handling — items shifting/settling */
@keyframes iconSlide {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(3px); }
}
.icon-anim-slide svg { animation: iconSlide 1.9s ease-in-out infinite; }

/* Staggered multi-part icons: each child shape breathes on its own delay so
   the whole glyph animates like the concept it represents (nested calls,
   a lit-up grid of classes, linked branch nodes, overlapping sets). */
@keyframes iconPartPulse {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50%      { opacity: 1; transform: scale(1.05); }
}

.icon-anim-stagger svg > rect,
.icon-anim-stagger svg > circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: iconPartPulse 1.8s ease-in-out infinite;
}

.icon-anim-stagger svg > rect:nth-child(1),
.icon-anim-stagger svg > circle:nth-child(1) { animation-delay: 0s; }
.icon-anim-stagger svg > rect:nth-child(2),
.icon-anim-stagger svg > circle:nth-child(2) { animation-delay: 0.25s; }
.icon-anim-stagger svg > rect:nth-child(3),
.icon-anim-stagger svg > circle:nth-child(3) { animation-delay: 0.5s; }
.icon-anim-stagger svg > rect:nth-child(4),
.icon-anim-stagger svg > circle:nth-child(4) { animation-delay: 0.75s; }

/* Respect reduced motion preference across the whole project */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
