/* ═══ ADVANCED ANIMATIONS ═══ */

/* Counter Animation */
.stat-number {
  font-variant-numeric: tabular-nums;
}

/* Timeline item animations */
.timeline-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.in-view {
  opacity: 1;
  transform: translateY(0);
}

.timeline-dot {
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(230, 0, 39, 0.7);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 0 6px rgba(230, 0, 39, 0);
  }
}

/* Card hover effects */
.cert-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.cert-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.cert-card:hover {
  animation: cardShake 0.5s ease-in-out;
}

@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Skill tags staggered animation */
.skill-tag {
  animation: tagFadeIn 0.5s ease forwards;
}

.skill-tag:nth-child(1) { animation-delay: 0.05s; }
.skill-tag:nth-child(2) { animation-delay: 0.1s; }
.skill-tag:nth-child(3) { animation-delay: 0.15s; }
.skill-tag:nth-child(4) { animation-delay: 0.2s; }
.skill-tag:nth-child(5) { animation-delay: 0.25s; }
.skill-tag:nth-child(6) { animation-delay: 0.3s; }
.skill-tag:nth-child(7) { animation-delay: 0.35s; }
.skill-tag:nth-child(8) { animation-delay: 0.4s; }

@keyframes tagFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Hover effect removed - defined in sections.css */

@keyframes tagBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ═══ TECH STACK STYLES ═══ */
.tech-stack-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(300px,1fr));
  gap:20px;
}

.tech-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:8px;
  padding:24px;
  transition:var(--t);
  display:flex;
  flex-direction:column;
  gap:16px;
}

.tech-card:hover{
  border-color:var(--accent);
  box-shadow:0 8px 24px rgba(230,0,39,.12);
  transform:translateY(-4px);
}

.tech-card-header h4{
  font-size:15px;
  font-weight:600;
  color:var(--dark);
  margin:0;
}

.tech-tools{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.tech-badge{
  display:inline-block;
  font-size:12px;
  font-weight:500;
  padding:6px 12px;
  background:linear-gradient(135deg,rgba(230,0,39,.05),rgba(230,0,39,.02));
  border:1px solid rgba(230,0,39,.15);
  border-radius:20px;
  color:var(--text);
  transition:var(--t);
  cursor:default;
  white-space:nowrap;
}

.tech-badge:hover{
  background:linear-gradient(135deg,rgba(230,0,39,.1),rgba(230,0,39,.05));
  border-color:var(--accent);
  color:var(--accent);
  transform:scale(1.02);
}

/* Form input focus animation */
.form-control {
  transition: all 0.3s ease;
}

.form-control:focus {
  animation: inputGlow 0.4s ease;
}

@keyframes inputGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(230, 0, 39, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(230, 0, 39, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(230, 0, 39, 0);
  }
}

/* Button ripple effect */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Loading animation para submit button */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn:disabled::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Highlight card border animation */
.highlight-card {
  position: relative;
  border-left: 3px solid var(--accent);
  transition: all 0.3s ease;
}

.highlight-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(230, 0, 39, 0.05), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.highlight-card:hover {
  box-shadow: 0 8px 24px rgba(230, 0, 39, 0.15);
  transform: translateX(4px);
}

.highlight-card:hover::before {
  opacity: 1;
}

/* SVG icon animations */
svg {
  transition: transform 0.3s ease, fill 0.3s ease, stroke 0.3s ease;
}

.btn:hover svg {
  transform: translateY(-2px);
}

/* Smooth transition para nav */
nav {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Media query para desactivar animaciones en dispositivos lentos */
@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;
  }
}
