/* css/mobile-optimize.css — Phase 2 Sitewide Public Website Mobile Optimization */

/* Global horizontal overflow guard on mobile viewports without breaking sticky positioning */
@media (max-width: 960px) {
    html, body {
        overflow-x: clip !important;
        max-width: 100% !important;
    }

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

    /* Keep mobile dropdown nav scrollable on short phone screens */
    .mobile-nav {
        max-height: calc(100dvh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    .nav-mobile-toggle {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Prevent iOS Safari input auto-zoom & mobile clipping on every public form */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    textarea {
        font-size: 16px !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Prevent CSS Grid tracks & form cards from blowing past viewport width on narrow phones */
    .quote-layout,
    .parts-inquiry-inner,
    .parts-pub-hero-inner,
    .portal-entry-grid,
    .contact-grid,
    .form-grid,
    .form-row {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .quote-layout > *,
    .parts-inquiry-inner > *,
    .contact-grid > *,
    .form-grid > *,
    .form-row > *,
    .quote-form-container,
    .parts-form-box,
    .parts-side-box,
    .contact-info-stack,
    .contact-info-card,
    .contact-form-container {
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Touch-friendly tap targets across public forms, catalog filters & CTA buttons */
    .btn, .btn-primary, .btn-secondary, .btn-outline,
    .filter-pill, .cat-pill, .tab-btn, .catalog-tab {
        min-height: 42px;
    }

    /* Smooth horizontal scroll wrapper for wide public spec / comparison tables */
    .rh-table-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .nav-inner {
        padding-left: 14px !important;
        padding-right: 14px !important;
        gap: 8px !important;
    }
    .nav-logo span {
        font-size: 0.88rem !important;
        letter-spacing: 0.4px !important;
    }
    .nav-logo img {
        height: 30px !important;
        width: auto !important;
    }
    .nav-cta {
        padding: 8px 10px !important;
        font-size: 0.68rem !important;
    }

    /* Keep public containers within viewport on 360-430px phones */
    .container, .section-inner, .hero-inner, .footer-inner,
    .catalog-wrap, .machine-wrap, .quote-wrap, .dealers-wrap {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Hero & headline scaling so long headings never push horizontally */
    .hero h1, .page-hero h1 {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* Sticky Public Mobile Action Bar (Marketing & Catalog pages only) */
    body.rh-has-mobile-cta {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .rh-mobile-cta-bar {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1.35fr;
        gap: 6px;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        background: #09090b;
        border-top: 2px solid #da291c;
        z-index: 1850;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
        box-sizing: border-box;
    }
    .rh-mcta-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        min-height: 44px;
        padding: 6px 8px;
        border: 1.5px solid #3f3f46;
        background: #18181b;
        color: #fff !important;
        text-decoration: none !important;
        font-family: var(--font-mono, 'Space Mono', monospace);
        font-size: 0.67rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        white-space: nowrap;
        text-align: center;
    }
    .rh-mcta-btn.primary {
        background: #da291c;
        border-color: #da291c;
        color: #fff !important;
    }
    .rh-mcta-btn:active {
        transform: scale(0.98);
    }
}

/* Hide mobile sticky bar on Desktop, in Print, and inside Iframes */
.rh-mobile-cta-bar {
    display: none;
}

@media print {
    .rh-mobile-cta-bar {
        display: none !important;
    }
}
