/* Shared motion layer for the CTX Code site. */
:root {
    --ctx-motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ctx-motion-soft: cubic-bezier(0.2, 0.72, 0.24, 1);
}

html.motion-ready {
    scrollbar-color: rgba(255, 255, 255, 0.38) transparent;
    scrollbar-width: thin;
}

html.motion-ready::-webkit-scrollbar {
    width: 10px;
}

html.motion-ready::-webkit-scrollbar-track {
    background: transparent;
}

html.motion-ready::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    background-clip: padding-box;
}

html.motion-ready::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
    background-clip: padding-box;
}

html.motion-ready .motion-item {
    --motion-x: 0px;
    --motion-y: 22px;
    --motion-scale: 1;
    --motion-delay: 0ms;
    backface-visibility: hidden;
    will-change: opacity, transform;
    transition:
        opacity 680ms var(--ctx-motion-ease),
        transform 680ms var(--ctx-motion-ease);
    transition-delay: var(--motion-delay);
}

html.motion-ready .motion-item:not(.motion-in) {
    opacity: 0;
    transform: translate3d(var(--motion-x), var(--motion-y), 0) scale(var(--motion-scale));
}

html.motion-ready .motion-item.motion-in {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

html.motion-ready .motion-item.motion-in {
    will-change: auto;
}

html.motion-ready .motion-from-top {
    --motion-y: -16px;
}

html.motion-ready .motion-from-left {
    --motion-x: -24px;
    --motion-y: 8px;
}

html.motion-ready .motion-from-right {
    --motion-x: 24px;
    --motion-y: 8px;
}

html.motion-ready .motion-card {
    --motion-y: 18px;
    --motion-scale: 0.985;
}

html.motion-ready .motion-soft {
    --motion-y: 14px;
}

html.motion-ready #pageBg,
html.motion-ready .page-background {
    animation: ctx-background-in 1100ms var(--ctx-motion-soft) both;
}

html.motion-ready .product-wordmark > span {
    display: inline-block;
    animation: ctx-word-in 720ms var(--ctx-motion-ease) both;
}

html.motion-ready .product-wordmark > span:nth-child(2) {
    animation-delay: 90ms;
}

html.motion-ready .product-wordmark > span:nth-child(3) {
    animation-delay: 180ms;
}

@keyframes ctx-background-in {
    from {
        opacity: 0.3;
        transform: scale(1.035);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ctx-word-in {
    from {
        opacity: 0;
        transform: translate3d(0, 18px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@media (hover: hover) and (pointer: fine) {
    :where(
        .feature-card,
        .hero-info-card,
        .side-card,
        .glass-card,
        .workflow li,
        .scenario-item,
        .upload-card,
        .project-card,
        .project-detail,
        .doc-card,
        .document-card,
        .feedback-card,
        .level-item,
        .comment-item,
        .file-item,
        .tool-card,
        .download-button,
        .login-container,
        .modal-content
    ) {
        transition:
            transform 320ms var(--ctx-motion-ease),
            box-shadow 320ms var(--ctx-motion-ease),
            border-color 320ms ease,
            background-color 320ms ease;
    }

    :where(
        .button,
        .login-btn,
        .nav-download,
        .download-button,
        .extra-link,
        .now-project-btn,
        button
    ) {
        transition:
            transform 220ms var(--ctx-motion-ease),
            box-shadow 220ms var(--ctx-motion-ease),
            border-color 220ms ease,
            background-color 220ms ease,
            color 220ms ease,
            opacity 220ms ease;
    }
}

:where(
    .button,
    .login-btn,
    .nav-download,
    .download-button,
    .extra-link,
    .now-project-btn,
    button,
    a
):focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.78);
    outline-offset: 3px;
}

.scroll-reveal {
    transition:
        opacity 680ms var(--ctx-motion-ease),
        transform 680ms var(--ctx-motion-ease);
}

@media (prefers-reduced-motion: reduce) {
    html.motion-ready .motion-item {
        transition-duration: 180ms !important;
        transition-delay: 0ms !important;
    }

    html.motion-ready .motion-item:not(.motion-in) {
        --motion-x: 0px;
        --motion-y: 8px;
        --motion-scale: 1;
    }

    html.motion-ready .product-wordmark > span,
    html.motion-ready #pageBg,
    html.motion-ready .page-background {
        animation-duration: 240ms !important;
    }
}
