/* Motion — Бюро Батурина */

:root {
  --bb-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --bb-ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --bb-reveal-distance: 28px;
  --bb-reveal-duration: 0.85s;
}

@media (prefers-reduced-motion: reduce) {
  .bb-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  html.bb-motion-ready body {
    animation: bb-page-in 0.55s var(--bb-ease-out) both;
  }

  @keyframes bb-page-in {
    from {
      opacity: 0.92;
    }

    to {
      opacity: 1;
    }
  }

  .bb-reveal {
    opacity: 0;
    transition:
      opacity var(--bb-reveal-duration) var(--bb-ease-out),
      transform var(--bb-reveal-duration) var(--bb-ease-out);
    transition-delay: var(--bb-reveal-delay, 0ms);
    will-change: opacity, transform;
  }

  .bb-reveal--up {
    transform: translateY(var(--bb-reveal-distance));
  }

  .bb-reveal--hero {
    transform: translateY(20px);
  }

  .bb-reveal--left {
    transform: translateX(-24px);
  }

  .bb-reveal--scale {
    transform: scale(0.96);
  }

  .bb-reveal--fade {
    transform: none;
  }

  .bb-reveal--visible {
    opacity: 1;
    transform: none;
  }

  /* Header on scroll */
  .bb-hero__header,
  .bb-header {
    transition:
      box-shadow 0.45s var(--bb-ease-soft),
      background-color 0.45s var(--bb-ease-soft),
      backdrop-filter 0.45s var(--bb-ease-soft);
  }

  .bb-hero__header.bb-header--scrolled,
  .bb-header.bb-header--scrolled {
    box-shadow: 0 8px 32px rgba(26, 46, 64, 0.08);
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  /* Nav links — hover: color + weight (no underline) */
  .bb-hero__nav-link,
  .bb-header__nav-link,
  .bb-nav-services__trigger,
  .bb-nav-services__link,
  .bb-footer__nav-link,
  .bb-footer__services-link {
    transition: color 0.2s ease;
  }

  /* Cards & interactive blocks */
  .bb-portfolio__case,
  .bb-services__card,
  .bb-svc1__tariff,
  .bb-about__card,
  .bb-contacts-page__card,
  .bb-case__brief-card,
  .bb-r5__mini,
  .bb-r5__geo-card,
  .pain-card,
  .card--product,
  .audience-card,
  .package {
    transition:
      transform 0.4s var(--bb-ease-out),
      box-shadow 0.4s var(--bb-ease-soft);
  }

  .bb-portfolio__case:hover,
  .bb-services__card:hover,
  .bb-svc1__tariff:hover,
  .bb-about__card:hover,
  .bb-contacts-page__card:hover,
  .bb-r5__mini:hover,
  .bb-r5__geo-card:hover,
  .pain-card:hover,
  .card--product:hover,
  .audience-card:hover,
  .package:hover {
    transform: translateY(-6px);
  }

  .bb-hero__btn,
  .bb-contacts__submit,
  .bb-svc1__tariff-link,
  .bb-case__btn,
  .bb-r5__btn,
  .btn {
    transition:
      transform 0.25s var(--bb-ease-out),
      background-color 0.25s ease,
      color 0.25s ease,
      box-shadow 0.25s ease,
      border-color 0.25s ease;
  }

  .bb-hero__btn:active,
  .bb-contacts__submit:active,
  .bb-svc1__tariff-link:active,
  .bb-case__btn:active,
  .bb-r5__btn:active,
  .btn:active {
    transform: scale(0.98);
  }

  /* Главная и лендинги услуг: без zoom картинки (translateX — в bb-hero.css) */
  #bb-hero-root.bb-hero:not(.bb-hero--bots) .bb-hero__image,
  #bb-service-hero.bb-hero .bb-hero__image {
    transition: none !important;
  }

  #bb-hero-root.bb-hero:not(.bb-hero--bots) .bb-hero__visual.bb-reveal,
  #bb-hero-root.bb-hero:not(.bb-hero--bots) .bb-hero__visual.bb-reveal--visible,
  #bb-service-hero.bb-hero .bb-hero__visual.bb-reveal,
  #bb-service-hero.bb-hero .bb-hero__visual.bb-reveal--visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  #bb-hero-root.bb-hero:not(.bb-hero--service) .bb-hero__title.is-typing .bb-hero__title-line--active::after,
  #bb-hero-root.bb-hero.bb-hero--typewriter .bb-hero__title.is-typing .bb-hero__title-line--active::after,
  #bb-service-hero.bb-hero.bb-hero--typewriter .bb-hero__title.is-typing .bb-hero__title-line--active::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 0.92em;
    margin-left: 3px;
    vertical-align: -0.06em;
    background: currentColor;
    opacity: 0.65;
    animation: bb-type-cursor 0.75s step-end infinite;
  }

  @keyframes bb-type-cursor {
    50% {
      opacity: 0;
    }
  }

  #bb-hero-root.bb-hero:not(.bb-hero--service) .bb-hero__text.bb-reveal,
  #bb-hero-root.bb-hero:not(.bb-hero--service) .bb-hero__actions.bb-reveal,
  #bb-hero-root.bb-hero.bb-hero--typewriter .bb-hero__text.bb-reveal,
  #bb-hero-root.bb-hero.bb-hero--typewriter .bb-hero__actions.bb-reveal,
  #bb-service-hero.bb-hero.bb-hero--typewriter .bb-hero__text.bb-reveal,
  #bb-service-hero.bb-hero.bb-hero--typewriter .bb-hero__actions.bb-reveal {
    --bb-reveal-distance: 22px;
  }

  /* Process steps */
  .bb-process__step {
    transition: transform 0.4s var(--bb-ease-out);
  }

  .bb-process__num {
    transition: transform 0.45s var(--bb-ease-out);
  }

  .bb-process__step.bb-reveal--visible .bb-process__num {
    transform: scale(1);
  }

  .bb-process__step:not(.bb-reveal--visible) .bb-process__num {
    transform: scale(0.88);
  }

  /* FAQ items */
  .bb-faq__item,
  .bb-case-faq__item {
    transition:
      transform 0.35s var(--bb-ease-out),
      box-shadow 0.35s ease;
  }

  .bb-faq__item:hover,
  .bb-case-faq__item:hover {
    transform: translateX(4px);
  }

  /* Client logos */
  .bb-clients__logo,
  .bb-r5__logos img {
    transition: opacity 0.35s ease, transform 0.35s var(--bb-ease-out);
  }

  .bb-clients__link:hover .bb-clients__logo,
  .bb-r5__logos a:hover img {
    transform: scale(1.06);
    opacity: 0.82;
  }

  /* Case gallery */
  .bb-case__gallery-item img,
  .bb-case__intro-shot-img {
    transition: transform 0.6s var(--bb-ease-out);
  }

  .bb-case__gallery-item:hover img,
  .bb-case__intro-shot:hover .bb-case__intro-shot-img {
    transform: scale(1.03);
  }

  /* About float card */
  .bb-r5__float-card {
    transition: transform 0.5s var(--bb-ease-out);
  }

  .bb-r5__hero-visual.bb-reveal--visible .bb-r5__float-card {
    animation: bb-float 5s var(--bb-ease-soft) 0.8s infinite alternate;
  }

  @keyframes bb-float {
    from {
      transform: translateY(0);
    }

    to {
      transform: translateY(-8px);
    }
  }

  /* Arrow nudge on links with → */
  .bb-hero__btn span[aria-hidden="true"],
  .bb-services__card-more span[aria-hidden="true"],
  .bb-svc1__tariff-link span[aria-hidden="true"],
  .btn span[aria-hidden="true"] {
    display: inline-block;
    transition: transform 0.25s var(--bb-ease-out);
  }

  .bb-hero__btn:hover span[aria-hidden="true"],
  .bb-services__card:hover .bb-services__card-more span[aria-hidden="true"],
  .bb-svc1__tariff-link:hover span[aria-hidden="true"],
  .btn:hover span[aria-hidden="true"] {
    transform: translateX(4px);
  }
}
