/**
 * AstroPrecise — page enter fade + cross-document view transitions.
 * Loaded on lite shell and tool pages before full main.css.
 */

@view-transition {
  navigation: auto;
}

@keyframes ap-nav-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes vt-fade-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.02); }
}

@keyframes vt-fade-in {
  from { opacity: 0; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1); }
}

body.ap-nav-enter {
  opacity: 0;
}

body.ap-nav-enter.ap-nav-enter--active {
  opacity: 1;
  transition: opacity 0.35s ease;
}

::view-transition-old(root) {
  animation: vt-fade-out 0.35s ease both;
  z-index: 1;
}

::view-transition-new(root) {
  animation: vt-fade-in 0.35s ease both;
  z-index: 2;
}

/* Toasts (from main.css) stay above transition groups when main.css is deferred */
.toast-container {
  z-index: 10050;
}

/* Wave 3 — cast→chart spatial morph. Naming the orrery viewport (index.html)
   and the natal-wheel mount (chart.html) with the SAME name upgrades the root
   cross-fade into a morph across the index→chart navigation: the orrery flies
   over and becomes the chart wheel. Both are aspect-1:1, size-stable, and
   appear exactly once on their page (each rule is inert on the page lacking its
   element; verified no cross-page collision). Gated to no-preference so
   reduced-motion keeps the plain cross-fade — and the ::view-transition-group(*)
   1ms override below neutralises the named group as a belt-and-braces guard.
   If either endpoint is missing/hidden, the engine auto-falls-back to the root
   cross-fade, so the worst case is exactly today's behaviour. */
@media (prefers-reduced-motion: no-preference) {
  #orrery-viewport { view-transition-name: ap-celestial-wheel; }
  #natal-wheel { view-transition-name: ap-celestial-wheel; }
}

@media (prefers-reduced-motion: reduce) {
  body.ap-nav-enter,
  body.ap-nav-enter.ap-nav-enter--active {
    opacity: 1;
    transition: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
  }
}