/* =================================================================
   TerraSpace Responsive Stylesheet (Complete Mobile Fix)
   ================================================================= */

/* Global Touch & Tap Enhancements */
button,
a,
.btn {
  touch-action: manipulation;
}

@media (max-width: 1199px) {
  .container {
    max-width: 960px;
  }
}

@media (max-width: 991px) {
  .container {
    max-width: 720px;
  }

  /* Header & Mobile Drawer Navigation */
  .nav-links {
    position: fixed;
    top: 80px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 80px);
    background-color: #ffffff;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 40px;
    gap: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    z-index: 999;
  }

  .nav-links.active {
    left: 0;
  }

  .mobile-toggle {
    display: flex !important;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  /* Animated Hamburger to "X" button when menu opens */
  .mobile-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }
  .mobile-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .mobile-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }

  /* Hero Section */
  .hero-container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-buttons {
    justify-content: center;
  }

  .hero-image-wrapper {
    display: block;
    width: 100%;
    max-width: 680px;
    margin: 32px auto 0;
    min-height: 320px;
    height: 320px;
  }

  .hero-image-wrapper .hero-slide,
  .hero-image-wrapper .hero-slide img {
    height: 100%;
    min-height: 0;
  }

  /* Standard Grids */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .why-grid {
    grid-template-columns: 1fr;
  }

  .cta-flex {
    flex-direction: column;
    text-align: center;
    gap: 32px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Inline Grid Overrides for About & Contact Pages */
  .about-grid,
  .container[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 767px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 0 16px;
  }

  .logo-image {
    width: 180px;
    height: 36px;
  }

  .hero-image-wrapper {
    height: auto;
    min-height: 250px;
  }

  /* Stack Service Cards Cleanly on Mobile */
  .service-card {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 24px !important;
    text-align: center;
  }

  .service-icon {
    margin: 0 auto !important;
  }

  .services-grid {
    grid-template-columns: 1fr !important;
  }

  /* FIX: Stack Testimonials / Reviews Grid in 1 Single Column on Mobile */
  .testimonials-grid,
  .reviews-grid,
  div[style*="repeat(3, 1fr)"],
  div[style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .why-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .flex-between {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .hero-content h1 {
    font-size: 32px;
  }

  .page-banner h1 {
    font-size: 32px;
  }

  /* Compact header buttons on small screens */
  .header-action .btn {
    padding: 8px 12px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 480px) {
  .logo-image {
    width: 150px;
    height: 32px;
  }
}
