/* ============================================================
   ANIMATIONS — Transiciones, fade-up, hover, glow
   ============================================================ */

/* ── Fade-up al scroll ───────────────────────────────────── */

.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow) ease,
              transform var(--transition-slow) ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay para listas de elementos */
.fade-up:nth-child(1) { transition-delay: 0ms; }
.fade-up:nth-child(2) { transition-delay: 60ms; }
.fade-up:nth-child(3) { transition-delay: 120ms; }
.fade-up:nth-child(4) { transition-delay: 180ms; }
.fade-up:nth-child(5) { transition-delay: 240ms; }
.fade-up:nth-child(6) { transition-delay: 300ms; }

/* ── Glow pulsante en el acento ──────────────────────────── */

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.25); }
  50%       { box-shadow: 0 0 28px rgba(59, 130, 246, 0.45); }
}

.glow-pulse {
  animation: glowPulse 2.5s ease-in-out infinite;
}

/* ── Dot de disponibilidad parpadeante ───────────────────── */

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.availability-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--success);
  animation: blink 2s ease-in-out infinite;
  flex-shrink: 0;
}

/* ── Skill bar fill ──────────────────────────────────────── */

.skill-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: var(--radius-full);
  transition: width 900ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.35);
}

/* ── Hover lift en cards ─────────────────────────────────── */

.card-hover {
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-accent);
  border-color: var(--accent-border);
}

/* ══════════════════════════════════════════════════════════
   PORTFOLIO — Animated project images
   ══════════════════════════════════════════════════════════ */

/* ── Base container ──────────────────────────────────────── */

.project-anim {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  position: relative;
}

.project-anim svg {
  width: 100%;
  height: 100%;
}

/* ── Bar chart (Dashboard Riesgo) ────────────────────────── */

