/* ==========================================================================
   VIEW TRANSITIONS between the migrated tool pages (hub + tools/<slug>/).
   Cross-document, progressive: both pages opt in by loading this file, so a
   link to a legacy tool (no opt-in) navigates as always, and browsers without
   support ignore the rule. Behaviour for the card -> title morph in
   assets/js/tools/view-transition.js.
   ========================================================================== */

@view-transition {
  navigation: auto;
}

/* The header stays put while the page under it changes */
.header {
  view-transition-name: site-header;
}

/* The title of a tool is the target of the card the visitor pressed in the
   hub (the script names that card "tool-title" for the swap only) */
.tp-title {
  view-transition-name: tool-title;
}

::view-transition-group(site-header) {
  animation-duration: 0s;
}

/* The whole page under the header: the old one leaves with a fade, the new one
   rises into place. One layer (root), so it costs the same on any page. */
::view-transition-old(root) {
  animation: tt-out .18s ease-in both;
}

::view-transition-new(root) {
  animation: tt-in .38s cubic-bezier(.2, .7, .2, 1) .08s both;
}

@keyframes tt-out {
  to { opacity: 0; transform: translateY(-8px); }
}

@keyframes tt-in {
  from { opacity: 0; transform: translateY(24px); }
}

::view-transition-group(tool-title) {
  animation-duration: .3s;
  animation-timing-function: ease-out;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
