/* ==========================================================================
   Touch-only ambient life.

   Injected by ambient-touch.js only when the device has no hover / a coarse
   pointer. Everything here animates transform or opacity only. Off-screen
   sections keep their animations paused via .is-touch-visible, and reduced
   motion removes the motion entirely.
   ========================================================================== */

@keyframes touch-drift {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -16px, 0); }
}

@keyframes touch-orbit {
    from { transform: translate3d(0, 0, 0) rotate(0deg); }
    to { transform: translate3d(0, 0, 0) rotate(360deg); }
}

@keyframes touch-pulse {
    0%, 100% { transform: scale(0.92); opacity: 0.1; }
    50% { transform: scale(1.08); opacity: 0.22; }
}

@keyframes touch-highlight {
    0%, 62%, 100% { opacity: 0; transform: translate3d(-12%, 0, 0); }
    12% { opacity: 0.55; }
    38% { opacity: 0.35; transform: translate3d(12%, 0, 0); }
}

@media (hover: none), (pointer: coarse) {
    .touch-ambient {
        position: relative;
        isolation: isolate;
    }

    .touch-ambient > .container,
    .touch-ambient > .hero__inner,
    .touch-ambient > .about-teaser,
    .touch-ambient > .news-section-actions {
        position: relative;
        z-index: 1;
    }

    .touch-orbit {
        position: absolute;
        z-index: 0;
        inset: 0;
        overflow: hidden;
        pointer-events: none;
        direction: ltr;
    }

    .touch-orbit::before {
        position: absolute;
        inset: 0;
        background-image: radial-gradient(rgba(var(--brand-rgb), 0.24) 1px, transparent 1px);
        background-size: 38px 38px;
        content: "";
        opacity: 0.22;
        -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 72%, transparent);
        mask-image: linear-gradient(180deg, transparent, #000 22%, #000 72%, transparent);
    }

    .touch-orb {
        position: absolute;
        width: min(42vw, 190px);
        aspect-ratio: 1;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(var(--brand-rgb), 0.42), rgba(var(--brand-rgb), 0.08) 58%, transparent 72%);
        animation: touch-pulse 8s ease-in-out infinite;
        animation-play-state: paused;
        will-change: transform, opacity;
    }

    .touch-orb--1 {
        inset-block-start: 8%;
        inset-inline-end: -6%;
    }

    .touch-token {
        position: absolute;
        width: 2.75rem;
        height: 2.75rem;
        animation: touch-drift 9s ease-in-out infinite;
        animation-play-state: paused;
        will-change: transform;
    }

    .touch-token--1 { inset-block-start: 14%; inset-inline-start: 6%; animation-duration: 9s; }
    .touch-token--2 { inset-block-start: 54%; inset-inline-end: 7%; animation-duration: 11s; animation-delay: -3s; }
    .touch-token--3 { inset-block-end: 13%; inset-inline-start: 44%; animation-duration: 13s; animation-delay: -6s; }

    .touch-orbit-ring {
        position: absolute;
        width: 7.5rem;
        height: 7.5rem;
        inset-block-start: 26%;
        inset-inline-start: -1.5rem;
        animation: touch-orbit 26s linear infinite;
        animation-play-state: paused;
        will-change: transform;
    }

    .touch-orbit-ring .touch-token {
        inset-block-start: 0;
        inset-block-end: auto;
        inset-inline-start: calc(50% - 1.375rem);
        inset-inline-end: auto;
    }

    .touch-token__inner {
        display: grid;
        place-items: center;
        width: 100%;
        height: 100%;
        border: 1px solid rgba(var(--brand-rgb), 0.35);
        border-radius: 999px;
        background: rgba(var(--brand-rgb), 0.12);
        box-shadow: 0 0 22px rgba(var(--brand-rgb), 0.14);
        color: var(--accent);
        font-family: var(--font-mono);
        font-size: 0.68rem;
        font-weight: 700;
        opacity: 0.72;
        transform: translate3d(0, 0, 0);
        transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
    }

    /* Stepwise scroll parallax: JS only swaps these classes. */
    .touch-scroll-0 .touch-token--1 .touch-token__inner { transform: translate3d(0, -16px, 0); }
    .touch-scroll-1 .touch-token--1 .touch-token__inner { transform: translate3d(0, -8px, 0); }
    .touch-scroll-2 .touch-token--1 .touch-token__inner { transform: translate3d(0, 0, 0); }
    .touch-scroll-3 .touch-token--1 .touch-token__inner { transform: translate3d(0, 8px, 0); }
    .touch-scroll-4 .touch-token--1 .touch-token__inner { transform: translate3d(0, 16px, 0); }

    .touch-scroll-0 .touch-token--2 .touch-token__inner { transform: translate3d(10px, 12px, 0); }
    .touch-scroll-1 .touch-token--2 .touch-token__inner { transform: translate3d(5px, 6px, 0); }
    .touch-scroll-2 .touch-token--2 .touch-token__inner { transform: translate3d(0, 0, 0); }
    .touch-scroll-3 .touch-token--2 .touch-token__inner { transform: translate3d(-5px, -6px, 0); }
    .touch-scroll-4 .touch-token--2 .touch-token__inner { transform: translate3d(-10px, -12px, 0); }

    .touch-scroll-0 .touch-token--3 .touch-token__inner { transform: translate3d(0, -12px, 0); }
    .touch-scroll-1 .touch-token--3 .touch-token__inner { transform: translate3d(0, -6px, 0); }
    .touch-scroll-2 .touch-token--3 .touch-token__inner { transform: translate3d(0, 0, 0); }
    .touch-scroll-3 .touch-token--3 .touch-token__inner { transform: translate3d(0, 6px, 0); }
    .touch-scroll-4 .touch-token--3 .touch-token__inner { transform: translate3d(0, 12px, 0); }

    .touch-progress {
        position: absolute;
        z-index: 2;
        inset-inline: 0;
        inset-block-end: 0;
        height: 2px;
        overflow: hidden;
        opacity: 0.75;
    }

    .touch-progress__bar {
        display: block;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, var(--accent), transparent);
        transform: scaleX(0);
        transform-origin: left center;
        transition: transform 300ms linear;
    }

    [dir="rtl"] .touch-progress__bar {
        transform-origin: right center;
    }

    .touch-scroll-0 .touch-progress__bar { transform: scaleX(0.08); }
    .touch-scroll-1 .touch-progress__bar { transform: scaleX(0.3); }
    .touch-scroll-2 .touch-progress__bar { transform: scaleX(0.55); }
    .touch-scroll-3 .touch-progress__bar { transform: scaleX(0.8); }
    .touch-scroll-4 .touch-progress__bar { transform: scaleX(1); }

    .touch-ambient .why-card,
    .touch-ambient .process-step,
    .touch-ambient .news-card,
    .touch-ambient .home-service-card,
    .touch-ambient .testimonial-card {
        position: relative;
        overflow: hidden;
    }

    .touch-ambient .why-card::after,
    .touch-ambient .process-step::after,
    .touch-ambient .news-card::after,
    .touch-ambient .home-service-card::after,
    .touch-ambient .testimonial-card::after {
        position: absolute;
        z-index: 2;
        inset: 0;
        border-radius: inherit;
        background: linear-gradient(115deg, transparent 12%, rgba(var(--brand-rgb), 0.22) 48%, transparent 84%);
        content: "";
        pointer-events: none;
        opacity: 0;
        animation: touch-highlight 7s ease-in-out infinite;
        animation-play-state: paused;
        will-change: transform, opacity;
    }

    .touch-ambient .why-card:nth-child(2)::after,
    .touch-ambient .process-step:nth-child(2)::after,
    .touch-ambient .news-card:nth-child(2)::after,
    .touch-ambient .home-service-card:nth-child(2)::after,
    .touch-ambient .testimonial-card:nth-child(2)::after { animation-delay: 0.9s; }

    .touch-ambient .why-card:nth-child(3)::after,
    .touch-ambient .process-step:nth-child(3)::after,
    .touch-ambient .news-card:nth-child(3)::after,
    .touch-ambient .home-service-card:nth-child(3)::after,
    .touch-ambient .testimonial-card:nth-child(3)::after { animation-delay: 1.8s; }

    .touch-ambient .why-card:nth-child(n+4)::after,
    .touch-ambient .process-step:nth-child(n+4)::after,
    .touch-ambient .news-card:nth-child(n+4)::after,
    .touch-ambient .home-service-card:nth-child(n+4)::after,
    .touch-ambient .testimonial-card:nth-child(n+4)::after { animation-delay: 2.7s; }

    .touch-ambient.is-touch-visible .touch-orb,
    .touch-ambient.is-touch-visible .touch-orbit-ring,
    .touch-ambient.is-touch-visible .touch-token,
    .touch-ambient.is-touch-visible .why-card::after,
    .touch-ambient.is-touch-visible .process-step::after,
    .touch-ambient.is-touch-visible .news-card::after,
    .touch-ambient.is-touch-visible .home-service-card::after,
    .touch-ambient.is-touch-visible .testimonial-card::after,
    .touch-ambient.is-touch-visible .testimonial-card__float {
        animation-play-state: running;
    }

    .touch-ambient:not(.is-touch-visible) .testimonial-card__float {
        animation-play-state: paused;
    }

    .btn:active,
    .why-card:active,
    .process-step:active,
    .news-card:active,
    .testimonial-card:active,
    .news-filter:active {
        transform: scale(0.985);
        transition: transform 120ms ease;
    }
}

@media (prefers-reduced-motion: reduce) {
    .touch-orbit *,
    .touch-ambient .why-card::after,
    .touch-ambient .process-step::after,
    .touch-ambient .news-card::after,
    .touch-ambient .home-service-card::after,
    .touch-ambient .testimonial-card::after {
        animation: none !important;
        transition: none !important;
    }

    .touch-token__inner,
    .touch-progress__bar {
        transition: none !important;
    }
}
