/* ==========================================================
   mobile-fix.css v7 — Targeted adaptation (not destruction)

   v6 used "nuclear" approach: * { border:none; box-shadow:none }
   which destroyed ALL visual design.

   v7: ONLY replaces backdrop-filter:blur() with solid backgrounds.
   Preserves all borders, shadows, border-radius, visual hierarchy.
   ========================================================== */

/* ==========================================================
   A. Scroll Containment
   ========================================================== */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }
}

/* ==========================================================
   B. Navbar — keep glass pill on mobile, just adapt sizing
   ========================================================== */
@media (max-width: 768px) {
    .navbar {
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        width: 94%;
        max-width: 100%;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.28);
        backdrop-filter: blur(20px) saturate(1.1);
        -webkit-backdrop-filter: blur(20px) saturate(1.1);
        border: 1px solid rgba(255, 255, 255, 0.25);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.03);
        padding: 8px 16px;
        position: fixed;
        z-index: 9999;
    }

    .navbar-container {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 8px;
    }
}

/* ==========================================================
   C. Hamburger and mobile menu
   ========================================================== */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex !important;
        z-index: 999999;
        background: transparent;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        pointer-events: auto;
        position: relative;
    }

    .hamburger-line {
        background: #111;
    }

    .nav-links {
        display: none !important;
    }

    .nav-account-link {
        display: none !important;
    }

    .mobile-menu-content {
        background: rgba(255, 255, 255, 0.72);
        backdrop-filter: blur(40px) saturate(1.4);
        -webkit-backdrop-filter: blur(40px) saturate(1.4);
    }

    .mobile-sidebar {
        background: #fff;
    }

    .mobile-menu-overlay::before {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
    }
}

/* ==========================================================
   D. Backdrop-filter → solid backgrounds (LIGHT elements)

   Formula: rgba(255,255,255, X) + blur → rgba(255,255,255, max(X, 0.92)) without blur
   ========================================================== */
@media (max-width: 768px) {
    .hero-text-wrapper {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.97);
    }

    .float-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.92);
    }

    .howitworks2-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.92);
    }

    .ev-bento-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .sv-step-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .ev-badge,
    .sv-hero-badge {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .why-bento-tags span {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .faq-card,
    .faq-item {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .process-step,
    .step-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .callback-v2 {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .infographics-hero-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .blog-card,
    .blog-post-card,
    .blog-category-card,
    .blog-sidebar-card,
    .blog-featured-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .sv-card,
    .sv-feature-card,
    .sv-benefit-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .ev-trust-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .cases-niche-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .evox-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }
}

/* ==========================================================
   E. Backdrop-filter → solid backgrounds (DARK elements)
   ========================================================== */
@media (max-width: 768px) {
    .calc-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(30, 41, 59, 0.95);
    }

    .calc-mp-tab {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.08);
    }

    .evo-float-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(15, 23, 42, 0.85);
    }
}

/* ==========================================================
   F. Modal overlays — backdrop-filter fix
   ========================================================== */
@media (max-width: 768px) {
    #paywallModal,
    .modal-overlay,
    .service-modal-overlay,
    .cm-modal {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(0, 0, 0, 0.5);
    }
}

/* ==========================================================
   G. Forced visibility — SPECIFIC elements with opacity:0
      waiting for .is-visible from IntersectionObserver
   ========================================================== */
@media (max-width: 768px) {
    .howitworks2-header,
    .howitworks2-card {
        opacity: 1;
        transform: none;
        visibility: visible;
    }

    .hero-trust-glow,
    .hero-trust-image-wrap,
    .hero-trust-quote,
    .hero-trust-text-wrap {
        opacity: 1;
        transform: none;
        visibility: visible;
    }

    .why-bento-glow {
        opacity: 1;
    }

    .hero-visual-container,
    .hero-card-wrap {
        opacity: 1;
        transform: none;
        visibility: visible;
    }
}

/* ==========================================================
   H. Hide decorative overflow elements
      Keep bg-orbs & blobs for visual depth, hide only
      elements that cause horizontal scroll or heavy perf hit
   ========================================================== */
@media (max-width: 768px) {
    /* Heavy animations — hide */
    .orbit-system,
    .orbit-ring,
    .orbit-center,
    .why-orbit-ring,
    .why-orbit-spark,
    .design-slide-sparkle,
    .evox-bg-grid,
    .photo-collage,
    .photo-showcase {
        display: none;
    }

    /* Orbs — keep but contain */
    .bg-orb {
        display: block;
        filter: blur(60px);
        opacity: 0.25;
    }
    .bg-orb.orb-1 { width: 180px; height: 180px; top: 5%;  left: -5%; }
    .bg-orb.orb-2 { width: 160px; height: 160px; bottom: 10%; right: -5%; }
    .bg-orb.orb-3 { width: 140px; height: 140px; }

    /* Blobs behind hero card — keep for glass depth */
    .hero-card-blobs,
    .hero-card-blob {
        display: block;
    }
    .hero-card-blobs { inset: -20px; }
    .hero-card-blob { filter: blur(50px); opacity: 0.35; animation: none; }
    .hero-card-blob--1 { width: 140px; height: 140px; }
    .hero-card-blob--2 { width: 120px; height: 120px; }
    .hero-card-blob--3 { width: 130px; height: 130px; }
    .hero-card-blob--4 { width: 100px; height: 100px; }

    /* Glow behind phone — subtle */
    .hero-bg-glow {
        display: block;
        opacity: 0.15;
        filter: blur(60px);
    }
}

