/* Magic CSS - Subtle effects for a premium feel */

:root {
    --accent-primary: #4F46E5;
    /* Indigo 600 */
    --accent-secondary: #4338ca;
    /* Indigo 700 */
    --surface-glass: rgba(255, 255, 255, 0.7);
}

/* Watermark UI font (served from /assets/fonts/wm/*). */
@font-face {
    font-family: 'WM Liberation Sans';
    src: url('/assets/fonts/wm/liberation/LiberationSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f8fafc;
    /* Slate 50 */
    color: #1e293b;
    /* Slate 800 */
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Card Hover Effects */
.magic-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.magic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px -10px rgba(79, 70, 229, 0.15);
    /* Soft Indigo Glow */
    border-color: rgba(79, 70, 229, 0.2);
}

/* Button Glow */
.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.btn-glow:hover::after {
    left: 100%;
    transition: 0.5s;
}

/* Text Gradient for emphasis */
@keyframes textShimmer {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

.text-gradient {
    /* Richer gradient with multiple stops for iridescent effect */
    background: linear-gradient(90deg,
            #4F46E5 0%,
            #8b5cf6 25%,
            #3B82F6 50%,
            #8b5cf6 75%,
            #4F46E5 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    /* Fallback */
    animation: textShimmer 4s linear infinite;
}

/* Custom Scrollbar for Webkit */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    opacity: 0;
    transform: translateY(18px);
    animation: fadeIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.delay-100 {
    animation-delay: 0.35s;
}

.delay-200 {
    animation-delay: 0.65s;
}

.delay-300 {
    animation-delay: 0.95s;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .animate-fade-in {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .text-gradient,
    .hero-glow,
    .cta-glow,
    .cta-button,
    .cta-button::before,
    .carousel-track,
    .client-item::before,
    .ai-card-glow::before,
    .ai-ambient-glow {
        animation: none !important;
    }

    .btn-glow::after,
    .magic-card,
    .client-item,
    .cta-button {
        transition: none !important;
    }
}

/* Animated hero glow */
@keyframes glowShimmer {
    0% {
        background-position: 0% 50%;
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        /* Subtle breathing */
    }

    100% {
        background-position: 200% 50%;
        transform: scale(1);
    }
}

.hero-glow {
    /* Identical gradient colors to text-gradient for consistency */
    background: linear-gradient(90deg,
            rgba(79, 70, 229, 0.45) 0%,
            /* Indigo */
            rgba(139, 92, 246, 0.55) 25%,
            /* Violet */
            rgba(59, 130, 246, 0.45) 50%,
            /* Blue */
            rgba(139, 92, 246, 0.55) 75%,
            /* Violet */
            rgba(79, 70, 229, 0.45) 100%
            /* Indigo */
        );
    background-size: 200% 200%;
    filter: blur(64px);
    /* Increased blur for softer, dreamy look */
    animation: glowShimmer 8s linear infinite;
    /* Slightly slower than text for background depth */
    pointer-events: none;
    opacity: 0.8;
}

/* CTA ambient glow */
.cta-glow {
    background: linear-gradient(90deg,
            rgba(79, 70, 229, 0.2) 0%,
            rgba(139, 92, 246, 0.28) 30%,
            rgba(59, 130, 246, 0.22) 60%,
            rgba(139, 92, 246, 0.28) 80%,
            rgba(79, 70, 229, 0.2) 100%);
    background-size: 200% 200%;
    filter: blur(52px);
    animation: glowShimmer 10s linear infinite;
    pointer-events: none;
    opacity: 0.6;
}

.cta-button {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #4F46E5 0%, #3B82F6 35%, #22c55e 60%, #312E81 100%);
    background-size: 300% 300%;
    box-shadow: 0 20px 50px -20px rgba(79, 70, 229, 0.45), 0 10px 30px -15px rgba(59, 130, 246, 0.35);
    transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease, background-position 0.3s ease;
    animation: ctaFlow 12s ease-in-out infinite;
}

.cta-button::before {
    content: '';
    position: absolute;
    inset: -25%;
    background:
        radial-gradient(200px 200px at 30% 30%, rgba(255, 255, 255, 0.28), transparent 55%),
        radial-gradient(220px 220px at 70% 60%, rgba(34, 197, 94, 0.25), transparent 60%);
    opacity: 0.8;
    mix-blend-mode: screen;
    animation: ctaPulse 14s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 25px 55px -20px rgba(79, 70, 229, 0.55), 0 12px 35px -16px rgba(59, 130, 246, 0.4),
        0 0 40px -10px rgba(34, 197, 94, 0.35);
    filter: brightness(1.04);
    background-position: 100% 50%;
}

.cta-button:focus-visible {
    outline: 2px solid rgba(79, 70, 229, 0.5);
    outline-offset: 3px;
}

@keyframes ctaFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes ctaPulse {
    0% {
        background-position: 0% 0%, 60% 60%, 20% 20%;
        opacity: 0.75;
    }

    50% {
        background-position: 60% 40%, 20% 80%, 80% 30%;
        opacity: 0.9;
    }

    100% {
        background-position: 0% 0%, 60% 60%, 20% 20%;
        opacity: 0.8;
    }
}


/* Smooth Infinite Carousel */
@keyframes infiniteScroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

.carousel-container {
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    overflow: hidden;
    position: relative;
    width: 100%;
}

.carousel-track {
    display: flex;
    width: max-content;
    animation: infiniteScroll 65s linear infinite;
    gap: 3rem;
    padding: 4rem 0;
    /* Увеличили отступы, чтобы аватарки не обрезались при увеличении */
}

.client-item {
    flex: 0 0 auto;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    padding: 3px;
    border: 1px solid rgba(79, 70, 229, 0.15);
    box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    cursor: pointer;
    z-index: 1;
}

.client-item::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, #4f46e5, #8b5cf6, #3b82f6, #22c55e);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: ctaFlow 5s linear infinite;
}

@media (hover: hover) {
    .carousel-track:hover {
        animation-play-state: paused;
    }

    .client-item:hover {
        transform: scale(1.28) translateY(-3px);
        /* Умеренное увеличение без резких скачков на слабых GPU */
        border-color: transparent;
        z-index: 50;
        /* Выносим на передний план над остальными */
    }

    .client-item:hover::before {
        opacity: 1;
    }
}

/* Эффект для мобильных устройств при долгом нажатии (активном состоянии) */
@media (hover: none) {
    .client-item:active {
        transform: scale(1.3);
        z-index: 50;
        transition: transform 0.2s ease;
    }
}

.client-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background: #f8fafc;
}

/* AI Card Glow Effect - Futuristic shimmer border */
@keyframes aiAuroraShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes aiPulse {

    0%,
    100% {
        opacity: 0.6;
        filter: blur(20px);
    }

    50% {
        opacity: 0.85;
        filter: blur(25px);
    }
}

.ai-card-glow {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(238, 242, 255, 0.9) 50%,
            rgba(255, 255, 255, 0.95) 100%);
}

.ai-card-glow::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(90deg,
            #4F46E5 0%,
            #8b5cf6 15%,
            #06b6d4 30%,
            #22c55e 45%,
            #eab308 60%,
            #8b5cf6 75%,
            #3b82f6 90%,
            #4F46E5 100%);
    background-size: 300% 100%;
    border-radius: 2.5rem;
    z-index: -2;
    animation: aiAuroraShift 8s linear infinite;
}

.ai-card-glow::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(238, 242, 255, 0.95) 50%,
            rgba(255, 255, 255, 0.98) 100%);
    border-radius: calc(2.5rem - 2px);
    z-index: -1;
}

