/* ===== Блочные анимации — инженерная платформа (главная) ===== */
:root {
  --block-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --block-dur: 0.72s;
}

/* --- Hero: кинематограф + поэтапный вход --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations .hero-cinema__content > * {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
    filter: blur(6px);
  }
  .has-block-animations .hero-cinema.hero-ready .hero-cinema__content > * {
    animation: blockHeroIn var(--block-dur) var(--block-ease) forwards;
  }
  .hero-cinema.hero-ready .hero-cinema__proof { animation-delay: 0.05s; }
  .hero-cinema.hero-ready .hero-cinema__badge { animation-delay: 0.14s; }
  .hero-cinema.hero-ready .hero-cinema__title { animation-delay: 0.22s; }
  .hero-cinema.hero-ready .hero-cinema__lead { animation-delay: 0.32s; }
  .hero-cinema.hero-ready .hero-cinema__actions { animation-delay: 0.42s; }
  .hero-cinema.hero-ready .hero-cinema__trust { animation-delay: 0.52s; }
  .hero-cinema.hero-ready .hero-cinema__scroll { animation: blockHeroIn 0.8s var(--block-ease) 0.65s forwards, scrollBounce 2s ease-in-out 1.4s infinite; }

  .hero-cinema.hero-ready .hero-cinema__overlay {
    animation: blockHeroOverlay 1.4s var(--block-ease) forwards;
  }
}

@keyframes blockHeroIn {
  to { opacity: 1; transform: translate3d(0, 0, 0); filter: blur(0); }
}
@keyframes blockHeroOverlay {
  from { opacity: 0.65; }
  to { opacity: 1; }
}

/* --- Fears: диагностика рисков --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="fears"]:not(.block-inview) .fears__summary {
    opacity: 0;
    transform: scale(0.96);
  }
  .has-block-animations [data-block-animate="fears"]:not(.block-inview) .fears__card {
    opacity: 0;
    transform: translate3d(-20px, 12px, 0);
  }
  .has-block-animations [data-block-animate="fears"]:not(.block-inview) .fears__bridge {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
  }
  [data-block-animate="fears"].block-inview .fears__summary {
    animation: blockScaleIn 0.75s var(--block-ease) forwards;
  }
  [data-block-animate="fears"].block-inview .fears__card {
    animation: blockSlideIn 0.65s var(--block-ease) forwards;
  }
  [data-block-animate="fears"].block-inview .fears__card:nth-child(1) { animation-delay: 0.08s; }
  [data-block-animate="fears"].block-inview .fears__card:nth-child(2) { animation-delay: 0.16s; }
  [data-block-animate="fears"].block-inview .fears__card:nth-child(3) { animation-delay: 0.24s; }
  [data-block-animate="fears"].block-inview .fears__card:nth-child(4) { animation-delay: 0.32s; }
  [data-block-animate="fears"].block-inview .fears__card--lead {
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.35);
    animation-name: blockSlideIn, blockRiskPulse;
    animation-duration: 0.65s, 1.8s;
    animation-delay: 0.08s, 0.7s;
    animation-timing-function: var(--block-ease), ease-out;
    animation-fill-mode: forwards, none;
    animation-iteration-count: 1, 1;
  }
  [data-block-animate="fears"].block-inview .fears__bridge {
    animation: blockFadeUp 0.8s var(--block-ease) 0.38s forwards;
  }
  [data-block-animate="fears"].block-inview .fears__bridge::before {
    content: "";
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--eng-blue), transparent);
    transform: scaleX(0);
    animation: blockLineDraw 0.9s var(--block-ease) 0.5s forwards;
  }
  [data-block-animate="fears"] .fears__bridge { position: relative; overflow: hidden; }
}

@keyframes blockRiskPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.28); }
  70% { box-shadow: 0 0 0 12px rgba(255, 107, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

/* --- Services: модули процесса --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="services"]:not(.block-inview) .service-card {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
  }
  [data-block-animate="services"].block-inview .service-card {
    animation: blockFadeUp 0.65s var(--block-ease) forwards;
  }
  [data-block-animate="services"].block-inview .service-card:nth-child(1) { animation-delay: 0.06s; }
  [data-block-animate="services"].block-inview .service-card:nth-child(2) { animation-delay: 0.14s; }
  [data-block-animate="services"].block-inview .service-card:nth-child(3) { animation-delay: 0.22s; }
  [data-block-animate="services"].block-inview .service-card::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--eng-blue);
    transform: scaleX(0);
    transform-origin: left center;
    animation: blockLineDraw 0.55s var(--block-ease) forwards;
  }
  [data-block-animate="services"] .service-card { position: relative; overflow: hidden; }
  [data-block-animate="services"].block-inview .service-card:nth-child(1)::after { animation-delay: 0.2s; }
  [data-block-animate="services"].block-inview .service-card:nth-child(2)::after { animation-delay: 0.28s; }
  [data-block-animate="services"].block-inview .service-card:nth-child(3)::after { animation-delay: 0.36s; }
}

/* --- Equipment: спецификация / каталог --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="equipment"]:not(.block-inview) .equipment-landing__hero-copy,
  .has-block-animations [data-block-animate="equipment"]:not(.block-inview) .equipment-landing__stats {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }
  [data-block-animate="equipment"].block-inview .equipment-landing__hero-copy {
    animation: blockFadeUp 0.75s var(--block-ease) forwards;
  }
  [data-block-animate="equipment"].block-inview .equipment-landing__stats {
    animation: blockFadeUp 0.75s var(--block-ease) 0.12s forwards;
  }
  [data-block-animate="equipment"].block-inview .equipment-landing__hero-media img {
    animation: blockKenBurns 14s var(--block-ease) forwards;
  }
  .has-block-animations [data-block-animate="equipment"]:not(.block-inview) .equipment-landing__step {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  [data-block-animate="equipment"].block-inview .equipment-landing__step {
    animation: blockFadeUp 0.55s var(--block-ease) forwards;
  }
  [data-block-animate="equipment"].block-inview .equipment-landing__step:nth-child(1) { animation-delay: 0.05s; }
  [data-block-animate="equipment"].block-inview .equipment-landing__step:nth-child(2) { animation-delay: 0.14s; }
  [data-block-animate="equipment"].block-inview .equipment-landing__step:nth-child(3) { animation-delay: 0.23s; }
  [data-block-animate="equipment"].block-inview .equipment-landing__step-num {
    animation: blockStepPulse 0.5s var(--block-ease) forwards;
  }
  .has-block-animations [data-block-animate="equipment"]:not(.block-inview) .equipment-landing__card {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
  [data-block-animate="equipment"].block-inview .equipment-landing__card {
    animation: blockFadeUp 0.6s var(--block-ease) forwards;
  }
  [data-block-animate="equipment"].block-inview .equipment-landing__grid .equipment-landing__card:nth-child(1) { animation-delay: 0.04s; }
  [data-block-animate="equipment"].block-inview .equipment-landing__grid .equipment-landing__card:nth-child(2) { animation-delay: 0.1s; }
  [data-block-animate="equipment"].block-inview .equipment-landing__grid .equipment-landing__card:nth-child(3) { animation-delay: 0.16s; }
  [data-block-animate="equipment"].block-inview .equipment-landing__grid .equipment-landing__card:nth-child(4) { animation-delay: 0.22s; }
}

@keyframes blockKenBurns {
  from { transform: scale(1.08); }
  to { transform: scale(1); }
}
@keyframes blockStepPulse {
  0% { transform: scale(0.6); box-shadow: 0 0 0 0 rgba(74, 158, 255, 0.45); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(74, 158, 255, 0); }
  100% { transform: scale(1); }
}

/* --- Cases: результаты проектов --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="cases"]:not(.block-inview) .case-card--preview {
    opacity: 0;
    transform: translate3d(0, 32px, 0) scale(0.98);
  }
  [data-block-animate="cases"].block-inview .case-card--preview {
    animation: blockCaseIn 0.7s var(--block-ease) forwards;
  }
  [data-block-animate="cases"].block-inview .case-card--preview:nth-child(1) { animation-delay: 0.06s; }
  [data-block-animate="cases"].block-inview .case-card--preview:nth-child(2) { animation-delay: 0.14s; }
  [data-block-animate="cases"].block-inview .case-card--preview:nth-child(3) { animation-delay: 0.22s; }
  [data-block-animate="cases"].block-inview .case-card__photo {
    animation: blockKenBurns 12s var(--block-ease) forwards;
  }
}

@keyframes blockCaseIn {
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* --- Team: эксперты --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="team"]:not(.block-inview) .team-card {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
  }
  [data-block-animate="team"].block-inview .team-card {
    animation: blockFadeUp 0.7s var(--block-ease) forwards;
  }
  [data-block-animate="team"].block-inview .team-card:nth-child(1) { animation-delay: 0.06s; }
  [data-block-animate="team"].block-inview .team-card:nth-child(2) { animation-delay: 0.16s; }
  [data-block-animate="team"].block-inview .team-card:nth-child(3) { animation-delay: 0.26s; }
  [data-block-animate="team"].block-inview .team-card__photo {
    animation: blockPhotoReveal 0.85s var(--block-ease) forwards;
  }
  [data-block-animate="team"].block-inview .team-card:nth-child(1) .team-card__photo { animation-delay: 0.12s; }
  [data-block-animate="team"].block-inview .team-card:nth-child(2) .team-card__photo { animation-delay: 0.22s; }
  [data-block-animate="team"].block-inview .team-card:nth-child(3) .team-card__photo { animation-delay: 0.32s; }
}

@keyframes blockPhotoReveal {
  from { clip-path: inset(100% 0 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* --- Compare: инженер vs рынок --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="compare"]:not(.block-inview) .compare__card {
    opacity: 0;
  }
  .has-block-animations [data-block-animate="compare"]:not(.block-inview) .compare__card--lose {
    transform: translate3d(-24px, 0, 0);
  }
  .has-block-animations [data-block-animate="compare"]:not(.block-inview) .compare__card--win {
    transform: translate3d(24px, 0, 0);
  }
  .has-block-animations [data-block-animate="compare"]:not(.block-inview) .compare__card--stat,
  .has-block-animations [data-block-animate="compare"]:not(.block-inview) .compare__card--cta {
    transform: translate3d(0, 20px, 0);
  }
  [data-block-animate="compare"].block-inview .compare__card--lose {
    animation: blockSlideIn 0.65s var(--block-ease) forwards;
  }
  [data-block-animate="compare"].block-inview .compare__card--stat {
    animation: blockScaleIn 0.6s var(--block-ease) 0.1s forwards;
  }
  [data-block-animate="compare"].block-inview .compare__card--win {
    animation: blockSlideInRight 0.7s var(--block-ease) 0.18s forwards;
    box-shadow: 0 0 0 1px rgba(48, 209, 88, 0.2);
  }
  [data-block-animate="compare"].block-inview .compare__card--cta {
    animation: blockFadeUp 0.65s var(--block-ease) 0.28s forwards;
  }
  [data-block-animate="compare"].block-inview .compare__big {
    animation: blockComparePop 0.55s var(--block-ease) 0.22s forwards;
  }
}

@keyframes blockComparePop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- Reviews: голос владельца --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="reviews"]:not(.block-inview) .review {
    opacity: 0;
    transform: translate3d(0, 20px, 0) rotate(-0.6deg);
  }
  [data-block-animate="reviews"].block-inview .review {
    animation: blockReviewIn 0.65s var(--block-ease) forwards;
  }
  [data-block-animate="reviews"].block-inview .review:nth-child(1) { animation-delay: 0.06s; }
  [data-block-animate="reviews"].block-inview .review:nth-child(2) { animation-delay: 0.14s; }
  [data-block-animate="reviews"].block-inview .review:nth-child(3) { animation-delay: 0.22s; }
  [data-block-animate="reviews"].block-inview .review__stars .to-icon {
    animation: blockStarPop 0.35s var(--block-ease) forwards;
    opacity: 0;
    transform: scale(0.4);
  }
  [data-block-animate="reviews"].block-inview .review:nth-child(1) .review__stars .to-icon:nth-child(1) { animation-delay: 0.2s; }
  [data-block-animate="reviews"].block-inview .review:nth-child(1) .review__stars .to-icon:nth-child(2) { animation-delay: 0.24s; }
  [data-block-animate="reviews"].block-inview .review:nth-child(1) .review__stars .to-icon:nth-child(3) { animation-delay: 0.28s; }
  [data-block-animate="reviews"].block-inview .review:nth-child(1) .review__stars .to-icon:nth-child(4) { animation-delay: 0.32s; }
  [data-block-animate="reviews"].block-inview .review:nth-child(1) .review__stars .to-icon:nth-child(5) { animation-delay: 0.36s; }
}

@keyframes blockReviewIn {
  to { opacity: 1; transform: translate3d(0, 0, 0) rotate(0); }
}
@keyframes blockStarPop {
  to { opacity: 1; transform: scale(1); }
}

/* --- Quiz: расчёт --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="quiz"]:not(.block-inview) .funnel-quiz {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  [data-block-animate="quiz"].block-inview .funnel-quiz {
    animation: blockFadeUp 0.65s var(--block-ease) forwards;
  }
  [data-block-animate="quiz"].block-inview .funnel-quiz__progress {
    overflow: visible;
  }
  [data-block-animate="quiz"].block-inview .funnel-quiz__bar {
    animation: blockQuizShimmer 2.4s ease-in-out 0.4s 2;
  }
}

@keyframes blockQuizShimmer {
  0%, 100% { filter: brightness(1); box-shadow: none; }
  50% { filter: brightness(1.15); box-shadow: 0 0 12px rgba(255, 107, 44, 0.45); }
}

/* --- AI: цифровой технолог --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="ai"]:not(.block-inview) .ai-consultant-card--featured {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }
  [data-block-animate="ai"].block-inview .ai-consultant-card--featured {
    animation: blockFadeUp 0.75s var(--block-ease) forwards, blockAiGlow 3s ease-in-out 0.8s infinite;
    position: relative;
    overflow: hidden;
  }
  [data-block-animate="ai"].block-inview .ai-consultant-card--featured::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(74, 158, 255, 0.12) 50%, transparent 60%);
    transform: translateX(-120%);
    animation: blockAiScan 1.1s var(--block-ease) 0.35s forwards;
    pointer-events: none;
  }
}

@keyframes blockAiScan {
  to { transform: translateX(120%); }
}
@keyframes blockAiGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 158, 255, 0); border-color: rgba(74, 158, 255, 0.25); }
  50% { box-shadow: 0 8px 32px rgba(74, 158, 255, 0.12); border-color: rgba(74, 158, 255, 0.45); }
}

/* --- FAQ: ясность --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="faq"]:not(.block-inview) .faq__item {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  [data-block-animate="faq"].block-inview .faq__item {
    animation: blockFadeUp 0.5s var(--block-ease) forwards;
  }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(1) { animation-delay: 0.03s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(2) { animation-delay: 0.06s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(3) { animation-delay: 0.09s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(4) { animation-delay: 0.12s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(5) { animation-delay: 0.15s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(6) { animation-delay: 0.18s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(7) { animation-delay: 0.21s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(8) { animation-delay: 0.24s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(9) { animation-delay: 0.27s; }
  [data-block-animate="faq"].block-inview .faq__item:nth-child(10) { animation-delay: 0.3s; }
}

/* --- Upload: финальная конверсия --- */
@media (prefers-reduced-motion: no-preference) {
  .has-block-animations [data-block-animate="upload"]:not(.block-inview) .lead__text {
    opacity: 0;
    transform: translate3d(-28px, 0, 0);
  }
  .has-block-animations [data-block-animate="upload"]:not(.block-inview) .lead__form {
    opacity: 0;
    transform: translate3d(28px, 0, 0);
  }
  [data-block-animate="upload"].block-inview .lead__text {
    animation: blockSlideIn 0.75s var(--block-ease) forwards;
  }
  [data-block-animate="upload"].block-inview .lead__form {
    animation: blockSlideInRight 0.75s var(--block-ease) 0.12s forwards;
  }
  [data-block-animate="upload"].block-inview .lead__visual img {
    animation: blockKenBurns 10s var(--block-ease) forwards;
  }
}

/* --- Общие keyframes --- */
@keyframes blockFadeUp {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes blockSlideIn {
  from { opacity: 0; transform: translate3d(-20px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes blockSlideInRight {
  from { opacity: 0; transform: translate3d(20px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes blockScaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes blockLineDraw {
  to { transform: scaleX(1); }
}

/* Сетка eng-section — лёгкое проявление при входе */
@media (prefers-reduced-motion: no-preference) {
  [data-block-animate].eng-section:not(.block-inview)::before { opacity: 0; }
  [data-block-animate].eng-section.block-inview::before {
    animation: blockGridIn 1s var(--block-ease) forwards;
  }
}
@keyframes blockGridIn {
  from { opacity: 0; }
  to { opacity: 0.4; }
}