/* ==========================================================
   I. Hero phone + float-cards
      Phone centered, compact. Two float-cards overlay near
      top-left and top-right edges of the phone.
   ========================================================== */
@media (max-width: 768px) {
    .hero-visual-container {
        display: block;
        position: relative;
        width: 220px;
        height: 420px;
        margin: 20px auto 0;
        padding: 0;
        overflow: visible;
        transform: none;
    }

    .hero-visual-container .phone-mockup {
        position: relative;
        z-index: 2;
        width: 100%;
        height: 100%;
        border-width: 5px;
        border-radius: 28px;
    }

    .hero-visual-container .phone-mockup .notch {
        width: 90px;
        height: 18px;
    }

    .hero-visual-container .phone-screen {
        padding-top: 28px;
    }

    /* Glow behind phone */
    .hero-visual-container .hero-bg-glow {
        position: absolute;
    }

    /* Float cards: small overlays pinned to phone edges */
    .hero-visual-container .float-card {
        position: absolute;
        z-index: 3;
        min-width: 0;
        width: auto;
        padding: 8px 10px;
        border-radius: 14px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
        animation: float-mobile 5s ease-in-out infinite;
    }

    .hero-visual-container .float-card.top-left {
        top: -10px;
        left: -32px;
        right: auto;
        bottom: auto;
        transform: none;
    }

    .hero-visual-container .float-card.top-right {
        top: -10px;
        right: -32px;
        left: auto;
        bottom: auto;
        transform: none;
        animation-delay: 1.5s;
    }

    .hero-visual-container .float-card.bottom-left,
    .hero-visual-container .float-card.bottom-right {
        display: none;
    }

    /* Compact widget sizing */
    .hero-visual-container .widget-row {
        gap: 6px;
        margin-bottom: 0;
    }

    .hero-visual-container .widget-icon {
        width: 32px; height: 32px; min-width: 32px; min-height: 32px;
    }

    .hero-visual-container .widget-icon i,
    .hero-visual-container .widget-icon svg {
        font-size: 0.85rem;
    }

    .hero-visual-container .widget-val {
        font-size: 0.8rem;
    }

    .hero-visual-container .widget-label {
        font-size: 0.6rem;
    }
}

