/* ==========================================================================
   AgentAngel.io — Mobile Viewport & Above-The-Fold Responsive Hardening (<= 390px)
   Requirement: AA-003 (AGENTANGEL_MASTER_CRO_AND_PRODUCT_STANDARDS_SPEC.md)
   Ensures zero horizontal scroll, clean 100vh hero scaling, no text/CTA overlap
   Palette: Sapphire #3B82F6 / #1D4ED8 | Navy #172554 | Platinum #E5E7EB | Surface #EEF0F4
   ========================================================================== */

* {
  box-sizing: border-box;
  max-width: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

@media only screen and (max-width: 390px) {
  html, body {
    height: auto;
    min-height: 100vh;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Scale hero container to fit within fold without visual collision */
  .hero,
  main,
  .hero-section {
    min-height: auto !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
    box-sizing: border-box !important;
  }

  /* Responsive typography scaling */
  h1, .font-display.text-4xl, .font-display.text-5xl, .text-4xl, .text-5xl {
    font-size: 1.75rem !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em !important;
    word-break: break-word !important;
  }

  h2, .font-display.text-3xl, .text-3xl {
    font-size: 1.35rem !important;
    line-height: 1.3 !important;
  }

  h3, .text-2xl {
    font-size: 1.15rem !important;
    line-height: 1.35 !important;
  }

  p, .text-lg, .text-base {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
  }

  /* Flex containers wrap cleanly */
  .flex-row, .flex, .inline-flex {
    flex-wrap: wrap !important;
  }

  /* Navigation adjustments for small mobile viewports */
  header, nav, .nav {
    height: auto !important;
    min-height: 3.5rem !important;
    padding: 0.5rem 0.75rem !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  header a, nav a {
    font-size: 0.75rem !important;
  }

  /* CTA Buttons */
  .cta-button, .btn-primary, button, a.bg-blue-600 {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
    text-align: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    margin-top: 0.5rem !important;
    min-height: auto !important;
    height: auto !important;
  }

  /* Glass panels and cards */
  .glass-panel, .card-panel {
    padding: 1rem !important;
    border-radius: 12px !important;
    margin-bottom: 1rem !important;
  }

  /* Stats and grid items stack cleanly without overflow */
  .grid-cols-1, .grid-cols-2, .grid-cols-3, .grid-cols-4, .lg\:grid-cols-12 {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Images fit containers without distortion or overflow */
  img, svg, canvas, video {
    max-width: 100% !important;
    height: auto !important;
  }
}
