/* motion.css — анимации и 3D-эффекты ProcessPoint */

/* Inter (variable) — локальные файлы, без Google Fonts */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* --- Палитра: графит + один акцент (значения — RGB-тройки) --- */
:root {
    --ink: 11 12 14;
    --text: 237 237 230;
    /* графит вместо slate */
    --neu-50: 246 246 243;  --neu-100: 236 236 231; --neu-200: 226 226 220;
    --neu-300: 207 207 200; --neu-400: 154 154 148; --neu-500: 117 117 111;
    --neu-600: 85 85 79;    --neu-700: 58 58 55;    --neu-800: 38 38 36;
    --neu-900: 22 22 23;    --neu-950: 14 14 15;
    /* 3D-сцена: хаос серый, система в цвет акцента */
    --scene-chaos: 120 120 114;
}
:root[data-accent="orange"] {
    --acc-50: 255 244 237;  --acc-100: 255 228 212; --acc-200: 255 201 172;
    --acc-300: 255 176 137; --acc-400: 255 138 82;  --acc-500: 255 106 43;
    --acc-600: 232 84 26;   --acc-700: 184 63 16;   --acc-800: 122 42 11;
    --acc-900: 74 26 8;     --acc-950: 40 14 4;
    --on-accent: 255 255 255;
    --scene-order: 255 106 43;
}
:root[data-accent="lime"] {
    --acc-50: 249 254 231;  --acc-100: 240 252 200; --acc-200: 230 250 165;
    --acc-300: 221 247 138; --acc-400: 210 244 94;  --acc-500: 200 240 60;
    --acc-600: 168 204 34;  --acc-700: 126 154 20;  --acc-800: 84 103 13;
    --acc-900: 46 56 8;     --acc-950: 24 30 4;
    --on-accent: 14 14 15;
    --scene-order: 200 240 60;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { overflow-x: hidden; scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: rgb(var(--ink));
    color: rgb(var(--text));
}

input, textarea, button { font: inherit; }
section[id] { scroll-margin-top: 88px; }

/* --- Фон: WebGL-холст + запасной градиент --- */
#scene {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}
.bg-fallback {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(60% 50% at 75% 30%, rgb(var(--acc-400) / 0.12), transparent 70%),
        radial-gradient(50% 50% at 20% 70%, rgb(var(--acc-600) / 0.12), transparent 70%);
}
.bg-vignette {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(120% 90% at 50% 40%, transparent 40%, rgb(var(--ink) / 0.85) 100%);
}
.page { position: relative; z-index: 1; }

/* --- Прогресс прокрутки --- */
#scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 100%;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: linear-gradient(90deg, rgb(var(--acc-500)), rgb(var(--acc-600)));
    z-index: 60;
}

nav.is-scrolled { background: rgb(var(--ink) / 0.8); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6); }
nav { transition: background 0.3s ease, box-shadow 0.3s ease; }

/* --- Текст --- */
.gradient-text {
    background: linear-gradient(90deg, rgb(var(--acc-400)), rgb(var(--acc-300)), rgb(var(--acc-400)));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

.text-balance { text-wrap: balance; }

/* слова заголовка, разрезанные motion.js */
.split-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.6em) rotateX(-70deg);
    transform-origin: 50% 100%;
    filter: blur(6px);
    transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.9s ease, filter 0.9s ease;
    transition-delay: calc(var(--i) * 55ms);
}
.split-host { perspective: 800px; }
.split-host.is-in .split-word { opacity: 1; transform: none; filter: none; }