@keyframes float-mobile {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* — 480px — */
@media (max-width: 480px) {
    .hero-visual-container {
        width: 200px;
        height: 380px;
    }

    .hero-visual-container .float-card.top-left { left: -24px; }
    .hero-visual-container .float-card.top-right { right: -24px; }
}

/* — 375px — */
@media (max-width: 375px) {
    .hero-visual-container {
        width: 180px;
        height: 350px;
    }

    .hero-visual-container .phone-mockup {
        border-width: 4px;
        border-radius: 24px;
    }

    .hero-visual-container .float-card.top-left { left: -16px; }
    .hero-visual-container .float-card.top-right { right: -16px; }

    .hero-visual-container .float-card {
        padding: 6px 8px;
    }

    .hero-visual-container .widget-icon {
        width: 28px; height: 28px; min-width: 28px; min-height: 28px;
    }
    .hero-visual-container .widget-val { font-size: 0.75rem; }
    .hero-visual-container .widget-label { font-size: 0.55rem; }
}

/* ==========================================================
   J. Reduce animations on mobile (keep float-card animation)
   ========================================================== */
@media (max-width: 768px) {
    .orbit-system,
    .orbit-ring {
        animation: none;
    }

    .bg-orb,
    .hero-card-blob,
    .hero-bg-glow {
        animation: none;
    }

    * {
        will-change: auto;
    }

    .howitworks2-card:hover,
    .ev-bento-card:hover,
    .sv-step-card:hover,
    .faq-card:hover,
    .blog-card:hover,
    .evox-card:hover,
    .cases-niche-card:hover {
        transform: none;
    }

    .howitworks2-card,
    .ev-bento-card,
    .sv-step-card,
    .faq-card,
    .blog-card,
    .evox-card,
    .cases-niche-card {
        transition: opacity 0.3s, background 0.3s;
    }
}

/* ==========================================================
   K. Hero layout — floating navbar (top:12px) needs ~90px top padding
   ========================================================== */
@media (max-width: 768px) {
    .hero-centered {
        min-height: auto;
        padding: 90px 16px 40px;
        overflow: visible;
    }

    .hero-card-wrap {
        max-width: 100%;
        margin-bottom: 32px;
        padding: 0;
        position: relative;
    }

    .hero-text-wrapper {
        padding: 32px 20px;
        border-radius: 24px;
    }

    .hero-text-wrapper h1 {
        font-size: 2rem;
        margin-bottom: 16px;
    }

    .hero-text-wrapper p {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }

    .marketplace-logos-hero {
        margin-bottom: 20px;
    }

    .marketplace-logos-hero-img {
        max-height: 48px;
    }

    /* Phone area → managed by section I above */

    .sv-hero {
        padding: 90px 16px 40px;
        overflow: hidden;
    }

    .sv-hero-container {
        gap: 24px;
    }

    .sv-hero-visual {
        max-width: 300px;
        margin-top: 16px;
    }

    .ev-studio-hero {
        min-height: auto;
        padding: 90px 16px 40px;
        border-radius: 0;
    }

    .ev-studio-hero-scroll {
        display: none;
    }

    .ev-studio-hero-content {
        max-width: 100%;
    }

    .calc-hero {
        padding: 90px 16px 32px;
    }

    .contact-hero,
    .contact-section {
        padding: 90px 16px 32px;
    }

    .about-hero {
        padding: 90px 16px 32px;
        min-height: auto;
    }

    .evox-hero {
        padding: 90px 16px 32px;
        min-height: auto;
    }

    .blog-hero {
        padding: 90px 16px 32px;
        min-height: auto;
    }
}

/* ==========================================================
   L. Sub-breakpoints (text only — phone layout in section I)
   ========================================================== */
@media (max-width: 480px) {
    .hero-centered {
        padding: 84px 12px 32px;
    }

    .hero-text-wrapper {
        padding: 24px 14px;
        border-radius: 20px;
    }

    .hero-text-wrapper h1 {
        font-size: 1.75rem;
    }

    .sv-hero {
        padding: 84px 12px 32px;
    }
}

@media (max-width: 375px) {
    .hero-text-wrapper {
        padding: 20px 12px;
        border-radius: 14px;
    }

    .ev-studio-hero {
        padding: 80px 10px 32px;
    }
}

/* ==========================================================
   M. iOS Safari safety net
   ========================================================== */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .hero-text-wrapper,
        .float-card,
        .howitworks2-card,
        .ev-bento-card,
        .sv-step-card,
        .faq-card,
        .faq-item,
        .process-step,
        .step-card,
        .callback-v2,
        .calc-card,
        .calc-mp-tab,
        #paywallModal,
        .modal-overlay,
        .service-modal-overlay,
        .cm-modal {
            -webkit-backdrop-filter: none;
        }

        /* Navbar + mobile menu keep glass effect on iOS */
        .navbar {
            -webkit-backdrop-filter: blur(20px) saturate(1.1);
        }
        .mobile-menu-content {
            -webkit-backdrop-filter: blur(40px) saturate(1.4);
        }
        .mobile-menu-overlay::before {
            -webkit-backdrop-filter: blur(4px);
        }
    }
}

/* ==========================================================
   N. Carousel (preserve from v6 — working correctly)
   ========================================================== */
@media (max-width: 768px) {
    .infographics-cascade-item,
    .why-bento-grid,
    .evox-card,
    [style*="perspective"] {
        perspective: none;
        transform-style: flat;
    }

    .solutions-section.carousel-mode .solutions-grid-vertical {
        perspective: none;
        transform-style: flat;
        min-height: 400px;
    }

    .solutions-section.carousel-mode .solution-card-modern {
        backface-visibility: visible;
        -webkit-backface-visibility: visible;
        will-change: opacity;
        transition: opacity 350ms ease;
        border-radius: 20px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }

    .solutions-section.carousel-mode .solution-card-modern:not(.carousel-active) {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .solutions-section.carousel-mode .solution-card-modern.carousel-active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        position: relative;
    }

    .carousel-side-arrow {
        background: rgba(0, 0, 0, 0.05);
        width: 40px;
        height: 40px;
    }

    .carousel-side-arrows {
        transform: translateY(-50%);
    }

    .solutions-carousel-nav-wrap {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        max-width: 100%;
    }

    .solutions-carousel-nav {
        max-width: 100%;
        overflow-x: auto;
        flex-wrap: wrap;
        justify-content: center;
    }

    .carousel-nav-item {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
}

/* ==========================================================
   P. Landscape mobile — hide phone, compact hero
   ========================================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-text-wrapper {
        padding: 16px;
    }
    .hero-text-wrapper h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    .hero-text-wrapper p {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    .hero-visual-container {
        display: none;
    }
}

/* ==========================================================
   O. Overflow containment
   ========================================================== */
@media (max-width: 768px) {
    .design-slide,
    .infographics-hero-card,
    .infographics-hero-card--glass {
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .design-slide-content-inner,
    .infographics-hero-content,
    .infographics-hero-visual,
    .design-slide-cta,
    .design-block-arc,
    .design-slide-decor,
    .design-block-glow {
        max-width: 100% !important;
    }

    .hero-trust-glow {
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .process-section > div,
    .section-bridge > div,
    .pricing-faq-wrapper > div {
        max-width: 100% !important;
    }

    .solutions-carousel-nav {
        max-width: 100% !important;
    }

    h1, h2, h3, p {
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        max-width: 100% !important;
    }
}
