/* ===================================================================
   MOBILE OPTIMIZATION & SMOOTH ANIMATIONS
   Enhanced Mobile User Experience & Resume Section Animations
   =================================================================== */

/* ===== MOBILE-FIRST RESPONSIVE DESIGN ===== */

/* General Mobile Optimizations */
@media screen and (max-width: 768px) {
  /* Improved Touch Targets */
  a, button, .btn, .nav-link {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
  }

  /* Better Text Readability */
  body {
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
  }

  /* Improved Container Spacing */
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Section Padding Optimization */
  .ftco-section {
    padding: 4em 0 !important;
  }

  /* Header Improvements */
  .ftco-navbar-light {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .navbar-brand {
    font-size: 22px;
  }

  /* Mobile Menu Enhancements */
  .navbar-collapse {
    background: rgba(0, 0, 0, 0.98);
    margin-top: 15px;
    border-radius: 8px;
    padding: 20px;
    animation: slideDown 0.3s ease-out;
  }

  .navbar-nav .nav-link {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
  }

  .navbar-nav .nav-link:hover {
    background: rgba(0, 123, 255, 0.1);
    transform: translateX(5px);
  }
}

/* ===== RESUME SECTION SMOOTH ANIMATIONS ===== */

/* Enhanced Resume Wrap with Smooth Animations */
.resume-wrap {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.resume-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.1), transparent);
  transition: left 0.8s ease-in-out;
}

.resume-wrap.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.resume-wrap:hover::before {
  left: 100%;
}

.resume-wrap:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 123, 255, 0.2);
}

/* Staggered Animation for Resume Items */
.resume-wrap:nth-child(1) { animation-delay: 0.1s; }
.resume-wrap:nth-child(2) { animation-delay: 0.2s; }
.resume-wrap:nth-child(3) { animation-delay: 0.3s; }
.resume-wrap:nth-child(4) { animation-delay: 0.4s; }
.resume-wrap:nth-child(5) { animation-delay: 0.5s; }
.resume-wrap:nth-child(6) { animation-delay: 0.6s; }

/* Resume Date Animation */
.resume-wrap .date {
  opacity: 0;
  transform: scale(0.8);
  animation: dateAppear 0.8s ease-out forwards;
  animation-delay: inherit;
}

.resume-wrap h2 {
  opacity: 0;
  transform: translateX(-20px);
  animation: titleSlide 0.6s ease-out forwards;
  animation-delay: calc(var(--delay, 0s) + 0.2s);
}

.resume-wrap .position {
  opacity: 0;
  transform: translateY(10px);
  animation: positionFade 0.5s ease-out forwards;
  animation-delay: calc(var(--delay, 0s) + 0.4s);
}

.resume-wrap p {
  opacity: 0;
  transform: translateY(15px);
  animation: contentFade 0.7s ease-out forwards;
  animation-delay: calc(var(--delay, 0s) + 0.6s);
}

/* Mobile-Specific Resume Animations */
@media screen and (max-width: 768px) {
  .resume-wrap {
    margin-bottom: 25px;
    padding: 25px 20px;
    transform: translateY(20px);
  }

  .resume-wrap .date {
    font-size: 22px;
    margin-bottom: 10px;
  }

  .resume-wrap h2 {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .resume-wrap .position {
    font-size: 11px;
    margin-bottom: 15px;
  }

  /* Reduced motion for mobile performance */
  .resume-wrap:hover {
    transform: translateY(-2px);
  }
}

/* ===== KEYFRAME ANIMATIONS ===== */

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dateAppear {
  from {
    opacity: 0;
    transform: scale(0.8) rotateY(90deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

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

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

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

/* ===== IMPROVED TOUCH & SCROLL EXPERIENCE ===== */

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

/* Better Scroll Performance */
* {
  -webkit-overflow-scrolling: touch;
}

/* Improved Button Interactions */
.btn, .navbar-toggler {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0); /* Force hardware acceleration */
}

.btn:active {
  transform: scale(0.98);
}

/* Enhanced Focus States for Accessibility */
a:focus, button:focus, .btn:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}

/* ===== LOADING STATES & PROGRESSIVE ENHANCEMENT ===== */

/* Loading Animation for Resume Items */
.resume-section.loading .resume-wrap {
  background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* GPU Acceleration for Smooth Animations */
.resume-wrap,
.resume-wrap::before,
.navbar-collapse,
.btn {
  will-change: transform;
  transform: translateZ(0);
}

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .resume-wrap {
    transform: none;
  }
}

/* ===== ENHANCED MOBILE NAVIGATION ===== */

@media screen and (max-width: 768px) {
  /* Hamburger Menu Animation */
  .navbar-toggler {
    border: none;
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
  }

  .navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
  }

  .navbar-toggler-icon {
    background-image: none;
    position: relative;
    width: 24px;
    height: 18px;
    transition: all 0.3s ease;
  }

  .navbar-toggler-icon::before,
  .navbar-toggler-icon::after,
  .navbar-toggler-icon {
    background: #fff;
    height: 2px;
    border-radius: 1px;
    transition: all 0.3s ease;
  }

  .navbar-toggler-icon::before,
  .navbar-toggler-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    left: 0;
  }

  .navbar-toggler-icon::before {
    top: -8px;
  }

  .navbar-toggler-icon::after {
    top: 8px;
  }

  /* Animated hamburger to X */
  .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
    background: transparent;
  }

  .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before {
    transform: rotate(45deg);
    top: 0;
  }

  .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::after {
    transform: rotate(-45deg);
    top: 0;
  }
}

/* ===== IMPROVED TYPOGRAPHY FOR MOBILE ===== */

@media screen and (max-width: 768px) {
  h1 { font-size: 2.2rem; line-height: 1.2; }
  h2 { font-size: 1.8rem; line-height: 1.3; }
  h3 { font-size: 1.5rem; line-height: 1.4; }
  h4 { font-size: 1.3rem; line-height: 1.4; }
  h5 { font-size: 1.1rem; line-height: 1.5; }
  
  p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 1.2rem;
  }

  /* Better spacing for mobile */
  .mb-4 { margin-bottom: 2rem !important; }
  .mb-5 { margin-bottom: 2.5rem !important; }
  .py-5 { padding: 3rem 0 !important; }
}

/* ===== ENHANCED FORM INTERACTIONS ===== */

@media screen and (max-width: 768px) {
  .form-control {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
  }

  .form-control:focus {
    transform: scale(1.02);
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
  }

  textarea.form-control {
    resize: vertical;
    min-height: 120px;
  }
}

/* ===== OPTIMIZED IMAGE HANDLING ===== */

@media screen and (max-width: 768px) {
  img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease;
  }

  .img:hover {
    transform: scale(1.02);
  }

  /* Lazy loading placeholder */
  img[data-src] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }
}

/* ===== ENHANCED ACCESSIBILITY ===== */

/* High contrast mode support */
@media (prefers-contrast: high) {
  .resume-wrap {
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.9);
  }

  .resume-wrap .date {
    color: #ffff00;
  }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  .resume-wrap {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* ===== PERFORMANCE MONITORING ===== */

/* Critical rendering path optimization */
.above-fold {
  contain: layout style paint;
}

/* Intersection Observer target for lazy loading */
.lazy-section {
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.lazy-section.visible {
  opacity: 1;
}
