/* Mobile Responsive Fixes for Leancraft Website */

/* ===================================
   MOBILE BREAKPOINTS
   =================================== */

/* Small Mobile: 0-479px */
@media (max-width: 479px) {
  /* Reset large spacing */
  body {
    overflow-x: hidden;
  }

  /* Fix hero section */
  h1 {
    font-size: clamp(1.5rem, 8vw, 2.5rem) !important;
    line-height: 1.2 !important;
  }

  h2 {
    font-size: clamp(1.2rem, 6vw, 1.8rem) !important;
    line-height: 1.3 !important;
  }

  h3 {
    font-size: clamp(1rem, 5vw, 1.5rem) !important;
    line-height: 1.3 !important;
  }

  p {
    font-size: clamp(0.9rem, 4vw, 1.1rem) !important;
    line-height: 1.6 !important;
  }

  /* Fix logo section */
  #logos img {
    max-width: 120px !important;
    height: auto !important;
    margin: 0.5rem !important;
  }

  /* Fix service cards */
  .w-box[class*="c5vt19m"] {
    padding: 1rem !important;
  }

  /* Fix buttons */
  .w-button,
  .w-link[class*="c1pyzt8a"] {
    font-size: 0.9rem !important;
    padding: 0.75rem 1.5rem !important;
    white-space: normal !important;
    text-align: center !important;
  }

  /* Fix navigation */
  nav {
    padding: 0.5rem 1rem !important;
  }

  nav img {
    max-width: 150px !important;
  }

  /* Ensure all grids collapse to single column */
  .w-box[class*="grid"],
  [class*="c1t9vn71"] {
    grid-template-columns: 1fr !important;
  }

  /* Fix images */
  img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Fix padding on sections */
  section {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Fix container max-widths */
  .w-box[class*="c1ixtuxv"] {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Fix flex gaps */
  .w-box[class*="ccdo1v8"] {
    gap: 1rem !important;
  }
}

/* Medium Mobile: 480-767px */
@media (min-width: 480px) and (max-width: 767px) {
  h1 {
    font-size: clamp(2rem, 8vw, 3rem) !important;
  }

  h2 {
    font-size: clamp(1.5rem, 6vw, 2.2rem) !important;
  }

  /* Fix logo section */
  #logos img {
    max-width: 140px !important;
    height: auto !important;
  }

  /* Fix service cards - allow 2 columns on larger mobiles */
  .w-box[class*="c1xucrmt"] {
    grid-template-columns: 1fr !important;
  }

  section {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

/* Tablet: 768-991px */
@media (min-width: 768px) and (max-width: 991px) {
  /* Fix logo section */
  #logos img {
    max-width: 150px !important;
    height: auto !important;
  }

  /* Allow 2 column grid on tablets */
  .w-box[class*="c1xucrmt"] {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ===================================
   UNIVERSAL MOBILE FIXES
   =================================== */

@media (max-width: 991px) {
  /* Prevent horizontal scroll */
  html,
  body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* Fix all containers */
  .w-box {
    max-width: 100% !important;
  }

  /* Ensure images don't overflow */
  img,
  svg {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Fix accordions/collapsibles on mobile */
  .w-accordion {
    width: 100% !important;
  }

  /* Fix form inputs */
  input,
  textarea,
  button {
    font-size: 16px !important; /* Prevents zoom on iOS */
    max-width: 100% !important;
  }

  /* Fix CTA buttons */
  a[href*="tally.so"] {
    display: block !important;
    width: 100% !important;
    max-width: 300px !important;
    margin: 1rem auto !important;
  }

  /* Fix testimonial/quote sections */
  blockquote {
    padding: 1rem !important;
    margin: 1rem 0 !important;
  }

  /* Improve touch targets (minimum 44x44px) */
  button,
  a,
  .w-button {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  /* Fix pricing cards */
  .w-box[class*="pricing"] {
    margin-bottom: 1rem !important;
  }

  /* Stack team member cards */
  #team .w-box[class*="grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* ===================================
   SPECIFIC SECTION FIXES
   =================================== */

/* Hero Section */
@media (max-width: 767px) {
  #hero {
    text-align: center !important;
    padding-top: 2rem !important;
  }

  #hero .w-box[class*="c1xucrmt"] {
    grid-template-columns: 1fr !important;
  }

  #hero img {
    max-width: 80% !important;
    margin: 1rem auto !important;
  }
}

/* Logo Section - Critical Fix */
@media (max-width: 991px) {
  #logos .w-box {
    justify-content: center !important;
    align-items: center !important;
  }

  #logos img {
    display: inline-block !important;
    margin: 0.5rem !important;
    filter: grayscale(100%) !important;
  }
}

/* Services Section */
@media (max-width: 767px) {
  #services .w-box[class*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  #services .w-box[class*="c5vt19m"] {
    min-height: auto !important;
  }
}

/* Process Section */
@media (max-width: 767px) {
  #process .w-accordion {
    width: 100% !important;
  }
}

/* Contact Form */
@media (max-width: 767px) {
  #contact form {
    width: 100% !important;
  }

  #contact input,
  #contact textarea {
    width: 100% !important;
  }
}

/* ===================================
   ACCESSIBILITY & UX IMPROVEMENTS
   =================================== */

@media (max-width: 991px) {
  /* Better link visibility */
  a:focus {
    outline: 3px solid #b9ff66 !important;
    outline-offset: 2px !important;
  }

  /* Better button states */
  button:active,
  .w-button:active {
    transform: scale(0.98) !important;
  }

  /* Smooth scrolling */
  html {
    scroll-behavior: smooth !important;
  }

  /* Better spacing between sections */
  section + section {
    margin-top: 2rem !important;
  }
}

/* ===================================
   FIX FOR COMMON WEBSTUDIO ISSUES
   =================================== */

@media (max-width: 767px) {
  /* Override fixed widths */
  [style*="width:"] {
    width: auto !important;
    max-width: 100% !important;
  }

  /* Fix flex containers that don't wrap */
  .w-box[class*="ccdo1v8"] {
    flex-wrap: wrap !important;
  }

  /* Ensure proper stacking */
  .w-box[class*="c13rtvuj"] {
    flex-direction: column !important;
  }

  /* Fix absolute positioning issues */
  [class*="c1rlke01"],
  [class*="cc16il5"] {
    position: relative !important;
  }
}
