/* ============================================================
   HOWTO ANIMATIONS — премиальный слой движения
   ============================================================ */

/* ---------- Keyframes ---------- */
@keyframes htCharIn {
    from {
        opacity: 0;
        transform: translate3d(0, 110%, 0) rotateX(-70deg);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotateX(0);
        filter: blur(0);
    }
}

@keyframes htReveal {
    from {
        opacity: 0;
        transform: translate3d(var(--rv-tx, 0px), var(--rv-ty, 40px), 0) scale(var(--rv-scale, 1));
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes htShimmerSweep {
    to { transform: translateX(250%) skewX(-20deg); }
}

@keyframes htPulse {
    0%, 100% { box-shadow: 0 0 10px #fff; transform: scale(1); }
    50% { box-shadow: 0 0 20px #fff, 0 0 30px rgba(255,255,255,.4); transform: scale(1.15); }
}

@keyframes htPulseRing {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,.85); }
    100% { box-shadow: 0 0 0 12px rgba(255,255,255,0); }
}

@keyframes htTextGlow {
    0%, 100% { text-shadow: 0 0 12px rgba(255,255,255,.6); }
    50% { text-shadow: 0 0 22px rgba(255,255,255,1), 0 0 40px rgba(255,255,255,.6); }
}

@keyframes htCheckIn {
    from { opacity: 0; transform: scale(0) rotate(-45deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes htArrowBounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

@keyframes htClockTick {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

@keyframes htNumberPop {
    0% { transform: scale(.55); opacity: 0; }
    60% { transform: scale(1.18); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------- Scroll progress bar ---------- */
.ht-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, #fff, #b0b0b0 50%, #fff);
    box-shadow: 0 0 12px rgba(255,255,255,.7);
    z-index: 99999;
    pointer-events: none;
    will-change: width;
}

/* ---------- Title: посимвольное появление ---------- */
.ht-title { perspective: 1000px; }

body.is-ready .ht-char {
    animation: htCharIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    /* было: calc(var(--i) * 45ms + 150ms)  →  стало: */
    animation-delay: calc(var(--i, 0) * 26ms + 40ms);
}

/* ---------- Scroll-reveal ---------- */
.anim-reveal {
    --rv-tx: 0px;
    --rv-ty: 40px;
    --rv-scale: 1;
    opacity: 0;
    transform: translate3d(var(--rv-tx), var(--rv-ty), 0) scale(var(--rv-scale));
    will-change: opacity, transform;
}
.anim-reveal--left   { --rv-tx: -70px; --rv-ty: 0px; }
.anim-reveal--right  { --rv-tx: 70px;  --rv-ty: 0px; }
.anim-reveal--scale  { --rv-tx: 0px;   --rv-ty: 0px; --rv-scale: 0.9; }

.anim-reveal.is-visible {
    animation: htReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: var(--anim-delay, 0ms);
}

/* ---------- Fork cards: свечение за курсором ---------- */
.ht-fork-card::after {
    background: radial-gradient(
        circle at var(--mx, 50%) var(--my, 50%),
        var(--ht-card-glow, rgba(255,255,255,.10)) 0%,
        transparent 50%
    );
    transition: opacity .5s ease, background .15s linear;
}
.ht-fork-card:hover::after {
    background: radial-gradient(
        circle at var(--mx, 50%) var(--my, 50%),
        rgba(255,255,255,.18) 0%,
        transparent 42%
    );
}

/* ---------- Магнитные кнопки ---------- */
.ht-fork-cta,
.ht-final-btn {
    will-change: transform;
}

/* Стрелка bounce на hover */
.ht-fork-cta:hover .ht-fork-cta-arrow {
    animation: htArrowBounce .7s ease infinite;
}

/* ---------- Final CTA: shimmer sweep ---------- */
.ht-final-btn--primary {
    position: relative;
    overflow: hidden;
}
.ht-final-btn--primary::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 55%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.85), transparent);
    transform: translateX(-180%) skewX(-20deg);
    pointer-events: none;
}
.ht-final-btn--primary:hover::after {
    animation: htShimmerSweep .9s ease;
}

/* ---------- Бейджи / точки: пульсация ---------- */
.ht-fork-badge-dot {
    animation: htPulse 2.5s ease-in-out infinite;
}

/* ---------- Session icon: покачивание часов ---------- */
.ht-session-icon svg {
    animation: htClockTick 4s ease-in-out infinite;
    transform-origin: center;
}

/* ---------- Checkmark при завершении шага ---------- */
.ht-step.is-done .ht-step-check::before {
    animation: htPulseRing .9s ease;
}
.ht-step.is-done .ht-step-check-text::after {
    content: ' ✓';
    display: inline-block;
    animation: htCheckIn .5s cubic-bezier(0.34, 1.56, 0.64, 1) .1s backwards;
}
.ht-step.is-done .ht-step-num {
    animation: htNumberPop .55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Прогресс готов: свечение текста ---------- */
.ht-progress-status.is-done {
    animation: htTextGlow 2s ease-in-out infinite;
}

/* ---------- Ambient particles — чуть ярче ---------- */
.ht-ambient-particle {
    box-shadow: 0 0 12px rgba(255,255,255,.5);
}

/* ---------- Уважаем настройки доступности ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .ht-char { opacity: 1; transform: none; filter: none; }
    .anim-reveal { opacity: 1; transform: none; }
}