/* Photo carry: tap a job's picture in a gallery and that picture grows into the top of the job's own page,
   instead of the page blinking. Going back, it shrinks home again. No script: this is the browser's own
   cross-page "view transition". See README.md and example.html.

   How to use it:
   - Link this stylesheet from every page of the site (both ends of a move must have it).
   - Give the picture in the gallery and the big picture on its page the SAME class: pc-1 for the first job,
     pc-2 for the second, up to pc-24.
   - On any one page, use each number once only.

   Browsers that don't do cross-page transitions simply change page as normal. With "reduce motion" on it is
   switched off. It works alone or with the library's page wipe, which then handles the rest of the page.

   Set on :root to fit the site:
     --pc-time   how long the picture takes to travel (.5s; keep it under .7s) */
:root { --pc-time: .5s; }

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

  /* Twenty-four slots. A name has to be written in a stylesheet, because the sites allow no inline styles. */
  .pc-1 { view-transition-name: pc-1; }   .pc-2 { view-transition-name: pc-2; }   .pc-3 { view-transition-name: pc-3; }
  .pc-4 { view-transition-name: pc-4; }   .pc-5 { view-transition-name: pc-5; }   .pc-6 { view-transition-name: pc-6; }
  .pc-7 { view-transition-name: pc-7; }   .pc-8 { view-transition-name: pc-8; }   .pc-9 { view-transition-name: pc-9; }
  .pc-10 { view-transition-name: pc-10; } .pc-11 { view-transition-name: pc-11; } .pc-12 { view-transition-name: pc-12; }
  .pc-13 { view-transition-name: pc-13; } .pc-14 { view-transition-name: pc-14; } .pc-15 { view-transition-name: pc-15; }
  .pc-16 { view-transition-name: pc-16; } .pc-17 { view-transition-name: pc-17; } .pc-18 { view-transition-name: pc-18; }
  .pc-19 { view-transition-name: pc-19; } .pc-20 { view-transition-name: pc-20; } .pc-21 { view-transition-name: pc-21; }
  .pc-22 { view-transition-name: pc-22; } .pc-23 { view-transition-name: pc-23; } .pc-24 { view-transition-name: pc-24; }

  /* One class for all of them, so the travel is styled once. */
  :is(.pc-1, .pc-2, .pc-3, .pc-4, .pc-5, .pc-6, .pc-7, .pc-8, .pc-9, .pc-10, .pc-11, .pc-12,
      .pc-13, .pc-14, .pc-15, .pc-16, .pc-17, .pc-18, .pc-19, .pc-20, .pc-21, .pc-22, .pc-23, .pc-24) {
    view-transition-class: pc;
  }

  /* The travel: the box moves and resizes from where the picture was to where it will be. */
  ::view-transition-group(.pc) {
    animation-duration: var(--pc-time);
    animation-timing-function: cubic-bezier(.3, .1, .2, 1);
    z-index: 2;                              /* above the rest of the page while it travels */
  }
  /* The small picture and the big one are different shapes. Fill the travelling box with each, cropped, so the
     picture never squashes on the way. */
  ::view-transition-old(.pc), ::view-transition-new(.pc) {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation-duration: var(--pc-time);
  }
}
