/* Apply the moving border to public contact and detail actions. */
:is(a.hotline, .home-devices__action, .block__more, .sw-hero__cta > a.btn--line,
    .sw__more > a:not([href$="#demo"]), .svc__link, .choice__card[href*="khao-sat"] .choice__go,
    .footer__cta a[href*="khao-sat"], a.btn[href*="khao-sat"]) {
    position: relative;
}

a.hotline { border-radius: 7px; }

:is(a.hotline, .floatbar__btn--call, #kt-visitor-chat .ktvc-open, #kt-visitor-chat .ktvc-survey,
    .home-devices__action, .block__more, .sw-hero__cta > a.btn--line,
    .sw__more > a:not([href$="#demo"]), .svc__link, .choice__card[href*="khao-sat"] .choice__go,
    .footer__cta a[href*="khao-sat"], a.btn[href*="khao-sat"]) {
    --kt-contact-light: #2b87c1 48%, #85ddff 82%, #effcff;
    --kt-contact-glow: #54b9ef;
    isolation: isolate;
    transition: box-shadow 180ms ease;

    &::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        pointer-events: none;
        background:
            linear-gradient(90deg, transparent, var(--kt-contact-light)) -95% 0 / 48% 2px no-repeat,
            linear-gradient(180deg, transparent, var(--kt-contact-light)) 100% -165% / 2px 62% no-repeat,
            linear-gradient(270deg, transparent, var(--kt-contact-light)) 195% 100% / 48% 2px no-repeat,
            linear-gradient(0deg, transparent, var(--kt-contact-light)) 0 265% / 2px 62% no-repeat;
    }

    &:is(:hover, :focus-visible),
    a:is(:hover, :focus-visible) > &:is(.home-devices__action, .choice__go) {
        box-shadow: 0 0 0 1px var(--kt-contact-glow), 0 2px 12px -3px var(--kt-contact-glow);
    }

    &:is(:hover, :focus-visible, a.hotline, .floatbar__btn--call, .ktvc-open, .ktvc-survey)::before,
    a:is(:hover, :focus-visible) > &:is(.home-devices__action, .choice__go)::before {
        animation: kt-contact-perimeter 2.5s linear infinite;
    }

    @media (prefers-reduced-motion: reduce) {
        transition: none;

        &::before { animation: none !important; }
    }

    @media print { &::before { content: none; } }
}

:is(a.hotline, .floatbar__btn--call) {
    --kt-contact-light: #d64532 48%, #ffae89 82%, #fff4eb;
    --kt-contact-glow: #e9896d;
}

#kt-visitor-chat .ktvc-survey {
    --kt-contact-light: #2a947c 48%, #9af5cf 82%, #f1fff9;
    --kt-contact-glow: #68cbb1;
}

@keyframes kt-contact-perimeter {
    0%, 100% { background-position: -95% 0, 100% -165%, 195% 100%, 0 265%; }
    25% { background-position: 195% 0, 100% -165%, 195% 100%, 0 265%; }
    50% { background-position: 195% 0, 100% 265%, 195% 100%, 0 265%; }
    75% { background-position: 195% 0, 100% 265%, -95% 100%, 0 265%; }
    99.99% { background-position: 195% 0, 100% 265%, -95% 100%, 0 -165%; }
}
