/*
 * Evolvance — Animations
 * Keyframes, skeleton loading, stagger reveals, number counter
 */

/* ── Section reveal (stagger-in) ────────────────────────── */
.section-enter {
  animation: sectionIn var(--t-slow) ease both;
}
.section-enter-stagger > * {
  opacity: 0;
  animation: cardIn 0.5s ease both;
}
.section-enter-stagger > *:nth-child(1) { animation-delay:  60ms; }
.section-enter-stagger > *:nth-child(2) { animation-delay: 120ms; }
.section-enter-stagger > *:nth-child(3) { animation-delay: 180ms; }
.section-enter-stagger > *:nth-child(4) { animation-delay: 240ms; }
.section-enter-stagger > *:nth-child(5) { animation-delay: 300ms; }
.section-enter-stagger > *:nth-child(6) { animation-delay: 360ms; }
.section-enter-stagger > *:nth-child(n+7) { animation-delay: 400ms; }

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Fade in ────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fade-in { animation: fadeIn var(--t-normal) ease both; }

/* ── Slide up ───────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.slide-up { animation: slideUp var(--t-normal) ease both; }

/* ── Scale in ───────────────────────────────────────────── */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
.scale-in { animation: scaleIn var(--t-normal) ease both; }

/* ── Shake (error state) ─────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}
.shake { animation: shake 0.5s ease; }

/* ── Pulse ───────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.pulse { animation: pulse 2s ease-in-out infinite; }
.pulse-fast { animation: pulse 1s ease-in-out infinite; }

/* ── Glow ring (active code) ─────────────────────────────── */
@keyframes glowRing {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(20,184,166,0.4)); }
  50%       { filter: drop-shadow(0 0 14px rgba(15,118,110,0.6)); }
}
.glow-ring { animation: glowRing 2.5s ease-in-out infinite; }

/* ── Spin ────────────────────────────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spin { animation: spin 0.8s linear infinite; }

/* ── Shimmer (gradient sweep) ────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 25%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.04) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
  display: block;
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Skeleton shape helpers */
.sk-line    { height: 14px; border-radius: 7px; margin-bottom: 8px; }
.sk-line.sm { height: 10px; }
.sk-line.lg { height: 20px; }
.sk-circle  { border-radius: 50%; }
.sk-card    { height: 120px; border-radius: var(--r-lg); }

/* ── Number counter ──────────────────────────────────────── */
/* JS companion — called via animateCount(el, target) */
.count-target { display: inline-block; }

/* ── Button press feedback ───────────────────────────────── */
@keyframes btnPress {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}
.btn-press { animation: btnPress 0.18s ease; }

/* ── Toast slide-in ─────────────────────────────────────── */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast { animation: toastIn 0.25s ease both; }

/* ── Section visibility ──────────────────────────────────── */
.section { display: none; }
.section.active {
  display: block;
  animation: sectionIn 0.28s ease both;
}

/* ── Smooth height for accordion ─────────────────────────── */
.accordion-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease;
  opacity: 0;
}
.accordion-body.open {
  max-height: 600px;
  opacity: 1;
}

/* ── Float animation (decorative elements) ───────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.float { animation: float 4s ease-in-out infinite; }

/* ── Gradient text shimmer (code display) ────────────────── */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.gradient-text-animate {
  background: linear-gradient(135deg, #0F766E, #14B8A6, #86EFAC, #0F766E);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 4s ease infinite;
}