.project-anim--bars {
  background: linear-gradient(135deg, #060f1c 0%, #0d1b2e 50%, #0f2040 100%);
}

@keyframes barGrow1 {
  0%   { height: 0; y: 50; }
  100% { height: 28px; y: 22; }
}
@keyframes barGrow2 {
  0%   { height: 0; y: 50; }
  100% { height: 18px; y: 32; }
}
@keyframes barGrow3 {
  0%   { height: 0; y: 50; }
  100% { height: 36px; y: 14; }
}
@keyframes barGrow4 {
  0%   { height: 0; y: 50; }
  100% { height: 22px; y: 28; }
}
@keyframes barGrow5 {
  0%   { height: 0; y: 50; }
  100% { height: 30px; y: 20; }
}

.anim-bar {
  fill: var(--accent);
  opacity: 0.75;
  transform-origin: bottom;
}
.anim-bar-1 { fill: #00D4FF; opacity: 0.8; animation: barGrow1 1.2s cubic-bezier(0.4,0,0.2,1) 0.3s both infinite alternate; }
.anim-bar-2 { fill: #3B82F6; opacity: 0.7; animation: barGrow2 1.2s cubic-bezier(0.4,0,0.2,1) 0.5s both infinite alternate; }
.anim-bar-3 { fill: #00D4FF; opacity: 0.9; animation: barGrow3 1.2s cubic-bezier(0.4,0,0.2,1) 0.4s both infinite alternate; }
.anim-bar-4 { fill: #3B82F6; opacity: 0.6; animation: barGrow4 1.2s cubic-bezier(0.4,0,0.2,1) 0.6s both infinite alternate; }
.anim-bar-5 { fill: #00D4FF; opacity: 0.75; animation: barGrow5 1.2s cubic-bezier(0.4,0,0.2,1) 0.35s both infinite alternate; }

/* ── Credit limit gauge (Aumento de Límite) ─────────────── */

.project-anim--gauge {
  background: linear-gradient(135deg, #0a0a18 0%, #10102a 50%, #161630 100%);
}

@keyframes progressFill {
  0%   { width: 0; }
  60%  { width: 55px; }
  80%  { width: 52px; }
  100% { width: 55px; }
}
@keyframes checkAppear {
  0%, 60%  { opacity: 0; transform: scale(0.5); }
  80%      { opacity: 1; transform: scale(1.15); }
  100%     { opacity: 1; transform: scale(1); }
}

.anim-progress-bar {
  animation: progressFill 2.8s cubic-bezier(0.4,0,0.2,1) 0.5s both infinite;
  fill: rgba(129,140,248,0.8);
}
.anim-check-circle,
.anim-checkmark {
  animation: checkAppear 2.8s ease-out 0.5s both infinite;
  transform-origin: 94px 49px;
}

/* ── Vintage line chart (Cosechas) ───────────────────────── */

.project-anim--vintage {
  background: linear-gradient(135deg, #050d10 0%, #0a1a1a 50%, #0d2020 100%);
}

@keyframes drawLine {
  0%   { stroke-dashoffset: 200; opacity: 0; }
  20%  { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

.anim-line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
}
.anim-line-1 { animation: drawLine 2.0s ease-out 0.4s both infinite; }
.anim-line-2 { animation: drawLine 2.0s ease-out 0.8s both infinite; }
.anim-line-3 { animation: drawLine 2.0s ease-out 1.2s both infinite; }

/* ── Data table (Maestro Originación) ───────────────────── */

.project-anim--table {
  background: linear-gradient(135deg, #060e12 0%, #0a151c 50%, #0d1e28 100%);
}

/* Scan line sweeps down row by row (7 rows × 7px = 42px travel) */
@keyframes scanRows {
  0%   { transform: translateY(0px);  opacity: 0;   }
  4%   { opacity: 1; }
  88%  { transform: translateY(42px); opacity: 0.8; }
  95%  { transform: translateY(42px); opacity: 0;   }
  96%  { transform: translateY(0px);  opacity: 0;   }
  100% { transform: translateY(0px);  opacity: 0;   }
}

.anim-scan {
  animation: scanRows 2.8s ease-in-out infinite;
}

/* ── SAFPRO data flow ────────────────────────────────────── */

.project-anim--safpro {
  background: linear-gradient(135deg, #040c10 0%, #091418 50%, #0e1c24 100%);
}

@keyframes flowLine {
  0%   { stroke-dashoffset: 40; }
  100% { stroke-dashoffset: 0; }
}
@keyframes catAppear {
  0%, 20%   { opacity: 0; transform: translateX(-6px); }
  60%, 100% { opacity: 1; transform: translateX(0); }
}
@keyframes pulseRing {
  0%, 100% { r: 3; opacity: 0.4; }
  50%       { r: 5; opacity: 0.9; }
}

.anim-flow-line {
  stroke-dasharray: 8 4;
  animation: flowLine 1s linear infinite;
}
.anim-flow-arrow { animation: cellPulse 1.2s ease-in-out infinite; }
.anim-cat-1 { animation: catAppear 2.6s ease-out 0.8s both infinite; }
.anim-cat-2 { animation: catAppear 2.6s ease-out 1.1s both infinite; }
.anim-cat-3 { animation: catAppear 2.6s ease-out 1.4s both infinite; }
.anim-cat-4 { animation: catAppear 2.6s ease-out 1.7s both infinite; }
.anim-pulse-ring { animation: pulseRing 1.5s ease-in-out 0.5s infinite; }

/* ══════════════════════════════════════════════════════════
   PORTFOLIO — Segment labels & freelance pitch
   ══════════════════════════════════════════════════════════ */

.portfolio-segment-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-6);
}

.portfolio-freelance-pitch {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-0);
  position: relative;
  overflow: hidden;
}

.portfolio-freelance-pitch::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.pitch-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.pitch-body {
  flex: 1;
}

.pitch-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  font-family: var(--font-heading);
}

.pitch-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.pitch-cta {
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
}

/* ── Pitch mobile ────────────────────────────────────────── */

@media (max-width: 767px) {
  .portfolio-freelance-pitch {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .pitch-icon {
    flex-shrink: 0;
  }

  .pitch-body {
    flex: 1 1 calc(100% - 56px); /* ocupa el ancho restante junto al icon */
    min-width: 0;
  }

  .pitch-cta {
    flex: 1 1 100%;  /* baja a su propia fila, full width */
    white-space: normal;
    text-align: center;
    justify-content: center;
  }
}

/* ── FPD/SPD/NVP timeline (Motor de Mora) ────────────────── */

.project-anim--fpd {
  background: linear-gradient(135deg, #080d10 0%, #0d1518 50%, #0f1c20 100%);
}

@keyframes badgeAppear {
  0%, 10%   { opacity: 0; transform: translateY(-4px); }
  40%, 100% { opacity: 1; transform: translateY(0); }
}
@keyframes dotPulse {
  0%, 100% { r: 3; opacity: 0.6; }
  50%       { r: 4.5; opacity: 1; }
}

.anim-fpd-badge { animation: badgeAppear 3s ease-out 0.4s both infinite; }
.anim-spd-badge { animation: badgeAppear 3s ease-out 1.0s both infinite; }
.anim-nvp-badge { animation: badgeAppear 3s ease-out 1.6s both infinite; }
.anim-dot-fpd   { animation: dotPulse 2s ease-in-out 0.6s infinite; }
.anim-dot-spd   { animation: dotPulse 2s ease-in-out 1.2s infinite; }
.anim-dot-nvp   { animation: dotPulse 2s ease-in-out 1.8s infinite; }
