/* Mobile Enhancements for Cien Rios LLC */

/* Base mobile optimizations */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {
  /* Ensure all interactive elements have minimum 44x44px touch targets */
  button,
  a,
  input,
  select,
  textarea,
  .nav-link,
  .mobile-menu-toggle,
  .btn,
  .filter-btn {
    min-height: 44px;
    min-width: 44px;
    position: relative;
    touch-action: manipulation;
  }

  /* Improve form inputs for mobile */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 16px;
    border-radius: 8px;
    width: 100%;
  }

  /* Optimize navigation for mobile */
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    padding-top: 60px;
  }

  .nav-menu.active {
    right: 0;
  }

  .nav-item {
    display: block;
    width: 100%;
  }

  .nav-link {
    display: block;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--color-text-primary);
    font-size: 16px;
  }

  /* Mobile menu toggle improvements */
  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .hamburger-line {
    width: 24px;
    height: 2px;
    background: var(--color-primary-dark-blue);
    margin: 3px 0;
    transition: all 0.3s ease;
  }

  /* Optimize content spacing */
  .container {
    padding: 0 16px;
  }

  .section {
    padding: 40px 0;
  }

  /* Improve readability */
  body {
    font-size: 16px;
    line-height: 1.6;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 24px;
  }

  h3 {
    font-size: 20px;
  }

  /* Optimize images for mobile */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Improve button styles for mobile */
  .btn,
  button[type="submit"] {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    border-radius: 8px;
    touch-action: manipulation;
  }

  /* Footer optimization */
  .footer-container {
    flex-direction: column;
    text-align: center;
  }

  .footer-section {
    margin-bottom: 24px;
  }

  /* Contact form mobile optimization */
  .contact-form {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
  }

  .form-group {
    margin-bottom: 20px;
  }

  /* Back to top button mobile position */
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  .site-header {
    padding: 8px 0;
  }

  .section {
    padding: 30px 0;
  }
}

/* Small mobile devices */
@media (max-width: 375px) {
  .container {
    padding: 0 12px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .btn {
    padding: 12px 20px;
    font-size: 14px;
  }
}

/* Accessibility improvements for mobile */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn,
  button {
    border: 2px solid currentColor;
  }

  .nav-link:focus,
  .btn:focus,
  button:focus,
  a:focus {
    outline: 3px solid currentColor;
    outline-offset: 2px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-primary: #1a1a1a;
    --color-text-primary: #e0e0e0;
    --color-text-secondary: #b0b0b0;
  }

  body {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
  }

  .nav-menu {
    background: #2a2a2a;
  }

  .contact-form {
    background: #2a2a2a;
  }

  input,
  textarea,
  select {
    background: #1a1a1a;
    color: #e0e0e0;
    border-color: #444;
  }
}

/* Performance optimizations */
@media (max-width: 768px) {
  /* Disable complex animations on mobile for better performance */
  * {
    animation: none !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
  }

  /* Optimize font loading */
  body {
    font-display: swap;
  }
}

/* PWA optimizations */
@media (display-mode: standalone) {
  /* Style adjustments for PWA mode */
  .site-header {
    padding-top: env(safe-area-inset-top);
  }

  .site-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Additional Mobile Optimizations */
@media (max-width: 768px) {
  /* Hero Section Mobile */
  .hero-section {
    padding: 60px 0;
    text-align: center;
  }
  
  .hero-title {
    font-size: 28px;
    line-height: 1.3;
    margin-bottom: 16px;
  }
  
  .hero-subtitle {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 24px;
  }
  
  .hero-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  
  /* Portfolio Grid Mobile */
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .portfolio-filters {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 20px;
  }
  
  .filter-btn {
    white-space: nowrap;
    padding: 8px 16px;
    font-size: 14px;
  }
  
  /* Services Grid Mobile */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .service-card {
    padding: 20px;
  }
  
  /* Testimonials Mobile */
  .testimonials-slider {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  
  .testimonial-card {
    min-width: 280px;
    scroll-snap-align: start;
    margin-right: 16px;
  }
  
  /* Features Grid Mobile */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* Contact Section Mobile */
  .contact-content {
    flex-direction: column;
    gap: 30px;
  }
  
  .contact-info,
  .contact-form {
    width: 100%;
  }
  
  /* Footer Mobile */
  .footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: center;
  }
  
  .footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  /* Social Links Mobile */
  .social-links {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
  }
  
  /* Loading States Mobile */
  .loading-placeholder {
    height: 200px !important;
  }
  
  /* Image Optimizations */
  .portfolio-image {
    height: 250px;
  }
  
  .lazy-image {
    background-color: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
  }
  
  /* CTA Section Mobile */
  .cta-section {
    padding: 40px 20px;
    text-align: center;
  }
  
  .cta-section h2 {
    font-size: 24px;
    margin-bottom: 12px;
  }
  
  .cta-section p {
    font-size: 16px;
    margin-bottom: 20px;
  }
  
  /* Section Spacing Mobile */
  .section {
    padding: 40px 0;
  }
  
  .section-title {
    font-size: 24px;
    margin-bottom: 8px;
  }
  
  .section-subtitle {
    font-size: 16px;
    margin-bottom: 30px;
  }
  
  /* Tech Stack Tags Mobile */
  .tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .tech-tag {
    padding: 4px 8px;
    font-size: 12px;
  }
  
  /* Quote Icon Mobile */
  .quote-icon {
    font-size: 48px;
    opacity: 0.1;
    margin-bottom: -20px;
  }
  
  /* Header Mobile */
  .site-header {
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 18px;
  }
  
  /* Mobile Menu Overlay */
  body.menu-open {
    overflow: hidden;
  }
  
  body.menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
}