/* Mobile Animation Optimizations for Sharif Education Site */

/* Performance-first mobile animations */
@media (max-width: 768px) {
  /* Reduce animation complexity on mobile */
  .hero__text h1 {
    animation-duration: 0.6s;
    animation-delay: 0.1s;
  }
  
  .hero__text p {
    animation-duration: 0.5s;
    animation-delay: 0.2s;
  }
  
  .hero__actions {
    animation-duration: 0.5s;
    animation-delay: 0.3s;
  }
  
  .hero__actions .btn {
    animation-duration: 0.4s;
  }
  
  .hero__actions .btn:nth-child(1) { animation-delay: 0.4s; }
  .hero__actions .btn:nth-child(2) { animation-delay: 0.5s; }
  .hero__actions .btn:nth-child(3) { animation-delay: 0.6s; }
  
  .hero__image {
    animation-duration: 0.6s;
    animation-delay: 0.2s;
  }
  
  /* Simplified card animations */
  .card:hover {
    transform: translateY(-4px) scale(1.01);
    transition-duration: 0.2s;
  }
  
  .card::before {
    transition-duration: 0.2s;
  }
  
  /* Simplified button animations */
  .btn:hover {
    transform: translateY(-2px) scale(1.01);
    transition-duration: 0.2s;
  }
  
  .btn::before {
    transition-duration: 0.3s;
  }
  
  /* Reduce parallax intensity on mobile */
  .parallax {
    transform: none !important;
  }
  
  /* Optimize service box animations */
  .service-box {
    animation-duration: 0.4s;
  }
  
  .service-box:nth-child(1) { animation-delay: 0.05s; }
  .service-box:nth-child(2) { animation-delay: 0.1s; }
  .service-box:nth-child(3) { animation-delay: 0.15s; }
  .service-box:nth-child(4) { animation-delay: 0.2s; }
  
  .service-box:hover .service-box__icon {
    transform: scale(1.05) rotate(5deg);
  }
  
  /* Optimize section header animations */
  .section__header {
    animation-duration: 0.4s;
  }
  
  .section__header h2::after {
    transition-duration: 0.3s;
  }
  
  /* Optimize stats animations */
  .stat {
    animation-duration: 0.4s;
  }
  
  .stat:nth-child(1) { animation-delay: 0.05s; }
  .stat:nth-child(2) { animation-delay: 0.1s; }
  .stat:nth-child(3) { animation-delay: 0.15s; }
  .stat:nth-child(4) { animation-delay: 0.2s; }
  
  .stat:hover {
    transform: scale(1.02);
  }
  
  /* Optimize form animations */
  .contact__form input:focus,
  .contact__form textarea:focus {
    transform: scale(1.01);
    transition-duration: 0.2s;
  }
  
  /* Optimize mobile menu animations */
  .mobile-menu-btn {
    transition-duration: 0.2s;
  }
  
  .hamburger-line {
    transition-duration: 0.2s;
  }
  
  .nav a {
    transition-duration: 0.2s;
  }
  
  .nav a::before {
    transition-duration: 0.2s;
  }
  
  /* Optimize footer animations */
  .footer__content {
    animation-duration: 0.4s;
    animation-delay: 0.1s;
  }
  
  /* Optimize sticky button */
  .sticky {
    animation-duration: 0.4s;
    animation-delay: 0.5s;
  }
  
  .sticky .btn {
    /* Animation removed for better UX */
  }
}

/* Ultra-small mobile devices */
@media (max-width: 480px) {
  /* Further reduce animations for very small screens */
  .hero__text h1 {
    animation-duration: 0.4s;
    animation-delay: 0.05s;
  }
  
  .hero__text p {
    animation-duration: 0.3s;
    animation-delay: 0.1s;
  }
  
  .hero__actions {
    animation-duration: 0.3s;
    animation-delay: 0.15s;
  }
  
  .hero__actions .btn {
    animation-duration: 0.3s;
  }
  
  .hero__actions .btn:nth-child(1) { animation-delay: 0.2s; }
  .hero__actions .btn:nth-child(2) { animation-delay: 0.25s; }
  .hero__actions .btn:nth-child(3) { animation-delay: 0.3s; }
  
  .hero__image {
    animation-duration: 0.4s;
    animation-delay: 0.1s;
  }
  
  /* Minimal card hover effects */
  .card:hover {
    transform: translateY(-2px);
    transition-duration: 0.15s;
  }
  
  /* Minimal button hover effects */
  .btn:hover {
    transform: translateY(-1px);
    transition-duration: 0.15s;
  }
  
  /* Disable complex animations */
  .card::before {
    display: none;
  }
  
  .btn::before {
    display: none;
  }
  
  .service-box:hover .service-box__icon {
    animation: none;
    transform: scale(1.02);
  }
  
  .stat:hover {
    animation: none;
    transform: scale(1.01);
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover effects on touch devices */
  .card:hover {
    transform: none;
  }
  
  .btn:hover {
    transform: none;
  }
  
  .service-box:hover {
    transform: none;
  }
  
  .service-box:hover .service-box__icon {
    transform: none;
  }
  
  .stat:hover {
    transform: none;
  }
  
  /* Add touch feedback instead */
  .card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  .service-box:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .stat:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
}

/* Low-end device optimizations */
@media (max-width: 360px) {
  /* Disable most animations on very low-end devices */
  .hero__text h1,
  .hero__text p,
  .hero__actions,
  .hero__actions .btn,
  .hero__image,
  .section__header,
  .service-box,
  .stat,
  .footer__content,
  .sticky {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  
  /* Keep only essential transitions */
  .btn,
  .card,
  .nav a {
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  
  /* Disable complex effects */
  .card::before,
  .btn::before,
  .hero::before {
    display: none;
  }
}

/* Battery saving mode */
@media (prefers-reduced-motion: reduce) {
  /* Respect user's motion preferences */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .hero__image img {
    animation: none;
  }
  
  .btn:hover,
  .card:hover,
  .service-box:hover,
  .stat:hover {
    transform: none;
  }
  
  .parallax {
    transform: none !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  /* Ensure animations don't interfere with high contrast */
  .card::before,
  .btn::before,
  .hero::before {
    opacity: 0.1;
  }
  
  .hero__text h1 .brand-text {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
    color: inherit;
  }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
  .success-message {
    background: linear-gradient(135deg, #059669, #047857);
  }
  
  .ripple {
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Print optimizations */
@media print {
  /* Disable all animations for printing */
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
  
  .hero::before,
  .card::before,
  .btn::before {
    display: none !important;
  }
  
  .hero__text h1 .brand-text {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    background-clip: unset !important;
    color: #000 !important;
  }
}

/* Performance monitoring classes */
.performance-mode {
  /* Disable expensive animations */
  .card:hover,
  .btn:hover,
  .service-box:hover,
  .stat:hover {
    transform: none;
  }
  
  .card::before,
  .btn::before,
  .hero::before {
    display: none;
  }
  
  .parallax {
    transform: none !important;
  }
  
  /* Reduce animation durations */
  * {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
  }
}

/* GPU acceleration for smooth animations */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Optimize for 60fps */
.smooth-animation {
  transform: translateZ(0);
  will-change: transform, opacity;
  backface-visibility: hidden;
}

/* Reduce layout thrashing */
.stable-layout {
  contain: layout style paint;
}

/* Optimize repaints */
.optimize-repaints {
  contain: paint;
  will-change: transform;
}
