/* ============================================================
   USMAN ENTERPRISES - Complete Mobile Responsiveness Framework
   Comprehensive Audit & Fix for Viewports: 320px to 991px
   Desktop Layout (992px+) Preserved 100%
   ============================================================ */

/* ------------------------------------------------------------
   1. ROOT-LEVEL OVERFLOW SAFEGUARDS & RESET
   ------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
}

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

img, video, iframe, canvas, svg {
  max-width: 100%;
  height: auto;
}

/* ------------------------------------------------------------
   2. TABLET & MEDIUM DEVICES (769px - 991px)
   ------------------------------------------------------------ */
@media (min-width: 769px) and (max-width: 991px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero-slider-wrap {
    max-width: 600px;
    margin: 0 auto;
  }

  .service-content-grid {
    grid-template-columns: 1fr;
  }

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

  .brands-grid {
    grid-template-columns: repeat(4, 1fr);
  }

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

/* ------------------------------------------------------------
   3. MOBILE & TABLET NAVIGATION DRAWER TRIGGER (<= 991px)
   ------------------------------------------------------------ */
@media (max-width: 991px) {
  .desktop-nav,
  .header-cta-actions .btn-desktop-only {
    display: none !important;
  }

  .menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    cursor: pointer;
  }

  .site-header {
    height: 62px;
  }

  .header-inner {
    height: 62px;
  }
}

@media (min-width: 992px) {
  .menu-toggle {
    display: none !important;
  }

  .mobile-nav-drawer,
  .mobile-nav-overlay {
    display: none !important;
  }
}

/* ------------------------------------------------------------
   4. GENERAL MOBILE SCREENS (<= 768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  /* Fixed Bottom Bar Activation & Safe Bottom Offset */
  body {
    padding-bottom: 72px !important;
  }

  .desktop-floating-actions {
    display: none !important;
  }

  .mobile-bottom-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 58px;
    padding: 0.4rem 0.65rem;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.08);
    z-index: 150;
    border-top: 1px solid var(--border-color);
  }

  .mobile-bar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    height: 44px;
    font-size: clamp(0.78rem, 3.4vw, 0.885rem);
    font-weight: 700;
    white-space: nowrap;
    border-radius: var(--radius-sm);
  }

  /* Form Controls: prevent iOS Safari auto-zoom (Must be >= 16px) */
  .form-control,
  input[type="text"],
  input[type="tel"],
  input[type="email"],
  select.form-control,
  textarea.form-control {
    font-size: 16px !important;
    padding: 0.7rem 0.85rem;
  }

  /* Grids collapsing on mobile */
  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .chimney-feature-card {
    grid-template-columns: 1fr !important;
  }

  .chimney-feature-img {
    min-height: 200px !important;
    max-height: 260px !important;
  }

  .service-content-grid {
    grid-template-columns: 1fr !important;
    gap: 1.75rem !important;
  }

  .contact-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .areas-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  /* Sales card action buttons stacking */
  .sales-card-actions {
    grid-template-columns: 1fr !important;
    gap: 0.45rem !important;
  }

  .sales-card-actions .btn {
    width: 100% !important;
    white-space: nowrap !important;
    justify-content: center !important;
  }
}

/* ------------------------------------------------------------
   5. STANDARD MOBILE BREAKPOINT (<= 640px)
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  /* Top Bar (Hide to save screen space) */
  .top-bar {
    display: none !important;
  }

  /* Normalized Vertical Spacing (Eliminate erratic jumping) */
  .section {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  .section-header {
    margin-bottom: 1.35rem !important;
  }

  .hero-section {
    padding: 1.4rem 0 1.85rem !important;
  }

  .page-banner {
    padding: 1.6rem 0 1.8rem !important;
  }

  /* Single Column Card Grids */
  .sales-showcase-grid,
  .services-grid,
  .why-grid,
  .process-grid,
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 1.15rem !important;
  }

  .feature-checklist {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  .problem-card-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Brand Cards: 2 Columns with Clean Padding */
  .brands-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  .brand-card-rich {
    padding: 1.15rem 0.65rem !important;
  }

  .brand-title-text {
    font-size: clamp(1rem, 4vw, 1.2rem) !important;
  }

  .brand-showcase-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  .brand-card-showcase {
    padding: 0.85rem 0.55rem !important;
  }

  .brand-logo-wrap {
    height: 44px !important;
    margin-bottom: 0.35rem !important;
  }

  .brand-logo-wrap img {
    max-height: 35px !important;
    max-width: 115px !important;
  }

  .brand-showcase-category {
    font-size: 0.68rem !important;
    padding: 0.15rem 0.45rem !important;
    margin-bottom: 0.6rem !important;
  }

  .brand-showcase-btn {
    font-size: 0.75rem !important;
    padding: 0.4rem 0.35rem !important;
  }

  /* Hero Slider Compact Aspect Ratio */
  .hero-slider-wrap {
    border-width: 2px !important;
    border-radius: var(--radius-md) !important;
  }

  .hero-slider {
    aspect-ratio: 16 / 11 !important;
    min-height: 200px !important;
    max-height: 270px !important;
  }

  /* Compact Hero Overlay Badge */
  .slide-caption-badge {
    bottom: 0.5rem !important;
    left: 0.5rem !important;
    font-size: 0.7rem !important;
    padding: 0.2rem 0.55rem !important;
    max-width: 80% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .slider-dots {
    bottom: 0.5rem !important;
    right: 0.5rem !important;
    gap: 0.35rem !important;
  }

  .slider-dot {
    width: 7px !important;
    height: 7px !important;
  }

  .slider-dot.active {
    width: 16px !important;
  }

  /* Cards Padding Normalization */
  .chimney-feature-body,
  .service-card-body,
  .sales-card-body,
  .why-card,
  .process-step,
  .contact-info-card,
  .booking-form-card,
  .areas-card,
  .sidebar-card {
    padding: 1.15rem 1rem !important;
  }

  .service-main-image {
    max-height: 240px !important;
    margin-bottom: 1.25rem !important;
    border-radius: var(--radius-md) !important;
  }

  /* Callout upgrade boxes inside service pages */
  div[style*="border-radius"] {
    padding: 1.15rem 1rem !important;
  }
}

/* ------------------------------------------------------------
   6. BUTTON ROW STACKING & EXPANSION (<= 580px)
   ------------------------------------------------------------ */
@media (max-width: 580px) {
  /* Hero Actions: Full width thumb targets */
  .hero-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0.55rem !important;
  }

  .hero-actions .btn {
    width: 100% !important;
    justify-content: center !important;
    white-space: nowrap !important;
    font-size: clamp(0.85rem, 3.8vw, 0.95rem) !important;
    padding: 0.75rem 1rem !important;
  }

  /* All Button Groups in content & callouts */
  .btn-group {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0.55rem !important;
  }

  .btn-group .btn {
    width: 100% !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }

  .cta-banner .btn-group {
    flex-direction: column !important;
    width: 100% !important;
  }

  .cta-banner .btn {
    width: 100% !important;
    white-space: nowrap !important;
    font-size: clamp(0.88rem, 3.8vw, 0.98rem) !important;
    padding: 0.75rem 1rem !important;
  }

  /* Hero Trust Strip */
  .hero-trust-strip {
    gap: 0.5rem !important;
    justify-content: flex-start !important;
  }

  .hero-trust-tag {
    font-size: 0.785rem !important;
    white-space: nowrap !important;
  }
}

