/* Mobile-specific CSS optimizations */

/* Base mobile adjustments */
@media (max-width: 768px) {
  html {
    touch-action: manipulation; /* Improves touch responsiveness */
  }
  
  body {
    -webkit-text-size-adjust: 100%; /* Prevents iOS from auto-adjusting font sizes */
  }
  
  /* Improve tap target sizes for better mobile usability */
  button, 
  a, 
  input[type="button"], 
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Reduce motion for users who prefer it */
  @media (prefers-reduced-motion: reduce) {
    * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
  
  /* Improve form field usability on mobile */
  input, 
  select, 
  textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
  
  /* Fix for position:fixed elements on iOS */
  .fixed-element {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* Gallery page mobile optimizations */
@media (max-width: 768px) {
  .gallery-grid {
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  
  .gallery-item {
    margin-bottom: 0.5rem;
    transition: transform 0.2s ease;
  }
  
  /* Touch feedback for gallery items */
  .gallery-item:active {
    transform: scale(0.97);
  }
  
  /* Improved tap target size */
  .gallery-image {
    min-height: 44px;
    position: relative;
  }
  
  /* Add ripple effect for touch feedback */
  .gallery-image::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.7);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
  }
  
  .gallery-image:active::after {
    animation: ripple 0.4s ease-out;
  }
  
  @keyframes ripple {
    0% {
      transform: scale(0, 0);
      opacity: 0.5;
    }
    100% {
      transform: scale(20, 20);
      opacity: 0;
    }
  }
  
  .gallery-item {
    transition: transform 0.2s ease; /* Faster transitions on mobile */
  }
  
  /* Improve touch feedback for gallery items */
  .gallery-item:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
  
  /* Lightbox optimizations for mobile */
  .lightbox {
    z-index: 1000;
    overscroll-behavior: contain; /* Prevents pull-to-refresh during swipe gestures */
    touch-action: pan-y; /* Allow vertical scrolling but handle horizontal swipes */
  }
  
  .lightbox-content {
    width: 95%;
    max-width: 95%;
    margin: 0 auto;
    position: relative;
  }
  
  /* Swipe instruction styles */
  .swipe-instruction {
    position: absolute;
    bottom: 15%;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px;
    text-align: center;
    border-radius: 20px;
    margin: 0 auto;
    width: 80%;
    font-size: 14px;
    pointer-events: none; /* Allows clicks to pass through */
  }
  
  /* Improve close button for touch */
  .close-button {
    width: 44px;
    height: 44px;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    border: none;
    color: white;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    touch-action: manipulation;
  }
  
  /* Add swipe instructions */
  .swipe-instruction {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    font-size: 0.9rem;
    padding: 0.5rem;
    position: absolute;
    bottom: 10px;
    width: 100%;
    animation: fadeOut 3s forwards 2s;
  }
  
  @keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
  }
}

/* Small mobile phones */
@media (max-width: 375px) {
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Medium mobile phones */
@media (min-width: 376px) and (max-width: 576px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.6rem;
  }
}

/* Mobile landscape mode */
@media (max-height: 450px) and (orientation: landscape) {
  .hero-slider {
    height: 300px !important;
  }
  
  .hero-content h1 {
    font-size: 1.8rem;
  }
  
  .hero-content h2 {
    font-size: 1.4rem;
  }
}

/* Mobile-specific navigation improvements */
@media (max-width: 768px) {
  /* Improve spacing in mobile navigation */
  .nav-links li {
    margin: 10px 0;
  }
  
  /* Larger hamburger menu touch target */
  .menu-toggle {
    padding: 12px;
  }
  
  /* Adjust footer for mobile */
  footer .footer-columns {
    flex-direction: column;
  }
  
  /* Adjust testimonials for mobile */
  .testimonial-card {
    margin: 10px 0;
  }
  
  /* Improve client logos display on mobile */
  .client-logos {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  /* Adjust contact form for mobile */
  .contact-form input,
  .contact-form textarea {
    margin-bottom: 15px;
  }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix for 100vh issue on iOS */
  .full-height {
    height: -webkit-fill-available;
  }
  
  /* Fix for position:fixed elements on iOS */
  .fixed-element {
    position: -webkit-sticky;
  }
}

/* Android specific fixes */
@supports not (-webkit-touch-callout: none) {
  /* Android-specific adjustments if needed */
}
