/* KICKSTW reskin: motion, the 'motion' switch (includes/class-motion.php). The rule is the motion
   line of site_prototype/DESIGN.md in kickstw_stock, adopted 24 Nov; the look before and after is
   compared on site_prototype/page-motion.html. Every selector starts with the body class the switch
   adds. Nothing here moves for a visitor who asks for less motion.

   1. A product photo still on its way keeps its grey tile, then fades in over 200ms once it has
      arrived. assets/js/motion.js marks it .kt-arriving while it is on its way. card.css already
      gives the card photo its 200ms opacity transition; only the waiting state is written here,
      because the photo's opacity also drives the second photo on hover, so nothing sets it back to 1.
      The picture at the right of a header dropdown does the same; its grey stand-in is the image's
      own background, which would fade with it, so the link paints that grey under the 200 x 250
      picture.
   2. The header's dropdowns, the search panel and the dim behind them fade between closed and open.
      Closed to open: in over 200ms, the columns coming down 6px. Closing: out over 150ms, taking no
      clicks while they go. From one open dropdown straight to the next (the pointer moving along
      the row) the swap is at once: header.js marks the header data-menu-swap, so a sweep along the
      row does not flicker. header.js only switches [hidden]; display is kept for the fade-out by
      transition-behavior: allow-discrete, and a browser without it closes at once, as before. The
      dropdowns only from 1025px: below that they are lists inside the menu drawer. */

@media (prefers-reduced-motion: no-preference) {
  /* 1. photos */
  body.kt-motion.kt-skin ul.products li.product.kt-card a.kt-card__media img.kt-arriving {
    opacity: 0;
    transition: none;
  }
  body.kt-motion .kt-chrome .mega__pic a {
    background: linear-gradient(var(--img-bg), var(--img-bg)) 0 0 / 200px 250px no-repeat;
  }
  body.kt-motion .kt-chrome .mega__pic img {
    transition: opacity 200ms ease;
  }
  body.kt-motion .kt-chrome .mega__pic img.kt-arriving {
    opacity: 0;
    transition: none;
  }

  /* 2. search and the dim, at every width */
  body.kt-motion .kt-chrome .search-panel,
  body.kt-motion .kt-chrome .dim {
    transition-property: opacity, display;
    transition-duration: 200ms;
    transition-timing-function: ease;
    transition-behavior: allow-discrete;
  }
  body.kt-motion .kt-chrome .search-panel[hidden],
  body.kt-motion .kt-chrome .dim[hidden] {
    opacity: 0;
    pointer-events: none;
    transition-duration: 150ms;
  }
  body.kt-motion .kt-chrome .search-panel__inner {
    transition: translate 200ms ease;
  }
  @starting-style {
    body.kt-motion .kt-chrome .search-panel:not([hidden]),
    body.kt-motion .kt-chrome .dim:not([hidden]) {
      opacity: 0;
    }
    body.kt-motion .kt-chrome .search-panel:not([hidden]) > .search-panel__inner {
      translate: 0 -6px;
    }
  }
}

/* 2. the dropdowns, from 1025px */
@media (min-width: 1025px) and (prefers-reduced-motion: no-preference) {
  body.kt-motion .kt-chrome .mega {
    transition-property: opacity, display;
    transition-duration: 200ms;
    transition-timing-function: ease;
    transition-behavior: allow-discrete;
  }
  /* Under one that opens while this one is still going. */
  body.kt-motion .kt-chrome .mega[hidden] {
    z-index: 39;
    opacity: 0;
    pointer-events: none;
    transition-duration: 150ms;
  }
  body.kt-motion .kt-chrome .mega__inner {
    transition: translate 200ms ease;
  }
  @starting-style {
    body.kt-motion .kt-chrome .mega:not([hidden]) {
      opacity: 0;
    }
    body.kt-motion .kt-chrome .mega:not([hidden]) > .mega__inner {
      translate: 0 -6px;
    }
  }
  body.kt-motion .kt-chrome .hdr[data-menu-swap] .mega,
  body.kt-motion .kt-chrome .hdr[data-menu-swap] .mega__inner {
    transition: none;
  }
}
