/* =========================================================
   JL ANTONIO — MOBILE STABLE PERFORMANCE LAYER
   Principle: motion may decorate content, but it never controls whether
   content exists. Fast scrollers always see the page immediately.
========================================================= */

@media (max-width: 900px), (pointer: coarse) {
    html {
        scroll-behavior: auto !important;
    }

    /* The mobile controller supplies the readable branded intro. */
    #intro,
    body > .intro {
        display: none !important;
    }

    /* Remove the only expensive continuous canvas and desktop cursor. */
    #signal-canvas,
    .signal-canvas,
    .cursor,
    .cursor-dot {
        display: none !important;
    }

    body.intro-active {
        overflow: hidden !important;
    }

    /* CRITICAL: lower-page content is always fully painted.
       The original reveal classes now provide only a small premium lift. */
    .reveal {
        backface-visibility: hidden;
        opacity: 1 !important;
        transform: translate3d(0, 10px, 0);
        transition:
            transform 0.52s cubic-bezier(0.2, 0.8, 0.2, 1),
            filter 0.52s ease;
        visibility: visible !important;
    }

    .reveal.is-visible {
        opacity: 1 !important;
        transform: translate3d(0, 0, 0);
        visibility: visible !important;
    }

    /* Never freeze whole sections. The particle canvas is already removed,
       so pausing every descendant creates more risk than benefit. */
    .mobile-motion-paused *,
    .mobile-motion-paused *::before,
    .mobile-motion-paused *::after,
    .mobile-document-hidden *,
    .mobile-document-hidden *::before,
    .mobile-document-hidden *::after {
        animation-play-state: running !important;
    }

    /* Preserve depth while avoiding costly live blur calculations. */
    .navbar,
    .lab-floating-data,
    .strategy-node,
    .back-to-top,
    .lab-industry-directory,
    .lab-style-directory,
    .navigation-panel {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }

    main > section {
        position: relative;
    }

    /* Additive premium sweep: it never hides or delays the section. */
    main > section.mobile-section-arriving::after {
        animation: mobile-section-sweep 0.72s cubic-bezier(0.2, 0.8, 0.2, 1) both;
        background: linear-gradient(
            105deg,
            transparent 0%,
            rgba(117, 199, 188, 0.025) 38%,
            rgba(242, 239, 233, 0.09) 50%,
            rgba(194, 167, 131, 0.035) 62%,
            transparent 100%
        );
        content: "";
        inset: 0;
        pointer-events: none;
        position: absolute;
        transform: translate3d(-120%, 0, 0);
        z-index: 12;
    }

    /* Readable intro. The page finishes rendering underneath it. */
    .quick-mobile-intro {
        background:
            radial-gradient(circle at 68% 30%, rgba(136, 173, 186, 0.10), transparent 34%),
            radial-gradient(circle at 22% 78%, rgba(164, 134, 102, 0.07), transparent 34%),
            #070707;
        inset: 0;
        opacity: 1;
        position: fixed;
        transition: opacity 0.42s ease, visibility 0.42s ease;
        visibility: visible;
        z-index: 99999;
    }

    .quick-mobile-intro.is-finished {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }

    .quick-mobile-intro-frame {
        display: grid;
        grid-template-rows: auto 1fr auto;
        height: 100%;
        padding: 26px;
    }

    .quick-mobile-intro-brand {
        align-items: center;
        display: flex;
        gap: 10px;
    }

    .quick-mobile-intro-brand span {
        color: #f2efe9;
        font-family: Georgia, "Times New Roman", serif;
        font-size: 1.25rem;
        font-style: italic;
    }

    .quick-mobile-intro-brand p,
    .quick-mobile-intro-label {
        color: rgba(242, 239, 233, 0.66);
        font-size: 0.62rem;
        font-weight: 700;
        letter-spacing: 0.18em;
        margin: 0;
        text-transform: uppercase;
    }

    .quick-mobile-intro-center {
        align-items: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }

    .quick-mobile-intro-label {
        margin-bottom: 28px;
    }

    .quick-mobile-intro-word {
        background: linear-gradient(100deg, #f2efe9 0%, #dcd7cf 38%, #c6a47b 70%, #75c7bc 100%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        font-family: Georgia, "Times New Roman", serif;
        font-size: clamp(3.4rem, 16vw, 5.2rem);
        font-style: italic;
        font-weight: 400;
        letter-spacing: -0.065em;
        line-height: 0.9;
        opacity: 1;
        transform: translateY(0) scale(1);
        transition: opacity 0.12s ease, transform 0.12s ease;
        white-space: nowrap;
    }

    .quick-mobile-intro-word.is-changing {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }

    .quick-mobile-intro-footer {
        background: rgba(242, 239, 233, 0.10);
        height: 1px;
        overflow: hidden;
    }

    .quick-mobile-intro-progress {
        animation: quick-mobile-progress 2.85s linear forwards;
        background: linear-gradient(90deg, #75c7bc, #f2efe9, #c6a47b);
        display: block;
        height: 100%;
        transform: scaleX(0);
        transform-origin: left center;
    }

    /* Branded feedback while a complete demo website opens. */
    .demo-frame-wrapper {
        position: relative;
    }

    .demo-frame-wrapper iframe {
        opacity: 1;
        position: relative;
        transition: opacity 0.22s ease;
        z-index: 1;
    }

    .demo-viewer.is-loading .demo-frame-wrapper iframe {
        opacity: 0;
    }

    .demo-viewer.is-loading .demo-frame-wrapper::before {
        align-items: center;
        background:
            radial-gradient(circle at 50% 40%, rgba(117, 199, 188, 0.13), transparent 34%),
            #071014;
        color: rgba(242, 239, 233, 0.82);
        content: "Preparing live experience";
        display: flex;
        font-size: 0.64rem;
        font-weight: 700;
        inset: 0;
        justify-content: center;
        letter-spacing: 0.15em;
        position: absolute;
        text-transform: uppercase;
        z-index: 3;
    }

    .demo-viewer.is-loading .demo-frame-wrapper::after {
        animation: demo-loading-spin 0.8s linear infinite;
        border: 2px solid rgba(242, 239, 233, 0.16);
        border-radius: 50%;
        border-top-color: #75c7bc;
        content: "";
        height: 28px;
        left: 50%;
        margin-left: -14px;
        margin-top: 27px;
        position: absolute;
        top: 50%;
        width: 28px;
        z-index: 4;
    }
}

@keyframes quick-mobile-progress {
    to { transform: scaleX(1); }
}

@keyframes mobile-section-sweep {
    0% { opacity: 0; transform: translate3d(-120%, 0, 0); }
    22% { opacity: 1; }
    100% { opacity: 0; transform: translate3d(120%, 0, 0); }
}

@keyframes demo-loading-spin {
    to { transform: rotate(360deg); }
}