/* --- Появление при прокрутке --- */
[data-reveal] {
    opacity: 0;
    transform: perspective(1000px) translateY(40px) rotateX(12deg) scale(0.98);
    transition: opacity 0.9s ease, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition-delay: var(--delay, 0ms);
    will-change: transform, opacity;
}
[data-reveal="left"] { transform: perspective(1000px) translateX(-50px) rotateY(10deg); }
[data-reveal="right"] { transform: perspective(1000px) translateX(50px) rotateY(-10deg); }
[data-reveal="zoom"] { transform: perspective(1000px) translateZ(-120px) scale(0.92); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* --- Стеклянные карточки + 3D-наклон --- */
.glass {
    background: linear-gradient(145deg, rgb(var(--neu-900) / 0.72), rgb(var(--neu-900) / 0.45));
    border: 1px solid rgb(var(--neu-400) / 0.14);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 18px;
}

.tilt {
    position: relative;
    transform-style: preserve-3d;
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s ease, box-shadow 0.4s ease;
}
/* карточка с наклоном, ещё не появившаяся: сначала отрабатывает reveal */
.tilt[data-reveal] {
    transition: opacity 0.9s ease, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition-delay: var(--delay, 0ms);
}
.tilt[data-reveal]:not(.is-in) { transform: perspective(1000px) translateY(40px) rotateX(12deg) scale(0.98); }
.tilt[data-reveal].is-in { transform: perspective(900px) rotateX(0deg) rotateY(0deg); }
.tilt.is-tilting { transition: transform 0.08s linear, border-color 0.3s ease, box-shadow 0.4s ease; }
.tilt:hover {
    border-color: rgb(var(--acc-400) / 0.35);
    box-shadow: 0 30px 60px -25px rgb(var(--acc-500) / 0.35);
}
/* блик, следующий за курсором */
.tilt::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgb(var(--acc-400) / 0.14), transparent 45%);
}
.tilt:hover::after { opacity: 1; }
.tilt > .depth { transform: translateZ(40px); }
.tilt > .depth-sm { transform: translateZ(20px); }

/* --- Кнопки --- */
.btn-primary {
    position: relative;
    background: linear-gradient(90deg, rgb(var(--acc-600)), rgb(var(--acc-500)));
    box-shadow: 0 8px 30px -8px rgb(var(--acc-500) / 0.6);
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.25s ease;
}
.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.35), transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.8s ease;
}
.btn-primary:hover::before { transform: translateX(120%); }
.btn-primary:hover { box-shadow: 0 12px 40px -8px rgb(var(--acc-600) / 0.7); }
.magnetic { will-change: transform; }

.filter-active {
    background: linear-gradient(90deg, rgb(var(--acc-600)), rgb(var(--acc-500))) !important;
    color: rgb(var(--on-accent)) !important;
    border-color: transparent !important;
    box-shadow: 0 4px 14px 0 rgb(var(--acc-500) / 0.3);
}

/* --- Бегущая строка клиентов --- */
.marquee {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
/* движение задаёт motion.js: автопрокрутка, перетаскивание, кнопки */
.marquee {
    cursor: grab;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}
.marquee.is-dragging { cursor: grabbing; }
.marquee-track {
    display: flex;
    gap: 16px;
    width: max-content;
    will-change: transform;
}
.marquee-track > * { pointer-events: none; }

.marquee-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}
.marquee-btn {
    width: 40px; height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgb(var(--neu-300));
    background: rgb(255 255 255 / 0.05);
    border: 1px solid rgb(var(--neu-400) / 0.2);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.marquee-btn:hover { color: rgb(var(--acc-400)); border-color: rgb(var(--acc-500) / 0.4); background: rgb(var(--acc-500) / 0.08); }
.marquee-btn:focus-visible { outline: 2px solid rgb(var(--acc-500)); outline-offset: 2px; }
.marquee-btn svg { width: 18px; height: 18px; }

/* --- Индикатор прокрутки в hero --- */
.scroll-hint {
    width: 24px; height: 38px;
    border: 2px solid rgb(var(--neu-400) / 0.4);
    border-radius: 14px;
    position: relative;
}
.scroll-hint::after {
    content: '';
    position: absolute;
    left: 50%; top: 7px;
    width: 4px; height: 8px;
    margin-left: -2px;
    border-radius: 2px;
    background: rgb(var(--acc-400));
    animation: scrollHint 1.8s ease-in-out infinite;
}
@keyframes scrollHint { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* плавающие плашки в hero */
.float { animation: float 7s ease-in-out infinite; }
.float-2 { animation-delay: -2.5s; }
.float-3 { animation-delay: -4.5s; }
@keyframes float { 50% { transform: translateY(-14px); } }

.pulse-dot { box-shadow: 0 0 0 0 rgb(var(--acc-400) / 0.6); animation: pulseDot 2s infinite; }
@keyframes pulseDot { 70% { box-shadow: 0 0 0 10px rgb(var(--acc-400) / 0); } 100% { box-shadow: 0 0 0 0 rgb(var(--acc-400) / 0); } }

/* --- Этапы: линия прогресса --- */
.timeline-line {
    position: absolute;
    left: 23px; top: 0; bottom: 0;
    width: 2px;
    background: rgb(var(--neu-400) / 0.15);
}
.timeline-fill {
    position: absolute;
    inset: 0;
    transform-origin: 50% 0;
    transform: scaleY(var(--fill, 0));
    background: linear-gradient(180deg, rgb(var(--acc-400)), rgb(var(--acc-600)));
    box-shadow: 0 0 12px rgb(var(--acc-400) / 0.6);
}
.step-dot { transition: background 0.4s ease, box-shadow 0.4s ease, color 0.4s ease, border-color 0.4s ease; }
.step.is-active .step-dot {
    background: linear-gradient(135deg, rgb(var(--acc-500)), rgb(var(--acc-600)));
    border-color: transparent;
    color: rgb(var(--on-accent));
    box-shadow: 0 0 24px rgb(var(--acc-400) / 0.55);
}

/* курсор-прожектор */
#cursor-glow {
    position: fixed;
    top: 0; left: 0;
    width: 520px; height: 520px;
    margin: -260px 0 0 -260px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle, rgb(var(--acc-400) / 0.08), transparent 60%);
    transform: translate3d(-999px, -999px, 0);
}

