/* The wall opening into a project's page, and closing back into the wall. Both
   pages load this, because a transition is drawn by the page being arrived at.
   Only a project's cover carries on, as the same thing on both pages; its name,
   its line and everything else come and go with their page. Firefox just changes
   page. The slider's own shuffle marks itself "slide" and these stay out of it. */
@view-transition { navigation: auto; }

/* A trip to or from roomote's page marks itself "room" (room-carry.js), so each
   trip carries only its own cover. */
html:active-view-transition-type(room) {
  & .rm .room-only, & .article.roomote #opening { view-transition-name: roomote-room; }
}
html:not(:active-view-transition-type(slide, room)) {
  & .print.parents { view-transition-name: print-parents; }
  & .print.jobsearch { view-transition-name: print-jobsearch; }
  & .print.beyondchat { view-transition-name: print-beyondchat; }
  /* farey's phone: the one on the wall is the one at the top of its page */
  & .piece .fy-px, & .article .fy-cover .fy-px { view-transition-name: farey-phone; }
}

::view-transition-group(roomote-room),
::view-transition-group(print-parents),
::view-transition-group(print-jobsearch),
::view-transition-group(print-beyondchat),
::view-transition-group(farey-phone) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
}

/* The prints are the same on both pages, so each is one thing carried across, not
   two faded: only the arriving copy is drawn, filling the travelling box, over the
   pages coming and going. */
::view-transition-group(print-parents),
::view-transition-group(print-jobsearch),
::view-transition-group(print-beyondchat),
::view-transition-group(farey-phone) { z-index: 1; }
::view-transition-old(print-parents),
::view-transition-old(print-jobsearch),
::view-transition-old(print-beyondchat),
::view-transition-old(farey-phone) { display: none; }
::view-transition-new(print-parents),
::view-transition-new(print-jobsearch),
::view-transition-new(print-beyondchat),
::view-transition-new(farey-phone) { animation: none; opacity: 1; width: 100%; height: 100%; object-fit: fill; }

/* The room travels as it was left and arrives as the new page has it, all switched
   off: the two are the same room from the same side, so blending one into the other
   over the move reads as its lights going off on the way, not as a fade (Sean, 5 Nov). */
::view-transition-group(roomote-room) { z-index: 1; }
::view-transition-image-pair(roomote-room) { isolation: isolate; }
::view-transition-old(roomote-room),
::view-transition-new(roomote-room) { width: 100%; height: 100%; object-fit: fill; mix-blend-mode: plus-lighter;
  animation-duration: 0.45s; animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1); animation-fill-mode: both; }
::view-transition-old(roomote-room) { animation-name: room-lights-out; }
::view-transition-new(roomote-room) { animation-name: room-lights-in; }
@keyframes room-lights-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes room-lights-in { from { opacity: 0; } to { opacity: 1; } }

/* everything else on the page, arriving as the cover sets off rather than after it
   (Sean, 6 Nov: the wait read as a pause) */
::view-transition-old(root) { animation: opens-out 0.28s ease both; }
::view-transition-new(root) { animation: page-in 0.42s cubic-bezier(0.32, 0.72, 0, 1) both; }

@keyframes opens-out { to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none; }
}
