/* ==========================================================================
   altScope v2 motion
   Transform and opacity only. Hover colour changes already live in theme.css.
   Content stays visible until <html class="js"> is set, and again if the
   visitor prefers reduced motion.
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  :where(h1, h2, h3, [id]) { scroll-margin-top: 24px; }

  /* Cross-document view transition. The header is its own snapshot so the
     bar stays put while the page fades. Browsers without the feature ignore
     the at-rule. */
  @view-transition {
    navigation: auto;
  }
  #masthead {
    view-transition-name: altscope-header;
  }
  ::view-transition-group(altscope-header) {
    animation-duration: 120ms;
    z-index: 100;
  }
  ::view-transition-old(root) {
    animation: 160ms var(--ease) both altscope-v2-vt-out;
  }
  ::view-transition-new(root) {
    animation: 200ms var(--ease) both altscope-v2-vt-in;
  }

  /* Hero entrance. The title and lead stay at opacity 1 so they can be LCP.
     Short enough that it does not read as the page still loading. */
  html.js .as-section--hero .as-eyebrow,
  html.js .as-section--hero .as-actions {
    animation: altscope-v2-rise 240ms var(--ease) both;
  }
  html.js .as-section--hero .as-actions { animation-delay: 40ms; }

  html.js .as-reveal {
    opacity: 0;
    transform: translateY(12px);
  }
  html.js .as-reveal.is-in {
    opacity: 1;
    transform: none;
    transition:
      opacity 280ms var(--ease),
      transform 280ms var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
  }

  .ast-custom-button:active,
  .wp-block-button__link:active,
  .srfm-submit-button:active,
  button[type="submit"]:active {
    opacity: 0.92;
  }

  .footer-social a {
    transition: color var(--duration) var(--ease), opacity var(--duration) var(--ease);
  }
  .footer-social a:hover,
  .footer-social a:focus-visible { opacity: 1; }
}

@keyframes altscope-v2-rise {
  from { transform: translateY(8px); }
  to   { transform: none; }
}
@keyframes altscope-v2-vt-out {
  to { opacity: 0; }
}
@keyframes altscope-v2-vt-in {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html.js .as-reveal,
  html.js .as-reveal.is-in,
  html.js .as-section--hero .as-eyebrow,
  html.js .as-section--hero .as-actions {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}
