/* ===== Keyframes ===== */

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

@keyframes tagSlideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40%  { transform: translateY(-10px); }
  60%  { transform: translateY(-5px); }
}

/* ===== Header animations ===== */

#avatar img {
  animation: fadeIn 1s ease-out;
}

#about-me .subtitle,
#about-me h1,
#about-me .text-sm {
  opacity: 0;
  animation: fadeIn 1s ease-out forwards;
}

#about-me .subtitle { animation-delay: 0.3s; }
#about-me h1        { animation-delay: 0.6s; }
#about-me .text-sm  { animation-delay: 0.9s; }

#tags .tag {
  opacity: 0;
  animation: tagSlideIn 0.5s ease-out forwards;
}

#tags .tag:nth-child(1) { animation-delay: 1.2s; }
#tags .tag:nth-child(2) { animation-delay: 1.4s; }
#tags .tag:nth-child(3) { animation-delay: 1.6s; }
#tags .tag:nth-child(4) { animation-delay: 1.8s; }
#tags .tag:nth-child(5) { animation-delay: 2.0s; }
#tags .tag:nth-child(6) { animation-delay: 2.2s; }
#tags .tag:nth-child(7) { animation-delay: 2.4s; }
#tags .tag:nth-child(8) { animation-delay: 2.6s; }
#tags .tag:nth-child(9) { animation-delay: 2.8s; }
#tags .tag:nth-child(10){ animation-delay: 3.0s; }

.arrow {
  opacity: 0;
  animation: fadeIn 1s ease-out forwards;
  animation-delay: 2.8s;
}

.arrow img {
  animation: bounce 2s infinite;
}

/* ===== Tag hover ===== */

.tag {
  transition: transform 0.3s ease, background-color 0.3s ease;

  &:hover {
    transform: translateY(-3px);
    background-color: var(--base-gray-200);
  }
}

/* ===== Service cards ===== */

.card {
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(227, 100, 110, 0.1), transparent);
    transition: left 0.5s ease;
  }

  &:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--principal-red);
    box-shadow: 0 5px 15px rgba(227, 100, 110, 0.2);

    &::before { left: 100%; }

    img { transform: scale(1.1) rotate(5deg); }
  }

  img {
    transition: transform 0.4s ease;
  }
}

#services .card {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.5s ease, transform 0.5s ease;

  &.animate-card {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Contact links ===== */

.link {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;

  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--principal-blue);
    transition: width 0.3s ease;
  }

  &:hover {
    transform: translateX(8px);
    box-shadow: 0 2px 8px rgba(57, 150, 219, 0.2);

    &::after { width: 100%; }

    img:nth-child(1) { transform: scale(1.1); }
    img:nth-child(3) { transform: translate(3px, -3px); }
  }

  img:nth-child(1),
  img:nth-child(3) {
    transition: transform 0.3s ease;
  }
}

/* ===== Project cards ===== */

#projects .project-card {
  opacity: 0;
  transform: translateY(30px);
  outline: 1px solid transparent;
  transition: opacity 0.6s ease-out, transform 0.6s ease-out, outline 0.4s ease;

  &.animate-project-card {
    opacity: 1;
    transform: translateY(0);

    &:hover {
      transform: translateY(-10px);
      outline: 1px solid var(--principal-red);
    }
  }
}