/* Ambient glow behind the card */
.ai-ambient-glow {
    position: absolute;
    inset: -30px;
    background: linear-gradient(90deg,
            rgba(79, 70, 229, 0.3) 0%,
            rgba(139, 92, 246, 0.35) 25%,
            rgba(6, 182, 212, 0.3) 50%,
            rgba(34, 197, 94, 0.25) 75%,
            rgba(79, 70, 229, 0.3) 100%);
    background-size: 200% 100%;
    border-radius: 3rem;
    z-index: -3;
    animation: aiAuroraShift 10s linear infinite, aiPulse 4s ease-in-out infinite;
    pointer-events: none;
}

/* Promo platform profile aligned with panel (Windows/Android cost guards) */
body.is-windows .glass-panel,
body.is-android .glass-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.96);
}

body.is-windows .text-gradient,
body.is-android .text-gradient {
    animation: none;
    background-size: 100% auto;
}

body.is-windows .hero-glow,
body.is-android .hero-glow {
    animation: none;
    filter: blur(42px);
    opacity: 0.58;
}

body.is-windows .cta-glow,
body.is-android .cta-glow {
    animation: none;
    filter: blur(36px);
    opacity: 0.45;
}

body.is-windows .cta-button,
body.is-android .cta-button,
body.is-windows .cta-button::before,
body.is-android .cta-button::before,
body.is-windows .client-item::before,
body.is-android .client-item::before,
body.is-windows .ai-card-glow::before,
body.is-android .ai-card-glow::before,
body.is-windows .ai-ambient-glow,
body.is-android .ai-ambient-glow {
    animation: none;
}

body.is-windows .carousel-container,
body.is-android .carousel-container {
    mask-image: none;
    -webkit-mask-image: none;
}

body.is-windows .carousel-track,
body.is-android .carousel-track {
    animation-duration: 95s;
}

body.is-windows .client-item:hover,
body.is-android .client-item:hover {
    transform: scale(1.16) translateY(-2px);
}

body.is-windows,
body.is-android {
    text-rendering: optimizeLegibility;
}
