/* ==========================================================================
   Narratiq — mobile.css
   Responsive breakpoints. Loaded globally after all other shared CSS.

   Breakpoints:
     ≤ 768px  — tablet & mobile (most layout collapses)
     ≤ 480px  — mobile only (tight spacing, hide secondary elements)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Hide all desktop nav links — prevents horizontal overflow */
  .nav-links {
    display: none;
  }

  /* Hide "Sign in" — saves ~60px, only CTA button remains */
  .nav-sign-in {
    display: none;
  }

  /* Reduce gap between logo and actions */
  .nav-right {
    gap: 0;
  }

  /* Slightly smaller CTA button */
  .nav-cta {
    padding: 8px 14px !important;
    font-size: 13px !important;
  }
}

/* --------------------------------------------------------------------------
   Hero section
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 40px !important;
  }

  /* Hide the PDF mock preview on mobile — too large, not useful small */
  .hero-pdf-col {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Layout grids
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Sections — general spacing
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .section {
    padding: 64px 20px;
  }

  .section-header,
  .section-header--compact {
    margin-bottom: 40px;
  }
}

/* --------------------------------------------------------------------------
   Before / After cards
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* The BA grid is typically .grid-2 — already handled above.
     Extra: tighten card padding */
  .ba-card {
    padding: 24px 20px;
  }
}

/* --------------------------------------------------------------------------
   Comparison tables — horizontal scroll on tablet, collapse on mobile
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Wrap tables so they scroll internally, not the whole page */
  .cmp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;       /* never wider than parent */
    margin: 24px 0 32px;
    border-radius: 8px;
    border: 1px solid #E8E6DE;
  }

  /* Remove margins from the table itself since wrapper handles them */
  .cmp-table-wrap .cmp-table {
    margin: 0;
    min-width: 520px; /* ensure table doesn't collapse illegibly */
    width: max-content; /* let table size to content, wrapper clips+scrolls */
  }
}

@media (max-width: 480px) {
  /* On small phones the 3-column table can't fit even with scrolling —
     hide the competitor column and show a 2-column Feature | Narratiq view */
  .cmp-table th:last-child,
  .cmp-table td:last-child {
    display: none;
  }

  /* 2-column table fits inline — no need for the scroll wrapper */
  .cmp-table-wrap {
    overflow-x: visible;
    border: none;
    border-radius: 0;
    margin: 24px 0 32px;
  }

  .cmp-table-wrap .cmp-table {
    width: 100%;
    min-width: 0;
  }
}

/* --------------------------------------------------------------------------
   Waitlist form
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .waitlist-form {
    flex-direction: column;
  }

  .waitlist-form .btn-primary {
    width: 100%;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   Pricing cards
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Pricing uses a custom 3-col grid in sections.njk; collapse it */
  .pricing-grid {
    grid-template-columns: 1fr !important;
    max-width: 400px;
    margin: 0 auto;
  }
}

/* --------------------------------------------------------------------------
   Steps (How it works)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .steps::before {
    left: 19px;
  }

  .step {
    gap: 20px;
  }
}

/* --------------------------------------------------------------------------
   Resource pages
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .resource-lead {
    font-size: 16px;
  }

  .resource-cta {
    padding: 36px 24px;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
}

@media (max-width: 400px) {
  /* 4 footer links + 24px gaps exceed ~375px viewports — allow wrapping */
  .footer-nav {
    flex-wrap: wrap;
    gap: 8px 16px;
  }
}

/* --------------------------------------------------------------------------
   Global safety net — prevent ANY element from causing horizontal overflow
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Catch-all: images and embeds never exceed their container */
  img, video, iframe, svg {
    max-width: 100%;
  }

  /* Nuclear backstop: document never scrolls horizontally.
     Tables inside .cmp-table-wrap still scroll internally via overflow-x:auto.
     Note: overflow-x:hidden on html+body propagates to the viewport in Chrome/Firefox. */
  html, body {
    overflow-x: hidden;
  }
}
