/* ==========================================================================
   BetterWhole Technologies — Mobile-First Comprehensive Responsive System
   Breakpoints: 1240px (Laptop), 991px (Tablet), 767px (Phablet), 540px (Mobile), 375px (Compact)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Global Mobile Resets & Prevent Horizontal Overflow
   -------------------------------------------------------------------------- */
html,
body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

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

/* --------------------------------------------------------------------------
   Desktop / Laptop (<= 1240px)
   -------------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .bw-nav-desktop {
    gap: 4px;
  }

  .bw-nav-link {
    font-size: 0.84rem;
    padding: 5px 8px;
  }

  .bw-nav-cta {
    display: none;
  }

  .bw-hero-grid,
  .bw-intro-grid,
  .bw-engine-grid,
  .bw-research-feature,
  .bw-product-detail-hero,
  .bw-contact-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .bw-hero-float-card {
    position: static;
    margin-top: 16px;
    max-width: none;
  }

  .bw-quick-grid,
  .bw-showcase-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bw-services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bw-approach-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bw-footer-top {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

/* --------------------------------------------------------------------------
   Tablets (<= 991px) — Switch to Mobile Header Drawer
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .bw-nav-desktop {
    display: none;
  }

  .bw-mobile-toggle {
    display: inline-flex;
  }

  .bw-mobile-subnav {
    display: block;
  }

  .bw-domains-grid,
  .bw-services-grid,
  .bw-audience-grid,
  .bw-posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bw-product-card,
  .bw-product-card.is-featured {
    grid-column: span 6;
  }

  .bw-capabilities-grid,
  .bw-editorial-grid,
  .bw-page-hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .bw-footer-links-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
  }
}

/* --------------------------------------------------------------------------
   Phablets & Small Tablets (<= 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  :root {
    --bw-header-h: 64px;
  }

  body {
    padding-top: 0;
  }

  .bw-container {
    padding-inline: 20px;
  }

  .bw-section {
    padding-block: 54px;
  }

  .bw-page-hero {
    padding-block: 44px 50px;
  }

  .bw-page-hero h1 {
    font-size: clamp(1.85rem, 6.5vw, 2.5rem);
  }

  /* Header Bar */
  .bw-header-inner {
    height: var(--bw-header-h);
  }

  .bw-brand-mark {
    width: 34px;
    height: 34px;
  }

  .bw-brand-wordmark {
    font-size: 1.18rem;
  }

  .bw-brand-sub {
    font-size: 0.65rem;
  }

  .bw-mobile-toggle {
    min-height: 40px;
    padding: 6px 12px;
    font-size: 0.825rem;
  }

  /* Hero Section */
  .bw-hero {
    padding-block: 44px 56px;
  }

  .bw-hero-eyebrow {
    font-size: 0.8rem;
    margin-bottom: 12px;
  }

  .bw-hero-title {
    font-size: clamp(2rem, 7.8vw, 2.75rem);
    line-height: 1.12;
    letter-spacing: -0.025em;
  }

  .bw-hero-lead {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 24px;
  }

  .bw-hero-visual {
    padding-left: 0;
    margin-top: 8px;
  }

  .bw-hero-curved-stage {
    padding: 6px;
  }

  .bw-hero-curved-stage::before {
    inset: 0;
    border-radius: 40px 16px 40px 16px;
    opacity: 0.9;
  }

  .bw-hero-frame {
    border-radius: 16px;
    min-height: 220px;
    max-height: 340px;
  }

  .bw-hero-frame img {
    height: 260px;
    object-fit: cover;
  }

  .bw-hero-float-card {
    position: relative;
    inset: auto;
    margin-top: 14px;
    max-width: 100%;
    padding: 16px 18px;
    border-radius: 14px;
  }

  .bw-hero-actions,
  .bw-cta-buttons {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .bw-hero-actions .bw-btn,
  .bw-cta-buttons .bw-btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  /* Single Column Grids on Mobile */
  .bw-quick-grid,
  .bw-showcase-grid,
  .bw-domains-grid,
  .bw-services-grid,
  .bw-audience-grid,
  .bw-posts-grid,
  .bw-approach-grid,
  .bw-pillars-grid,
  .bw-capability-list,
  .bw-form-grid,
  .bw-footer-links-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .bw-product-card,
  .bw-product-card.is-featured {
    grid-column: span 12;
  }

  .bw-pillar-card:last-child {
    grid-column: span 1;
  }

  /* Cards & Features */
  .bw-card,
  .bw-service-card,
  .bw-product-body,
  .bw-showcase-body {
    padding: 24px 20px;
  }

  .bw-service-title {
    font-size: 1.25rem;
  }

  .bw-service-desc {
    font-size: 0.94rem;
  }

  .bw-research-feature,
  .bw-academy-panel,
  .bw-form-card,
  .bw-cta-band {
    padding: 26px 20px;
    border-radius: 16px;
  }

  .bw-academy-outcomes {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .bw-academy-outcomes span {
    font-size: 0.9rem;
    padding: 10px 14px;
  }

  .bw-research-media {
    border-radius: 14px;
    max-height: 260px;
  }

  .bw-research-media img {
    height: 240px;
    object-fit: cover;
  }

  /* Section Headers */
  .bw-section-header {
    margin-bottom: 28px;
  }

  .bw-section-title {
    font-size: clamp(1.6rem, 5.5vw, 2.1rem);
    line-height: 1.25;
  }

  .bw-section-lead {
    font-size: 0.98rem;
    line-height: 1.6;
  }

  /* Form Controls (iOS Zoom Prevention: 16px font-size) */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 46px;
  }

  textarea {
    min-height: 120px;
  }

  .bw-newsletter-input-group {
    flex-direction: column;
    gap: 10px;
  }

  .bw-newsletter-input-group input {
    width: 100%;
    min-height: 48px;
  }

  .bw-newsletter-input-group .bw-btn {
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }

  /* Product Detail Hero on Mobile */
  .bw-product-detail-hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .bw-product-detail-media {
    max-height: 280px;
    border-radius: 16px;
  }

  .bw-product-detail-media img {
    height: 260px;
    object-fit: cover;
  }

  /* Floating WhatsApp Button */
  .bw-whatsapp-float {
    right: 16px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45);
  }

  .bw-whatsapp-float i {
    width: 24px;
    height: 24px;
  }

  .bw-whatsapp-label {
    display: none;
  }

  /* Mobile Subnav Strip */
  .bw-mobile-subnav-inner {
    padding: 8px 16px;
    gap: 8px;
  }

  .bw-mobile-subnav-link {
    padding: 7px 12px;
    font-size: 0.8125rem;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  /* Mobile Nav Drawer */
  .bw-mobile-drawer-inner {
    padding: 20px 18px 40px;
    gap: 20px;
  }

  .bw-mobile-link {
    padding: 13px 14px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 10px;
    min-height: 46px;
    display: flex;
    align-items: center;
  }
}

/* --------------------------------------------------------------------------
   Compact Smartphones (<= 480px & 360px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .bw-container {
    padding-inline: 16px;
  }

  .bw-section {
    padding-block: 44px;
  }

  .bw-hero {
    padding-block: 36px 48px;
  }

  .bw-hero-title {
    font-size: clamp(1.75rem, 8vw, 2.25rem);
  }

  .bw-section-title {
    font-size: 1.5rem;
  }

  .bw-card,
  .bw-service-card,
  .bw-product-body,
  .bw-showcase-body {
    padding: 20px 16px;
  }

  .bw-service-highlights li {
    font-size: 0.8rem;
  }

  .bw-hero-frame img {
    height: 220px;
  }

  .bw-research-feature,
  .bw-academy-panel,
  .bw-form-card,
  .bw-cta-band {
    padding: 20px 16px;
  }

  .bw-btn {
    padding-inline: 18px;
  }

  .bw-footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
}

@media (max-width: 360px) {
  .bw-container {
    padding-inline: 12px;
  }

  .bw-brand-wordmark {
    font-size: 1.05rem;
  }

  .bw-brand-mark {
    width: 30px;
    height: 30px;
  }

  .bw-hero-title {
    font-size: 1.65rem;
  }
}
