/* Mobile-only header and hero sizing fixes shared by every Metrixblue page. */

@media (max-width: 980px) {
    html body .navbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 5000 !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
    }

    html body .navbar .nav-container,
    html body .navbar > .container {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 4.5rem !important;
        padding: 0.65rem clamp(0.85rem, 4vw, 1.5rem) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.75rem !important;
        box-sizing: border-box !important;
    }

    html body .navbar .nav-container > *,
    html body .navbar > .container > * {
        min-width: 0 !important;
    }

    html body .navbar .logo {
        min-width: 0 !important;
        max-width: calc(100% - 3.75rem) !important;
        font-size: clamp(1.35rem, 6vw, 1.7rem) !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    html body .navbar .dark-toggle-desktop {
        display: none !important;
    }

    html body .navbar .nav-toggle {
        position: relative !important;
        z-index: 5003 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 2.75rem !important;
        width: 2.75rem !important;
        height: 2.75rem !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 1px solid rgba(255, 255, 255, 0.26) !important;
        border-radius: 999px !important;
        color: #fff !important;
        background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.28) !important;
        cursor: pointer !important;
    }

    html body .navbar .nav-toggle .bar,
    html body .navbar .nav-toggle .bar::before,
    html body .navbar .nav-toggle .bar::after {
        width: 1.25rem !important;
        height: 2px !important;
        background: #fff !important;
    }

    html body .navbar .nav-toggle .bar::before {
        top: -6px !important;
    }

    html body .navbar .nav-toggle .bar::after {
        bottom: -6px !important;
    }

    html body .navbar .nav-toggle.active .bar {
        background: transparent !important;
    }

    html body .navbar .nav-toggle.active .bar::before {
        top: 0 !important;
        transform: rotate(45deg) !important;
    }

    html body .navbar .nav-toggle.active .bar::after {
        bottom: 0 !important;
        transform: rotate(-45deg) !important;
    }

    html body .navbar .nav-toggle:focus-visible {
        outline: 3px solid rgba(34, 211, 238, 0.9) !important;
        outline-offset: 3px !important;
    }

    html body .navbar .nav-overlay {
        position: fixed !important;
        inset: 0 !important;
        z-index: 5000 !important;
        display: block !important;
        background: rgba(5, 7, 12, 0.56) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 220ms ease !important;
        backdrop-filter: blur(3px) !important;
        -webkit-backdrop-filter: blur(3px) !important;
    }

    html body .navbar .nav-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    html body .navbar .nav-menu {
        position: fixed !important;
        top: 5rem !important;
        left: clamp(0.75rem, 3vw, 1.25rem) !important;
        right: clamp(0.75rem, 3vw, 1.25rem) !important;
        bottom: auto !important;
        z-index: 5002 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 0.25rem !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: calc(100dvh - 5.75rem) !important;
        margin: 0 !important;
        padding: 0.75rem !important;
        overflow-x: clip !important;
        overflow-y: auto !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 1.35rem !important;
        background: rgba(10, 15, 30, 0.97) !important;
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(-0.75rem) scale(0.985) !important;
        transform-origin: top center !important;
        transition: opacity 220ms ease, transform 220ms ease !important;
        backdrop-filter: blur(18px) !important;
        -webkit-backdrop-filter: blur(18px) !important;
        overscroll-behavior: contain !important;
    }

    html body .navbar .nav-menu.open,
    html body .navbar .nav-menu.active {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateY(0) scale(1) !important;
    }

    html body .navbar .nav-menu .nav-link {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        min-height: 2.75rem !important;
        margin: 0 !important;
        padding: 0.72rem 0.9rem !important;
        border-radius: 0.8rem !important;
        color: rgba(255, 255, 255, 0.78) !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
        text-align: left !important;
        text-decoration: none !important;
    }

    html body .navbar .nav-menu .nav-link::after {
        display: none !important;
    }

    html body .navbar .nav-menu .nav-link:hover,
    html body .navbar .nav-menu .nav-link:focus-visible,
    html body .navbar .nav-menu .nav-link.active {
        color: #fff !important;
        background: rgba(59, 130, 246, 0.16) !important;
    }

    html body .navbar .nav-menu .nav-link:focus-visible,
    html body .navbar .nav-menu .nav-cta:focus-visible,
    html body .navbar .nav-menu .dark-toggle-mobile:focus-visible {
        outline: 2px solid #22d3ee !important;
        outline-offset: 2px !important;
    }

    html body .navbar .nav-menu .nav-cta {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 3rem !important;
        margin: 0.45rem 0 0 !important;
        padding: 0.85rem 1rem !important;
        border-radius: 999px !important;
        color: #fff !important;
        background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
    }

    html body .navbar .nav-menu .dark-toggle-mobile {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        min-height: 2.75rem !important;
        margin: 0.35rem 0 0 !important;
        border-color: rgba(255, 255, 255, 0.12) !important;
        border-radius: 999px !important;
        color: rgba(255, 255, 255, 0.8) !important;
        background: rgba(255, 255, 255, 0.06) !important;
    }

    html body.menu-open {
        overflow: hidden !important;
        overscroll-behavior: none !important;
    }

    html body .container {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Fix the actual hero sizing causes instead of masking page overflow. */
    html body .hero,
    html body .service-hero {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding-top: clamp(7rem, 18vw, 8.5rem) !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        box-sizing: border-box !important;
    }

    html body .hero > .container,
    html body .service-hero > .container {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-right: auto !important;
        margin-left: auto !important;
        padding-right: clamp(1rem, 5vw, 2rem) !important;
        padding-left: clamp(1rem, 5vw, 2rem) !important;
        box-sizing: border-box !important;
    }

    html body .hero .hero-content,
    html body .service-hero .hero-content,
    html body .service-hero .hero-grid,
    html body .service-hero .hero-image {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    html body .service-hero .hero-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    html body .hero .hero-content > *,
    html body .service-hero .hero-content > * {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    html body .hero h1,
    html body .service-hero h1,
    html body .hero .hero-content h1,
    html body .service-hero .hero-content h1 {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-right: auto !important;
        margin-left: auto !important;
        font-size: clamp(2rem, 9vw, 3.5rem) !important;
        line-height: 1.08 !important;
        letter-spacing: -0.035em !important;
        white-space: normal !important;
        text-wrap: balance !important;
    }

    html body .hero .section-subhead,
    html body .service-hero .section-subhead,
    html body .hero-content .section-subhead {
        width: 100% !important;
        max-width: 42rem !important;
        min-width: 0 !important;
        margin-right: auto !important;
        margin-left: auto !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        font-size: clamp(0.98rem, 2.5vw, 1.1rem) !important;
        line-height: 1.7 !important;
        white-space: normal !important;
        text-wrap: pretty !important;
    }

    html body .hero .hero-badge,
    html body .service-hero .hero-badge {
        width: fit-content !important;
        max-width: 100% !important;
        min-width: 0 !important;
        justify-content: center !important;
        padding: 0.5rem clamp(0.8rem, 3vw, 1.35rem) !important;
        white-space: normal !important;
        text-align: center !important;
        line-height: 1.4 !important;
    }

    html body .hero .hero-actions,
    html body .service-hero .hero-actions {
        width: 100% !important;
        max-width: 44rem !important;
        min-width: 0 !important;
        margin-right: auto !important;
        margin-left: auto !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.8rem !important;
    }

    html body .hero .hero-actions .btn,
    html body .service-hero .hero-actions .btn {
        max-width: 100% !important;
        min-width: 0 !important;
        white-space: normal !important;
        text-align: center !important;
    }

    html body .hero .hero-actions .btn i,
    html body .service-hero .hero-actions .btn i {
        flex: 0 0 auto !important;
    }

    html body .hero .hero-trust,
    html body .service-hero .hero-trust,
    html body .hero .hero-stats-compact,
    html body .service-hero .hero-stats-compact {
        width: 100% !important;
        max-width: 48rem !important;
        min-width: 0 !important;
        margin-right: auto !important;
        margin-left: auto !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    html body .hero .hero-trust .trust-item,
    html body .service-hero .hero-trust .trust-item,
    html body .hero .hero-stats-compact .stat-item,
    html body .service-hero .hero-stats-compact .stat-item {
        max-width: 100% !important;
        min-width: 0 !important;
        white-space: normal !important;
    }

    html body .service-hero .hero-image {
        margin-right: auto !important;
        margin-left: auto !important;
    }

    html body .service-hero .hero-image img,
    html body .hero .hero-image img {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        object-fit: cover !important;
    }

    html body .stats-bar > .container,
    html body .stats-bar .container {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding-right: clamp(1rem, 5vw, 2rem) !important;
        padding-left: clamp(1rem, 5vw, 2rem) !important;
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)) !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    html body .stats-bar .stat-item {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 0.65rem 0.4rem !important;
    }

    html body .stats-bar .stat-item .label {
        display: block !important;
        max-width: 100% !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
    }

    /* Allow legacy two-column grids to shrink without widening the page. */
    html body .genre-grid > *,
    html body .tool-grid > *,
    html body .tools-grid > *,
    html body .methodology-grid > *,
    html body .type-grid > *,
    html body .metric-grid > *,
    html body .platform-grid > *,
    html body .pricing-grid > * {
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-wrap: break-word !important;
    }

    html body .testimonials-slider {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

@media (max-width: 540px) {
    html body .hero,
    html body .service-hero {
        padding-top: 6.75rem !important;
        padding-bottom: clamp(3rem, 12vw, 4.5rem) !important;
    }

    html body .hero h1,
    html body .service-hero h1,
    html body .hero .hero-content h1,
    html body .service-hero .hero-content h1 {
        font-size: clamp(1.9rem, 9.5vw, 2.55rem) !important;
        line-height: 1.1 !important;
    }

    html body .hero .hero-actions,
    html body .service-hero .hero-actions {
        flex-direction: column !important;
        align-items: center !important;
    }

    html body .hero .hero-actions .btn,
    html body .service-hero .hero-actions .btn {
        width: 100% !important;
        max-width: 22rem !important;
        min-height: 3.25rem !important;
        padding-right: 1rem !important;
        padding-left: 1rem !important;
    }

    html body .hero .hero-trust,
    html body .service-hero .hero-trust {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.55rem !important;
    }

    html body .hero .hero-trust .trust-divider,
    html body .service-hero .hero-trust .trust-divider,
    html body .hero .hero-stats-compact .stat-divider,
    html body .service-hero .hero-stats-compact .stat-divider {
        display: none !important;
    }

    html body .hero .hero-stats-compact,
    html body .service-hero .hero-stats-compact {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.65rem !important;
    }

    html body .stats-bar > .container,
    html body .stats-bar .container {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 360px) {
    html body .navbar .nav-container,
    html body .navbar > .container {
        padding-right: 0.75rem !important;
        padding-left: 0.75rem !important;
    }

    html body .hero > .container,
    html body .service-hero > .container {
        padding-right: 0.9rem !important;
        padding-left: 0.9rem !important;
    }

    html body .hero h1,
    html body .service-hero h1,
    html body .hero .hero-content h1,
    html body .service-hero .hero-content h1 {
        font-size: 1.88rem !important;
    }

    html body .hero .hero-badge,
    html body .service-hero .hero-badge {
        font-size: 0.64rem !important;
        letter-spacing: 0.1em !important;
    }

    html body .genre-grid,
    html body .tool-grid,
    html body .tools-grid,
    html body .methodology-grid,
    html body .type-grid,
    html body .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    html body .platform-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    html body .pricing-grid {
        width: 100% !important;
        max-width: 100% !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html body .navbar .nav-menu,
    html body .navbar .nav-overlay {
        transition: none !important;
    }
}