/* карточки кейсов при фильтрации */
.case-enter { animation: caseEnter 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: var(--delay, 0ms); }
@keyframes caseEnter { from { opacity: 0; transform: perspective(900px) translateY(30px) rotateX(-15deg) scale(0.96); } }

@media (max-width: 640px) {
    .tilt > .depth, .tilt > .depth-sm { transform: none; }
}

@media (hover: none) {
    #cursor-glow { display: none; }
}

/* уважение к настройке «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
    [data-reveal], .split-word { opacity: 1 !important; transform: none !important; filter: none !important; }
}

/* текст на акцентном фоне: белый на оранжевом, тёмный на лайме */
.btn-primary, .on-accent { color: rgb(var(--on-accent)) !important; }


/* --- FAQ --- */
.faq summary::-webkit-details-marker { display: none; }
.faq-icon { transition: transform 0.3s ease, background 0.3s ease; font-size: 20px; line-height: 1; }
.faq[open] .faq-icon { transform: rotate(45deg); background: rgb(var(--acc-500) / 0.15); }
.faq[open] { border-color: rgb(var(--acc-500) / 0.3); }
.faq summary:focus-visible { outline: 2px solid rgb(var(--acc-500)); outline-offset: -2px; border-radius: 18px; }

/* --- Уведомление о cookie --- */
#cookie-bar {
    position: fixed;
    left: 16px; right: 16px; bottom: 16px;
    z-index: 70;
    max-width: 420px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgb(var(--neu-900) / 0.96);
    border: 1px solid rgb(var(--neu-400) / 0.2);
    box-shadow: 0 20px 50px -15px rgb(0 0 0 / 0.7);
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: 13px;
    line-height: 1.5;
    color: rgb(var(--neu-300));
}
@media (max-width: 640px) { #cookie-bar { right: 16px; max-width: none; } }
#cookie-bar a { color: rgb(var(--acc-400)); text-decoration: underline; }
#cookie-bar button { flex-shrink: 0; padding: 9px 16px; border-radius: 10px; font-weight: 600; }

/* --- Подсказка над узлом 3D-схемы --- */
#scene-tip {
    position: fixed;
    top: 0; left: 0;
    z-index: 55;
    pointer-events: none;
    max-width: 240px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgb(var(--neu-900) / 0.92);
    border: 1px solid rgb(var(--acc-500) / 0.35);
    box-shadow: 0 12px 30px -12px rgb(0 0 0 / 0.7);
    color: rgb(var(--text));
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
#scene-tip.is-visible { opacity: 1; }
#scene-tip span { display: block; font-size: 11px; font-weight: 500; color: rgb(var(--acc-400)); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
#scene-tip em { display: block; font-style: normal; font-size: 12px; font-weight: 500; color: rgb(248 113 113); margin-top: 3px; }

/* --- «Окно» для 3D-схемы в шапках сюжетных разделов --- */
.story-head { position: relative; }
.story-slot { display: block; width: 100%; height: 140px; margin-bottom: 20px; pointer-events: none; } /* на телефоне — окно над заголовком */
@media (min-width: 1024px) {
    .story-head { padding-right: 440px; min-height: 200px; }
    .story-slot {
        position: absolute;
        margin: 0;
        right: 0; top: 50%;
        width: 400px; height: 220px;
        transform: translateY(-50%);
        pointer-events: none;
    }
}

/* финальное окно над «Контактами»: здесь схема показывается полностью собранной */
.finale-slot { width: 100%; max-width: 560px; height: 170px; margin: 36px auto 0; pointer-events: none; }
@media (min-width: 1024px) { .finale-slot { height: 250px; } }
#scene-tip em.ai { color: rgb(var(--acc-300)); }
