/* ==========================================================================
   ANIMATIONS.CSS - Micro animations for Andrew McPherson's website
   ========================================================================== */

/* Respect user preferences for reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   1. Base Animation Keyframes
   ========================================================================== */

/* Fade in */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade in up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade in right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pulse animation for buttons */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Logo animation */
@keyframes logoSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   2. Navigation & Buttons Animations
   ========================================================================== */

/* Navigation link hover effect */
.menu__link {
  position: relative;
  transition: color 0.3s ease;
}

.menu__link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: #303a4d;
  transition: width 0.3s ease;
}

.menu__link:hover {
  color: #303a4d;
}

.menu__link:hover::after {
  width: 100%;
}

/* Current page indicator */
.menu__item.active .menu__link::after,
.menu__link.active::after {
  width: 100%;
}

/* Button hover animations */
.button {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transition: left 0.3s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.button:hover::before {
  left: 100%;
}

/* Special animation for primary buttons */
.actions-header__button:hover,
.about__button:hover,
.outro__button:hover {
  transform: translateY(-2px) scale(1.03);
}

/* Click animation for buttons */
.button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   3. Page Transitions & Loading Animations
   ========================================================================== */

/* Body fade in on page load */
body {
  animation: fadeIn 0.5s ease-in-out;
}

/* Main content fade in */
.page {
  animation: fadeIn 0.8s ease-in-out;
}

/* Staggered section loading animations */
.page__main {
  opacity: 1;
  animation: fadeInDown 0.5s ease-out 0.1s both;
}

.page__about {
  opacity: 1;
  animation: fadeIn 0.5s ease-out 0.2s both;
}

.page__services {
  opacity: 1;
  animation: fadeIn 0.5s ease-out 0.3s both;
}

.page__testimonial {
  opacity: 1;
  animation: fadeIn 0.5s ease-out 0.4s both;
}

.page__outro {
  opacity: 1;
  animation: fadeIn 0.5s ease-out 0.5s both;
}

.footer {
  opacity: 1;
  animation: fadeIn 0.5s ease-out 0.6s both;
}

/* ==========================================================================
   4. Content Animations
   ========================================================================== */

/* Logo hover animation */
.logo {
  transition: all 0.3s ease;
}

.logo:hover {
  color: #4a5b77;
  transform: scale(1.05);
}

/* Animated logo on page load */
.header__logo {
  position: relative;
  animation: fadeInLeft 0.5s ease-out;
}

/* Service items hover effect */
.item-services {
  opacity: 1;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.item-services:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

/* Image hover effect */
.item-services__image img,
.about__image img,
.services-page__img img {
  transition: transform 0.5s ease;
}

.item-services__image:hover img,
.about__image:hover img,
.services-page__img:hover img {
  transform: scale(1.03);
}

/* Testimonial hover effect */
.testimonial__item {
  transition: transform 0.3s ease;
}

.testimonial__item:hover {
  transform: translateY(-3px);
}

/* ==========================================================================
   5. Viewport-triggered Animations (will work with JS)
   ========================================================================== */

/* Elements that will animate when they enter the viewport */
.animate-on-scroll {
  opacity: 1;
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.animate-on-scroll.animated {
  animation: fadeInUp 0.5s ease-out forwards;
}

/* Staggered children animations */
.stagger-children > * {
  opacity: 1;
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.stagger-children.animated > *:nth-child(1) {
  animation: fadeInUp 0.3s ease-out 0.1s forwards;
}

.stagger-children.animated > *:nth-child(2) {
  animation: fadeInUp 0.3s ease-out 0.2s forwards;
}

.stagger-children.animated > *:nth-child(3) {
  animation: fadeInUp 0.3s ease-out 0.3s forwards;
}

.stagger-children.animated > *:nth-child(4) {
  animation: fadeInUp 0.3s ease-out 0.4s forwards;
}

.stagger-children.animated > *:nth-child(5) {
  animation: fadeInUp 0.3s ease-out 0.5s forwards;
}

/* ==========================================================================
   6. Form Animations
   ========================================================================== */

/* Form input focus animation */
input, textarea {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, textarea:focus {
  border-color: #303a4d;
  box-shadow: 0 0 0 3px rgba(48, 58, 77, 0.1);
  outline: none;
}

/* Form submit button */
.form__submit {
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.form__submit:hover {
  background-color: #4a5b77;
  transform: translateY(-2px);
}

/* ==========================================================================
   7. Mobile Menu Animation
   ========================================================================== */

.icon-menu span, 
.icon-menu::before, 
.icon-menu::after {
  transition: all 0.3s ease;
}

/* Smoother mobile menu transition */
.menu__body {
  transition: left 0.3s ease;
}

.menu__body::before {
  transition: left 0.3s ease;
}

/* ==========================================================================
   8. Utility Classes
   ========================================================================== */

/* Use these utility classes to add animations to elements */
.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.fade-in-up {
  animation: fadeInUp 0.5s ease-out forwards;
}

.fade-in-down {
  animation: fadeInDown 0.5s ease-out forwards;
}

.fade-in-left {
  animation: fadeInLeft 0.5s ease-out forwards;
}

.fade-in-right {
  animation: fadeInRight 0.5s ease-out forwards;
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Pulse animation for important buttons */
.pulse {
  animation: pulse 2s infinite;
} 