/* Site-wide motion. Loaded on every page after the page stylesheet.
   Everything that moves sits inside prefers-reduced-motion: no-preference. */
:root {
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-soft: cubic-bezier(0.25, 0.1, 0.25, 1);
  interpolate-size: allow-keywords;
}

nav.top {
  transition:
    box-shadow 0.3s var(--ease-soft),
    background-color 0.3s var(--ease-soft);
}
[data-scrolled] nav.top {
  box-shadow: 0 10px 30px -22px rgba(20, 8, 12, 0.55);
}

@media (prefers-reduced-motion: no-preference) {
  /* Content fades up as it scrolls into view (src/components/Motion.jsx). */
  /* "html" prefix outranks component transitions while revealing. */
  html .rv {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
    transition:
      opacity 0.65s var(--ease-out),
      transform 0.65s var(--ease-out);
    transition-delay: calc(var(--rv-i, 0) * 70ms);
  }
  html .rv.rv-in {
    opacity: 1;
    transform: none;
  }

  /* Page change: the new page settles in. */
  [data-navigated] main#main {
    animation: page-in 0.4s var(--ease-out) both;
  }
  @keyframes page-in {
    from {
      opacity: 0;
      transform: translate3d(0, 10px, 0);
    }
  }

  /* Solutions menu. */
  .ddmenu:not([hidden]) {
    transform-origin: top right;
    animation: menu-in 0.2s var(--ease-out) both;
  }
  @keyframes menu-in {
    from {
      opacity: 0;
      transform: translate3d(0, -6px, 0) scale(0.98);
    }
  }
  .ddmenu a {
    transition:
      background-color 0.18s var(--ease-soft),
      color 0.18s var(--ease-soft);
  }

  /* Dialogs (demo, contact, OTP, downloads). */
  dialog.modal[open] {
    animation: dialog-in 0.3s var(--ease-out) both;
  }
  dialog.modal[open]::backdrop {
    animation: fade-in 0.3s var(--ease-soft) both;
  }
  @keyframes dialog-in {
    from {
      opacity: 0;
      transform: translate3d(0, 14px, 0) scale(0.98);
    }
  }
  @keyframes fade-in {
    from {
      opacity: 0;
    }
  }
  .mdone,
  .msteps {
    animation: fade-up 0.35s var(--ease-out) both;
  }

  /* Swapped content: pricing tabs, form results. */
  .tab-in,
  .cb-done,
  .wform[role="status"] {
    animation: fade-up 0.35s var(--ease-out) both;
  }
  @keyframes fade-up {
    from {
      opacity: 0;
      transform: translate3d(0, 8px, 0);
    }
  }

  /* FAQ answers open smoothly where the browser supports it. */
  .faq details::details-content {
    height: 0;
    overflow: clip;
    transition:
      height 0.32s var(--ease-out),
      content-visibility 0.32s allow-discrete;
  }
  .faq details[open]::details-content {
    height: auto;
  }
  .faq details {
    transition: border-color 0.2s var(--ease-soft);
  }
  .faq details:hover {
    border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  }

  /* Buttons press in slightly. */
  .btn {
    transition:
      transform 0.18s var(--ease-out),
      background-color 0.18s var(--ease-soft),
      border-color 0.18s var(--ease-soft),
      color 0.18s var(--ease-soft),
      box-shadow 0.18s var(--ease-soft);
  }
  .btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
  }

  /* Cards: lift and a gentle image zoom. */
  .post,
  .ebook,
  .news-card,
  .ev-card {
    transition:
      transform 0.3s var(--ease-out),
      box-shadow 0.3s var(--ease-out);
  }
  .post:hover,
  .ebook:hover,
  .news-card:hover,
  .ev-card:hover {
    transform: translate3d(0, -3px, 0);
    box-shadow:
      0 1px 2px rgba(20, 12, 14, 0.05),
      0 16px 36px rgba(20, 12, 14, 0.1);
  }
  .post-img,
  .ebook img,
  .news-card img {
    transition: transform 0.6s var(--ease-out);
  }
  .post:hover .post-img,
  .ebook:hover img {
    transform: scale(1.03);
  }
  .ebook,
  .news-card {
    overflow: hidden;
  }

  /* Pricing plan cards and tabs. */
  .plan {
    transition:
      transform 0.3s var(--ease-out),
      box-shadow 0.3s var(--ease-out);
  }
  .plan:hover {
    transform: translate3d(0, -3px, 0);
    box-shadow: 0 18px 40px -20px rgba(174, 21, 54, 0.35);
  }
  .ptabs button,
  .chips button,
  .az a,
  .res-ico {
    transition:
      background-color 0.2s var(--ease-soft),
      border-color 0.2s var(--ease-soft),
      color 0.2s var(--ease-soft),
      box-shadow 0.2s var(--ease-soft),
      transform 0.25s var(--ease-out);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html:not([data-navigated]) nav.top {
    animation: fade-in 0.3s var(--ease-soft) both;
  }
  html:not([data-navigated])
    main#main
    > :is(:first-child:not(.read-progress), .read-progress + *)
    > .wrap
    > *,
  html:not([data-navigated])
    main#main
    > :is(.wrap:first-child, .read-progress + .wrap)
    > *,
  html:not([data-navigated]) main#main > .art-grid {
    animation: hero-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.32s;
  }
  html:not([data-navigated])
    main#main
    > :is(:first-child:not(.read-progress), .read-progress + *)
    > .wrap
    > *:nth-child(1),
  html:not([data-navigated])
    main#main
    > :is(.wrap:first-child, .read-progress + .wrap)
    > *:nth-child(1) {
    animation-delay: 0.06s;
  }
  html:not([data-navigated])
    main#main
    > :is(:first-child:not(.read-progress), .read-progress + *)
    > .wrap
    > *:nth-child(2),
  html:not([data-navigated])
    main#main
    > :is(.wrap:first-child, .read-progress + .wrap)
    > *:nth-child(2) {
    animation-delay: 0.12s;
  }
  html:not([data-navigated])
    main#main
    > :is(:first-child:not(.read-progress), .read-progress + *)
    > .wrap
    > *:nth-child(3),
  html:not([data-navigated])
    main#main
    > :is(.wrap:first-child, .read-progress + .wrap)
    > *:nth-child(3) {
    animation-delay: 0.18s;
  }
  html:not([data-navigated])
    main#main
    > :is(:first-child:not(.read-progress), .read-progress + *)
    > .wrap
    > *:nth-child(4),
  html:not([data-navigated])
    main#main
    > :is(.wrap:first-child, .read-progress + .wrap)
    > *:nth-child(4) {
    animation-delay: 0.24s;
  }
  html:not([data-navigated])
    main#main
    > :is(:first-child:not(.read-progress), .read-progress + *)
    > .wrap
    > *:nth-child(5),
  html:not([data-navigated])
    main#main
    > :is(.wrap:first-child, .read-progress + .wrap)
    > *:nth-child(5) {
    animation-delay: 0.28s;
  }
  html:not([data-navigated]) main#main > .art-grid {
    animation-delay: 0.24s;
  }
  @keyframes hero-in {
    from {
      opacity: 0;
      transform: translate3d(0, 10px, 0);
    }
  }

  html[data-img-fade] .img-pending {
    opacity: 0;
  }
  html[data-img-fade]
    :is(
      .post-img,
      .rt img,
      .art-cover,
      .news-card img,
      .ebook img,
      .feature-card img
    ) {
    transition:
      opacity 0.45s var(--ease-soft),
      transform 0.6s var(--ease-out);
  }

  .wa-case.tab-in,
  .ig-audience.tab-in,
  .ig-gif.tab-in {
    animation: fade-up 0.4s var(--ease-out) both;
  }

  .art-toc a {
    transition: color 0.2s var(--ease-soft);
  }
}

.read-progress {
  display: none;
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .read-progress {
      display: block;
      position: fixed;
      inset: 0 0 auto 0;
      height: 3px;
      z-index: 60;
      background: var(--brand);
      transform-origin: 0 50%;
      transform: scaleX(0);
      animation: read-progress linear both;
      animation-timeline: scroll(root);
      pointer-events: none;
    }
    @keyframes read-progress {
      to {
        transform: scaleX(1);
      }
    }
  }
}

.art-toc a.active {
  color: var(--brand);
  font-weight: 600;
}