/* ------------------------------------------------------------
   7. COMPACT MOBILE SCREENS (<= 480px)
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  /* Fluid Scaled Typography */
  h1, .hero-title {
    font-size: clamp(1.25rem, 5.2vw, 1.55rem) !important;
    line-height: 1.22 !important;
    margin-bottom: 0.45rem !important;
  }

  h2, .section-title {
    font-size: clamp(1.1rem, 4.3vw, 1.3rem) !important;
    line-height: 1.26 !important;
    margin-bottom: 0.4rem !important;
  }

  h3 {
    font-size: clamp(0.95rem, 3.6vw, 1.12rem) !important;
    line-height: 1.3 !important;
  }

  h4 {
    font-size: clamp(0.88rem, 3.2vw, 1rem) !important;
    line-height: 1.35 !important;
  }

  .hero-subtitle {
    font-size: clamp(0.88rem, 3.4vw, 1rem) !important;
    line-height: 1.35 !important;
    margin-bottom: 0.6rem !important;
  }

  .hero-desc {
    font-size: clamp(0.82rem, 3vw, 0.9rem) !important;
    margin-bottom: 1.15rem !important;
  }

  .section-desc {
    font-size: 0.885rem !important;
  }

  /* Single-line fit for "Why Choose USMAN ENTERPRISES?" */
  .why-section-title-wrap h2 {
    white-space: nowrap !important;
    font-size: clamp(0.82rem, 3.9vw, 1.25rem) !important;
    letter-spacing: -0.025em;
  }

  /* Contact Person Cards in About & Contact */
  .contact-person-card {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.55rem !important;
  }

  .contact-person-card .btn-group {
    width: 100% !important;
  }

  .contact-person-card .btn {
    width: 100% !important;
  }

  /* FAQ Question Sizing */
  .faq-question {
    padding: 0.9rem 1.1rem !important;
    font-size: 0.9rem !important;
  }

  .faq-answer {
    padding: 0 1.1rem !important;
  }

  .faq-item.active .faq-answer {
    padding-bottom: 0.95rem !important;
  }

  .faq-answer p {
    font-size: 0.85rem !important;
  }

  /* Footer Bottom */
  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 0.35rem !important;
  }
}

/* ------------------------------------------------------------
   8. ULTRA-COMPACT MOBILE DEVICES (320px - 360px)
   ------------------------------------------------------------ */
@media (max-width: 360px) {
  .container {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .brand-name {
    font-size: clamp(0.95rem, 4.4vw, 1.05rem) !important;
  }

  .brand-tagline {
    font-size: 0.58rem !important;
  }

  .why-section-title-wrap h2 {
    font-size: 0.82rem !important;
  }

  .btn {
    padding: 0.6rem 0.75rem !important;
    font-size: 0.82rem !important;
  }

  .mobile-bar-btn {
    font-size: 0.76rem !important;
    height: 40px !important;
    gap: 0.25rem !important;
  }

  .mobile-bar-btn i {
    font-size: 0.82rem !important;
  }

  /* Brand Cards compact fit */
  .brands-grid {
    gap: 0.5rem !important;
  }

  .brand-card-rich {
    padding: 0.85rem 0.4rem !important;
  }

  .brand-title-text {
    font-size: 0.92rem !important;
    letter-spacing: 0.01em !important;
  }

  .brand-badge-pill {
    font-size: 0.62rem !important;
    padding: 0.12rem 0.4rem !important;
  }

  /* Cards interior padding */
  .chimney-feature-body,
  .service-card-body,
  .sales-card-body,
  .why-card,
  .process-step,
  .contact-info-card,
  .booking-form-card,
  .areas-card,
  .sidebar-card,
  div[style*="border-radius"] {
    padding: 0.95rem 0.75rem !important;
  }

  /* Process number */
  .process-num {
    font-size: 1.5rem !important;
  }

  .sales-card-specs {
    padding: 0.55rem !important;
  }
}
