/* Shared first-paint entrances. The established Anio 7 motion also covers
   the primary content of the other storefront page families. */
@media (prefers-reduced-motion: no-preference) {
  html[data-anio-wf-page-intro] body:not([data-motion-disabled="true"]) {
    & .ad-product-seven .ap-gallery {
      animation: anio7-detail-fade 1000ms var(--anio-wf-out) backwards;
    }

    & .ad-product-seven .ap-product-info > h1,
    & .a7c-heading--hero .a7c-intro-line {
      animation: anio7-detail-title 1300ms var(--anio-wf-out) var(--anio7-line-delay, 0ms) backwards;
    }

    & .a7c-heading--hero .a7c-intro-line {
      display: inline-block;
      max-width: 100%;
      vertical-align: top;
    }

    & .ad-product-seven .ap-product-info > .a7-new {
      animation: anio7-detail-chip 1100ms var(--anio-wf-back) 240ms backwards;
    }

    & .ad-product-seven .ap-product-info > .a7-script,
    & .a7c-heading--hero > .a7c-script {
      animation: anio7-detail-draw 1200ms var(--anio-wf-io) 180ms backwards;
    }

    & .ad-product-seven .ap-product-info > .ad-product-six__proof,
    & .ad-product-seven .ap-product-info > .ap-product-subtitle,
    & .a7c-heading--hero > p:last-child {
      animation: anio7-detail-rise 1200ms var(--anio-wf-out) 180ms backwards;
    }

    & .a7c-heading--hero::before,
    & .a7c-heading--hero::after {
      animation: anio7-detail-rise 1200ms var(--anio-wf-out) 360ms backwards;
    }

    & .a7c-heading--hero::after { animation-delay: 540ms; }

    & .a7c-hero .a7c-model:nth-child(-n + 2) {
      animation: anio7-detail-fade 600ms var(--anio-wf-out) backwards;
      & .a7c-model__image > img {
        animation: anio7-detail-watch 1600ms var(--anio-wf-out) 150ms backwards;
      }
    }

    /* Keep page-title choreography on standalone headings. Purchase forms,
       dialogs, carousel tracks and cart totals never become entrance owners. */
    & :is(.ad-product-six:not(.ad-product-seven) .ap-product-info, .ad-product__info, .ad-accessory__info, .af-sim-hero__copy, .acf-hero__copy, .af-magazine-hero__copy) > h1,
    & .anio-hero:not(.ad-hero--home) .ad-hero__title,
    & :is(.ad-editorial__copy, .af-article__header, .ad-accessories__hero, .af-cart__heading, .af-not-found__heading, .search-page__header, .shopify-policy__title) h1,
    & #MainContent .page-width__inner > .text-block > h1,
    & :is(.anio-legacy-helpcenter, .anio-legacy-smart-overview__intro, .anio-legacy-podcast__intro) > h1 {
      animation: anio7-detail-title 1300ms var(--anio-wf-out) backwards;
    }

    /* Reuse the product gallery fade for primary media; controls keep their
       normal geometry and an interaction cancels the shared intro immediately. */
    & .ad-product-six:not(.ad-product-seven) .ap-gallery,
    & :is(.ad-product__gallery, .ad-accessory__stage, .af-sim-hero__art, .acf-hero__art, .af-magazine-hero__note, .af-article__hero, .af-cart__empty > img),
    & .anio-hero:not(.ad-hero--home) .ad-hero__figure {
      animation: anio7-detail-fade 1000ms var(--anio-wf-out) backwards;
    }

    & :is(.ad-product-six:not(.ad-product-seven) .ap-product-subtitle, .ad-product__subtitle, .ad-accessory__subtitle, .af-sim-hero__copy > .af-richtext, .acf-hero__body, .af-magazine-hero__copy > .af-richtext, .af-article__standfirst),
    & .anio-hero:not(.ad-hero--home) .ad-hero__body {
      animation: anio7-detail-rise 1200ms var(--anio-wf-out) 180ms backwards;
    }

    /* The second card enters on scroll in the stacked mobile layout. */
    @media (max-width: 767px) {
      & .a7c-hero .a7c-model:nth-child(2) {
        &, & .a7c-model__image > img { animation-name: none; }
      }
    }
  }

  /* Below the fold, the scroll observer owns the entrance instead. */
  html[data-anio-wf-page-intro] [data-anio-wf-scroll-intro],
  html[data-anio-wf-page-intro] [data-anio-wf-scroll-intro] .a7c-intro-line {
    animation: none !important;
  }
}

@keyframes anio7-detail-fade {
  from { opacity: 0; }
}

@keyframes anio7-detail-rise {
  from { opacity: 0; translate: 0 1.25em; }
}

@keyframes anio7-detail-title {
  from { clip-path: inset(0 -12% 100% -12%); translate: 0 1.1em; rotate: 2.5deg; }
  to { clip-path: inset(-20% -12% -20% -12%); translate: 0 0; rotate: 0deg; }
}

@keyframes anio7-detail-draw {
  from { clip-path: inset(-25% 100% -25% -5%); }
  to { clip-path: inset(-25% -5% -25% -5%); }
}

@keyframes anio7-detail-chip {
  from { opacity: 0; translate: 0 1.25em; scale: .9; }
}

@keyframes anio7-detail-watch {
  from { opacity: 0; translate: 0 calc(5 * var(--anio-wf-motion-unit)); scale: .82; rotate: -7deg; }
}
