/* Global Mobile Fixes */
html, body { 
  overflow-x: hidden; 
  width: 100%; 
  position: relative; 
}

/* Tablet & Mobile Navigation Breakpoint (1024px) */
@media (max-width: 1024px) {
  :root {
    --safe-top: env(safe-area-inset-top, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    --safe-left: env(safe-area-inset-left, 0);
    --safe-right: env(safe-area-inset-right, 0);
  }

  body { padding-left: var(--safe-left); padding-right: var(--safe-right); }
  
  .section-padding { padding: 80px 0; scroll-margin-top: 100px; }
  .hero h1 { font-size: 2.8rem; }
  
  /* Restoring Full Nav for iPads/Large Tablets at 1024px */
  .nav {
    position: static;
    visibility: visible;
    opacity: 1;
    transform: none;
    width: auto;
    background: transparent;
    box-shadow: none;
    padding: 0;
    backdrop-filter: none;
  }
  
  .nav-list { flex-direction: row; gap: 20px; }
  .nav-list a { padding: 10px 0; font-size: 0.95rem; }
  
  .mobile-toggle { display: none !important; }
  
  .header-container { height: 80px; }
  
  .about-grid { grid-template-columns: 1fr; gap: 50px; }
  .about-image { display: flex; justify-content: center; margin-top: 30px; min-height: 480px; }
  .about-image-wrapper { max-width: 600px; margin: 0 auto; height: 100%; position: relative; }
  .sub-about-img { right: 0; bottom: -20px; }
  .services-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-newsletter { grid-column: span 2; }
  .scroll-indicator { bottom: 20px; scale: 0.8; }
}

/* Phones (767px) */
@media (max-width: 767px) {
  .section-padding { padding: 60px 0; scroll-margin-top: 80px; }
  .section-header h2 { font-size: 2.22rem; margin-bottom: 15px; }
  .scroll-indicator { display: none; }
  
  section { scroll-margin-top: 80px; }
  
  .hero { padding-top: 70px; text-align: center; }
  .hero-content { display: flex; flex-direction: column; align-items: center; margin: 0 auto; }
  .hero h1 { font-size: 2.4rem; }
  .hero p { font-size: 1.1rem; }
  .hero-buttons { flex-direction: column; width: 100%; max-width: 300px; gap: 15px; }
  .hero-buttons .btn { width: 100%; }
  
  .about-text { text-align: center; }
  .about-features li { justify-content: center; }
  .about-image { min-height: 380px; }
  
  .gallery-track { gap: 15px; }
  .gallery-track img { height: 200px; width: 280px; }
  
  /* Footer Master Fit & Stacking */
  .footer-grid { grid-template-columns: 1fr; gap: 40px; text-align: center; }
  .footer-newsletter { grid-column: span 1; }
  .social-links { justify-content: center; margin-top: 15px; }
  .footer-contact ul li { justify-content: center; }
  .footer h3::after { left: 50%; transform: translateX(-50%); }
  
  /* Newsletter Stack Fix for all phones */
  .newsletter-form { flex-direction: column; gap: 12px; }
  .newsletter-form input { 
    border-radius: var(--radius-sm); 
    text-align: center; 
    width: 100%;
    padding: 16px;
  }
  .newsletter-form button { 
    border-radius: var(--radius-sm); 
    padding: 16px; 
    width: 100%; 
  }
  
  .cta h2 { font-size: 2rem; }
  .cta p { font-size: 1.1rem; }

  /* Back to top offset */
  .back-to-top { bottom: 85px; right: 20px; width: 45px; height: 45px; }

  /* Mobile Nav Start at 767px */
  .header-container { height: 70px; }
  
  .nav {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 0;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s ease-in-out;
    z-index: 1000;
  }
  
  .nav.active { 
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
  }
  
  .nav-list { flex-direction: column; gap: 0; }
  .nav-list li { width: 100%; border-bottom: 1px solid var(--bg-light); }
  .nav-list a {
    display: block;
    padding: 18px 30px;
    text-align: center;
    font-size: 1.1rem;
  }
  .nav-list a::after { display: none; }
  .nav-list a:hover {
    background-color: var(--bg-light);
    color: var(--accent);
  }
  
  .mobile-toggle { 
    display: flex !important; 
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
  }
  
  .services-grid { grid-template-columns: 1fr; gap: 20px; }
  .service-card { min-width: 0; }
}

/* Small Phones (480px) */
@media (max-width: 480px) {
  .section-padding { padding: 50px 0; scroll-margin-top: 70px; }
  .section-header h2 { font-size: 1.85rem; }
  .hero h1 { font-size: 1.85rem; }
  .hero p { font-size: 1rem; }
  
  section { scroll-margin-top: 70px; }
  
  .about-image { min-height: 280px; }
  .main-about-img { width: 90%; }
  .sub-about-img { width: 70%; right: 5%; bottom: -10px; }
  
  .service-image { height: 180px; }
  .service-content { padding: 0 20px 30px; }
  
  .gallery-track img { height: 160px; width: 220px; }
  
  .back-to-top { bottom: 90px; right: 15px; transform: scale(0.9); }
  
}
