/* ============================================
   MOBILE RESPONSIVENESS FIX
   Ensures all pages fit within phone-width screens
   No horizontal overflow, all content contained
   ============================================ */

/* ========== GLOBAL OVERFLOW PROTECTION ========== */
html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  min-width: 0;
}

/* Prevent ANY element from causing horizontal overflow */
*,
*::before,
*::after {
  max-width: 100%;
  box-sizing: border-box;
}

/* Exceptions for elements that need to exceed parent */
.mca-sidebar,
.mca-sidebar *,
.mobile-nav,
.mobile-nav *,
.mca-sidebar-overlay,
.mobile-nav-overlay,
[style*="position: fixed"],
[style*="position:fixed"] {
  max-width: none;
}

/* Images and media should never overflow */
img,
video,
iframe,
embed,
object,
svg:not([data-lucide]) {
  max-width: 100%;
  height: auto;
}

/* Tables should scroll horizontally within their container */
table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Only use display:block for tables that actually overflow (handled per-breakpoint below) */

/* Pre/code blocks scroll instead of overflow */
pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}


/* ========== TABLET (max-width: 992px) ========== */
@media (max-width: 992px) {

  /* --- NAVIGATION --- */
  /* Force hide desktop nav and show mobile toggle */
  .header .navbar-collapse {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: block !important;
  }

  /* --- GRIDS COLLAPSE TO FEWER COLUMNS --- */
  .rnw-benefits-grid,
  .rnw-uses-grid,
  .rnw-steps,
  .rnw-reviews-grid,
  .rnw-thinking-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rnw-steps::before {
    display: none;
  }

  .testimonials-grid,
  .products-grid,
  .comparison-preview-grid {
    grid-template-columns: 1fr;
  }

  /* --- TWO-COLUMN LAYOUTS STACK --- */
  .split-section,
  .split-content,
  .flex-columns,
  .split-wrap,
  .apply-trust-layout {
    grid-template-columns: 1fr !important;
    flex-direction: column;
  }

  .apply-trust-layout {
    gap: 40px;
  }

  /* --- CALCULATOR --- */
  .calculator-split-container {
    grid-template-columns: 1fr;
  }

  /* --- HERO WITH SLIDER --- */
  .hero-with-slider {
    grid-template-columns: 1fr;
    gap: 32px;
    min-height: auto;
  }

  /* --- PROMO BANNER --- */
  .promo-banner {
    padding: 60px 24px;
  }

  .promo-banner-content {
    max-width: 100%;
  }
}


