/* Motion layer. Kept outside the build so the minifier cannot fold animation-timeline into a shorthand.
   Everything here is decoration: with this file missing, or with reduced motion on, the pages read the same. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  /* Between the home page and Corporate T2 the photo and the copper disc move to their new places. */
  ::view-transition-group(hero-photo), ::view-transition-group(hero-disc) { animation-duration: .55s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  /* A page that arrives through such a transition skips its own entrance, or the disc would shrink and grow again. */
  .vt .hero-art .disc, .vt .t2-art .disc, .vt .hero-art .cut { animation: none; }

  /* First screen: the disc grows in behind the portrait. Text is never animated. */
  .hero-art .disc, .t2-art .disc { animation: disc-in .9s cubic-bezier(.2, .8, .2, 1) both; }
  /* The portrait and the price only slide: they stay visible even if an animation never runs. */
  .hero-art .cut { animation: rise-in .9s cubic-bezier(.2, .8, .2, 1) backwards; }
  .price { animation: rise-in .8s cubic-bezier(.2, .8, .2, 1) backwards; }
  /* Region scene: when it first comes into view, copper light runs once along every line to Chilliwack
     and the sign answers with one ring. After that the scene is still. */
  .reach.is-seen .arc-light { stroke-dasharray: .22 1; animation: arc-light 1.5s cubic-bezier(.45, 0, .2, 1); }
  .reach.is-seen .ring { animation: reach-ring 1.3s ease-out 1.15s; }
  @keyframes arc-light { from { stroke-dashoffset: .22; opacity: 1; } 85% { opacity: 1; } to { stroke-dashoffset: -1; opacity: 0; } }
  @keyframes reach-ring { from { transform: scale(1); opacity: .6; } to { transform: scale(1.9); opacity: 0; } }
  /* Steps: the copper line is drawn once. Without the script the line is simply there. */
  .motion ol.steps:not(.is-seen)::after { transform: scaleX(0); }
  .motion ol.steps.is-seen::after { animation: steps-line 1s cubic-bezier(.2, .8, .2, 1) backwards; }
  @keyframes steps-line { from { transform: scaleX(0); } }
  /* Reviews: the count flashes when a filter changes it */
  @keyframes fresh { from { background: var(--lime); } to { background: transparent; } }
  @keyframes disc-in { from { transform: scale(.55); opacity: 0; } }
  @keyframes rise-in { from { transform: translateY(26px); } }

  @supports (animation-timeline: view()) {
    /* Header tightens after the first scroll */
    .site-header .bar { animation-name: bar-tight; animation-timing-function: linear; animation-fill-mode: both; animation-timeline: scroll(root); animation-range: 0px 160px; }
    .site-header .mark { animation-name: mark-tight; animation-timing-function: linear; animation-fill-mode: both; animation-timeline: scroll(root); animation-range: 0px 160px; transform-origin: left center; }
    @keyframes bar-tight { to { padding-block: .4rem; } }
    @keyframes mark-tight { to { transform: scale(.82); } }

    /* Cards below the first screen rise as they enter */
    .reveal { animation-name: reveal; animation-timing-function: ease-out; animation-fill-mode: both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
    @keyframes reveal { from { opacity: .001; transform: translateY(30px); } }

    /* T2 steps: the copper line grows and each step lights up */
    .steps-wrap { view-timeline-name: --steps; }
    .steps-line { animation-name: grow-y; animation-timing-function: linear; animation-fill-mode: both; animation-timeline: --steps; animation-range: cover 12% cover 62%; }
    .steps tbody tr { animation-name: step-on; animation-timing-function: linear; animation-fill-mode: both; animation-timeline: view(); animation-range: cover 8% cover 42%; }
    @keyframes grow-y { from { transform: scaleY(0); } }
    @keyframes step-on { from { opacity: .25; transform: translateX(18px); } }
  }
}
