/* Legal pages: switching documents. Linked from the head of the four legal pages only (not part of
 * site.css), so no other page takes part in the transition. js/legal-motion.js, also in the head, lets
 * the transition run only after a choice made in the switcher.
 *
 * The pill     slides from the old document to the new one and takes the new label's width.
 *              320ms (--kit-dur-medium), standard easing.
 * The names    stay where they are; the old and new labels cross-fade, grey to ink, in the same 320ms.
 *              They are named so that they paint above the pill.
 * The text     the last breadcrumb, the title, the date line, the summary and the document fade through
 *              in place: out in 120ms (--kit-dur-micro, exit easing), then in over 200ms (--kit-dur-short,
 *              entrance easing). Old and new never overlap. Nothing slides sideways: the documents are
 *              separate pages, not a carousel.
 * The rest     does not animate. The root's old and new images swap at once, so the header, the notice
 *              bar and the footer stay still.
 * On a phone   the tray scrolls the chosen document into view before the new page's first frame, so the
 *              tray and the pill move together.
 * Reduced motion: no transition; the new page loads. Browsers without cross-document view transitions
 * (Chrome and Edge before 126, Safari before 18.2, Firefox today) load the new page as before. */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

.sw-tray { view-transition-name: legal-tray; }
.sw-pill { view-transition-name: legal-pill; }
.sw-i:nth-child(1) .sw-l { view-transition-name: legal-sw-1; }
.sw-i:nth-child(2) .sw-l { view-transition-name: legal-sw-2; }
.sw-i:nth-child(3) .sw-l { view-transition-name: legal-sw-3; }
.sw-i:nth-child(4) .sw-l { view-transition-name: legal-sw-4; }
.lg-top .crumb [aria-current="page"] { view-transition-name: legal-here; }
.lg-top__title { view-transition-name: legal-title; }
.lg-meta { view-transition-name: legal-meta; }
.lg-top__lead { view-transition-name: legal-lead; }
.lg-layout { view-transition-name: legal-body; }

::view-transition-old(root),
::view-transition-new(root) { animation: none; }

::view-transition-group(*) { animation-duration: var(--kit-dur-medium); animation-timing-function: var(--kit-ease); }
::view-transition-old(*),
::view-transition-new(*) { animation-duration: var(--kit-dur-medium); animation-timing-function: var(--kit-ease); }

::view-transition-old(legal-here), ::view-transition-old(legal-title), ::view-transition-old(legal-meta),
::view-transition-old(legal-lead), ::view-transition-old(legal-body) {
  animation: legal-out var(--kit-dur-micro) var(--kit-ease-out) both;
}
::view-transition-new(legal-here), ::view-transition-new(legal-title), ::view-transition-new(legal-meta),
::view-transition-new(legal-lead), ::view-transition-new(legal-body) {
  animation: legal-in var(--kit-dur-short) var(--kit-ease-in) var(--kit-dur-micro) both;
}
@keyframes legal-out { to { opacity: 0; } }
@keyframes legal-in { from { opacity: 0; } }