/* ========== MOBILE (max-width: 768px) ========== */
@media (max-width: 768px) {

  /* --- HEADER --- */
  .navbar-top-default {
    height: 66px;
  }

  .header .logo img {
    height: 26px;
  }

  /* --- CONTAINER PADDING --- */
  .container {
    padding: 0 16px;
  }

  /* --- TYPOGRAPHY SCALE DOWN --- */
  h1 {
    font-size: 1.75rem !important;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.5rem !important;
    line-height: 1.25;
  }

  h3 {
    font-size: 1.125rem !important;
  }

  .hero h1,
  .hero-section h1 {
    font-size: 2rem !important;
  }

  .maintitlefix {
    font-size: 2rem !important;
  }

  .hero-title {
    font-size: 2rem !important;
  }

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

  /* --- ALL GRIDS GO SINGLE COLUMN --- */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
  }

  .loan-params,
  .benefits-grid,
  .process-steps,
  .features-row,
  .solutions-grid,
  .contact-info,
  .faq-grid,
  .icon-grid,
  .mixed-benefits,
  .steps-grid,
  .product-grid,
  .data-cards-grid,
  .as-heard-on {
    grid-template-columns: 1fr !important;
  }

  .rnw-benefits-grid,
  .rnw-uses-grid,
  .rnw-steps,
  .rnw-reviews-grid,
  .rnw-thinking-grid {
    grid-template-columns: 1fr;
  }

  .mixed-benefits .benefit-card.wide {
    grid-column: span 1;
  }

  /* --- OFFSET GRID FIX --- */
  .offset-grid {
    grid-template-columns: 1fr !important;
  }

  .offset-grid .card:nth-child(2),
  .offset-grid .card:nth-child(5) {
    transform: translateY(0);
  }

  /* --- ASYMMETRIC GRID --- */
  .asymmetric-grid,
  .asymmetric-grid.reverse {
    grid-template-columns: 1fr !important;
  }

  /* --- SPLIT SECTIONS --- */
  .split-section {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .split-left .split-image,
  .split-right .split-image,
  .split-left .split-content,
  .split-right .split-content {
    order: unset;
  }

  .split-content h2 {
    font-size: 1.5rem !important;
  }

  /* --- TIMELINE --- */
  .timeline-section {
    padding: 0 8px;
  }

  .timeline-item {
    grid-template-columns: 44px 1fr;
    gap: 16px;
  }

  .timeline-number {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .timeline-content {
    padding: 1.25rem;
  }

  .timeline-item::before {
    left: 22px;
  }

  /* --- CALCULATOR SPLIT PANEL --- */
  .calculator-split-container {
    grid-template-columns: 1fr !important;
    border-radius: 12px;
  }

  .calculator-left-panel {
    padding: 32px 20px;
  }

  .calculator-left-panel h2 {
    font-size: 1.5rem !important;
  }

  .calculator-right-panel {
    padding: 24px 16px;
  }

  .calculator-content-wrapper {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  /* --- STAT HERO --- */
  .stat-hero-number {
    font-size: 40px;
  }

  .stat-hero-label {
    font-size: 16px;
  }

  /* --- CONTACT FORM --- */
  .contact-form {
    padding: 1.5rem 1rem;
  }

  /* --- SECTION PADDING --- */
  .section,
  .section--lg,
  .section-marketing,
  .section-marketing--alt {
    padding: 48px 0;
  }

  .hero-section {
    padding: 80px 0 60px;
    min-height: auto;
  }

  .dark-section {
    padding: 48px 0;
  }

  .dark-section h2 {
    font-size: 1.5rem !important;
  }

  .cta-section {
    padding: 48px 0;
  }

  .cta-section h2 {
    font-size: 1.5rem !important;
  }

  .cta-section .btn {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .testimonial-section {
    padding: 48px 0;
  }

  .seek-no-more-section {
    padding: 48px 0;
  }

  .seek-no-more-card {
    padding: 32px 20px;
  }

  .seek-amount-display {
    font-size: 36px;
  }

  /* --- HERO STATS --- */
  .hero-stats-inline {
    gap: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-stat-number {
    font-size: 24px;
  }

  /* --- FULL IMAGE SECTION --- */
  .full-image-section {
    min-height: 300px;
  }

  .full-image-content h2 {
    font-size: 1.75rem !important;
  }

  .full-image-content p {
    font-size: 1rem;
  }

  /* --- HERO WITH BACKGROUND IMAGE --- */
  .hero-with-image {
    min-height: 400px;
  }

  /* --- SLIDER CARD --- */
  .slider-card-inner {
    padding: 24px 20px;
  }

  .slider-card-amount {
    font-size: 2rem;
  }

  .slider-card-label {
    font-size: 1.25rem;
  }

  /* --- FUNDING SLIDER --- */
  .funding-slider-title {
    font-size: 1.5rem !important;
  }

  .funding-amount {
    font-size: 36px;
  }

  .funding-slider-container {
    padding: 24px 16px;
  }

  /* --- FAQ --- */
  .faq-question {
    padding: 16px 14px;
    font-size: 15px;
  }

  .faq-answer-content {
    padding: 0 14px 16px;
    font-size: 14px;
  }

  /* --- TESTIMONIAL CARDS --- */
  .testimonials-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  .testimonial-card {
    padding: 24px 20px;
  }

  /* --- PRODUCT CARDS --- */
  .product-card-enhanced {
    padding: 28px 20px;
  }

  .product-icon-wrapper {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }

  .product-icon-wrapper img {
    width: 48px;
    height: 48px;
  }

  .product-card-title {
    font-size: 1.1rem;
    min-height: auto;
  }

  .product-card-description {
    min-height: auto;
  }

  /* --- BUTTONS --- */
  .btn-lg {
    padding: 12px 24px;
    font-size: 15px;
  }

  .hero-cta-btn,
  .step-cta-btn,
  .cta-btn-large,
  .section-cta-btn {
    padding: 14px 28px;
    font-size: 1rem;
    width: 100%;
    text-align: center;
  }

  /* --- FOOTER --- */
  .footer {
    padding: 40px 0 30px;
  }

  .footer .row {
    flex-direction: column;
  }

  .footer-col {
    margin-bottom: 24px;
  }

  .footer-text-primary,
  .footer-text-small {
    font-size: 0.85rem;
  }

  /* --- BLOG POST LIST --- */
  .post-card .card-content {
    padding: 1rem;
  }

  .post-card h3 {
    font-size: 1rem;
  }

  /* --- ARTICLE CONTAINER --- */
  .article-container {
    padding: 20px 16px;
  }

  .article-container h1 {
    font-size: 1.75rem !important;
  }

  .article-container h2 {
    font-size: 1.375rem !important;
    margin-top: 2rem;
  }

  .article-container blockquote {
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
  }

  .article-container blockquote::before {
    font-size: 2.5rem;
    top: -0.25rem;
    left: 0.5rem;
  }

  /* --- COMPARISON TABLE --- */
  .comparison-table-wrapper {
    border-radius: 12px;
  }

  .comparison-table {
    min-width: 560px;
  }

  /* --- KEY TAKEAWAYS --- */
  .key-takeaways-section {
    padding: 1.5rem;
  }

  .key-takeaways-heading {
    font-size: 1.25rem;
  }

  .key-takeaways-item {
    padding: 0.75rem 0.75rem 0.75rem 2.25rem;
    font-size: 0.95rem;
  }

  /* --- QUICK ANSWER --- */
  .quick-answer-heading {
    font-size: 1.5rem;
  }

  /* --- DATA CARDS --- */
  .data-cards-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- STEP ROW --- */
  .step-row {
    flex-direction: column;
    gap: 16px;
  }

  .step-content {
    padding-left: 0;
  }

  /* --- PROMO BANNER --- */
  .promo-banner {
    padding: 40px 20px;
    border-radius: 12px;
  }

  .promo-banner-title {
    font-size: 1.5rem !important;
  }

  /* --- PROMO HERO --- */
  .promo-hero-cta-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .promo-hero-cta-wrapper .btn {
    width: 100%;
    text-align: center;
  }

  /* --- PXP PROMO IMAGE --- */
  .pxp-promo-img {
    padding-left: 0;
  }

  /* --- CL/RENEWAL HERO --- */
  .cl-hero {
    padding: 60px 0;
    min-height: auto;
  }

  .cl-hero-content {
    flex-direction: column;
    gap: 32px;
    text-align: center;
  }

  .cl-hero-text {
    max-width: 100%;
  }

  .cl-hero-text h1 {
    font-size: 2rem !important;
  }

  .cl-form-container {
    max-width: 100%;
    width: 100%;
  }

  .cl-form-card {
    padding: 24px 20px;
  }

  /* --- RENEWAL HERO --- */
  .rnw-hero {
    padding: 24px 0;
  }

  .rnw-hero-content {
    flex-direction: column;
    gap: 24px;
    text-align: center;
  }

  .rnw-hero-text {
    max-width: 100%;
  }

  .rnw-hero-text h1 {
    font-size: 1.75rem !important;
  }

  .rnw-form-container {
    max-width: 100%;
    width: 100%;
  }

  .rnw-form-card {
    padding: 20px 16px;
  }

  .rnw-features {
    justify-content: center;
  }

  /* --- RENEWAL SECTIONS --- */
  .rnw-section-title {
    font-size: 1.5rem !important;
  }

  .rnw-benefits-grid,
  .rnw-uses-grid,
  .rnw-reviews-grid,
  .rnw-thinking-grid {
    grid-template-columns: 1fr !important;
  }

  .rnw-steps {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }

  .rnw-steps::before {
    display: none;
  }

  /* --- RENEWAL TABLE --- */
  .rnw-table-wrap {
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .rnw-table {
    min-width: 500px;
  }

  /* --- SOCIAL PROOF TOAST --- */
  .social-proof-toast {
    left: 12px;
    right: 12px;
    max-width: none;
  }

  /* --- STICKY CTA --- */
  .sticky-cta {
    left: 12px;
  }

  /* --- AS HEARD ON --- */
  .aho-logos,
  .as-heard-row {
    gap: 20px;
    justify-content: center;
  }

  .aho-logo-cnn,
  .aho-logo-espn,
  .aho-logo-sirius,
  .aho-logo-fox,
  .aho-logo-msnbc {
    height: 30px;
  }

  /* --- WHITECARD --- */
  .whitecard {
    padding: 24px 16px;
  }

  /* --- BENEFIT CARD --- */
  .benefit-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 1rem;
  }

  /* --- APPLY TRUST --- */
  .apply-trust-layout {
    grid-template-columns: 1fr !important;
    gap: 32px;
  }

  .apply-trust-numbers {
    justify-content: center;
    flex-wrap: wrap;
  }

  .apply-trust-left {
    text-align: center;
  }

  /* --- INDUSTRIES --- */
  .industries {
    gap: 8px;
    justify-content: center;
  }

  .industry-tag {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* --- CTA BAND --- */
  .cta-band {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 20px 16px;
  }

  /* --- TRUST STRIP --- */
  .trust-strip .media-logos {
    gap: 24px;
  }

  .trust-strip .media-logos img {
    height: 18px;
  }

  /* --- POST DETAIL META --- */
  .article-container .post-meta {
    flex-direction: column;
    gap: 8px;
  }

  .social-share {
    justify-content: center;
  }

  /* --- LEAD FORM ADJUSTMENTS --- */
  .lead-form--full-page {
    padding: 24px 16px;
    margin: 0 8px;
  }

  .lead-form__funding-display {
    font-size: 32px;
  }

  .lead-form__form-grid {
    grid-template-columns: 1fr;
  }

  .lead-form__radio-group {
    grid-template-columns: 1fr;
  }
}


/* ========== SMALL MOBILE (max-width: 480px) ========== */
@media (max-width: 480px) {

  /* Even tighter container */
  .container {
    padding: 0 12px;
  }

  /* Smaller typography */
  h1 {
    font-size: 1.5rem !important;
  }

  h2 {
    font-size: 1.25rem !important;
  }

  .hero h1,
  .hero-section h1 {
    font-size: 1.5rem !important;
  }

  .maintitlefix {
    font-size: 1.5rem !important;
  }

  .hero-title {
    font-size: 1.5rem !important;
  }

  .hero-subtitle {
    font-size: 1rem !important;
  }

  /* Stats */
  .stat-hero-number {
    font-size: 32px;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  /* Funding displays */
  .seek-amount-display {
    font-size: 28px;
  }

  .funding-amount {
    font-size: 28px;
  }

  .funding-amount-inline {
    font-size: 28px;
  }

  .slider-card-amount {
    font-size: 1.75rem;
  }

  /* Cards more compact */
  .card {
    padding: 1.25rem 1rem;
  }

  .param-card {
    padding: 1.25rem 1rem;
  }

  .step-card {
    padding: 20px 16px;
  }

  /* Buttons full-width */
  .btn {
    width: 100%;
    text-align: center;
  }

  .btn-lg {
    padding: 12px 20px;
    font-size: 14px;
  }

  /* Footer */
  .footer-copyright {
    font-size: 0.8rem;
  }

  /* Article */
  .article-container {
    padding: 16px 12px;
    font-size: 1rem;
    line-height: 1.7;
  }

  .article-container h1 {
    font-size: 1.5rem !important;
  }

  .article-container h2 {
    font-size: 1.25rem !important;
  }

  .article-container p {
    font-size: 1rem;
  }

  /* Comparison table scroll hint */
  .comparison-table-wrapper::before {
    content: "← Scroll to see more →";
    display: block;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    padding: 8px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
  }

  /* Sidebar CTA hidden on very small screens (too intrusive) */
  .sticky-cta-btn span {
    display: none;
  }

  .sticky-cta-btn {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  /* MCA Sidebar full-width on mobile */
  .mca-sidebar {
    width: 100%;
  }

  .mca-form-container {
    padding: 60px 16px 24px;
  }

  .mca-step-title {
    font-size: 18px;
  }
}


/* ========== LANDSCAPE PHONE FIX ========== */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-section {
    padding: 48px 0;
    min-height: auto;
  }

  .hero-with-image {
    min-height: 300px;
  }

  .full-image-section {
    min-height: 250px;
  }
}
