/* Card tiles (home Popular Cards, categories, search): with a desktop mouse the card tilts toward the pointer, with a
   soft shadow and a light on it (Vlad 11-23, idea C of qcc-local/tile_hover). js/tile_hover.js finds where the card
   sits in its square picture and sets the --th-* values. Phones, tablets and reduced motion get nothing.
   Only transform and opacity change while the mouse moves. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  /* the old hover (a grey inset box on the whole tile) gives way to the tilt */
  .products--grid .product:hover { -webkit-box-shadow: none; box-shadow: none; }

  .products--grid .image_link.th-ready {
    -webkit-transition: -webkit-transform .45s cubic-bezier(.2, .7, .3, 1); transition: transform .45s cubic-bezier(.2, .7, .3, 1);
  }
  .products--grid .product:hover .image_link.th-ready {
    -webkit-transition-duration: .15s; transition-duration: .15s;
    -webkit-transform: perspective(700px) rotateX(var(--th-rx, 0deg)) rotateY(var(--th-ry, 0deg)) scale(1.04);
            transform: perspective(700px) rotateX(var(--th-rx, 0deg)) rotateY(var(--th-ry, 0deg)) scale(1.04);
  }
  /* the picture is cut to the card, so the white square around it does not tilt as a white plate */
  .products--grid .image_link.th-ready .product-image {
    position: relative; z-index: 1;
    -webkit-clip-path: inset(var(--th-ct) var(--th-cr) var(--th-cb) var(--th-cl)); clip-path: inset(var(--th-ct) var(--th-cr) var(--th-cb) var(--th-cl));
  }
  /* the card's own box: the shadow under it (before) and the light on it (after) */
  .products--grid .image_link.th-ready::before,
  .products--grid .image_link.th-ready::after {
    content: ""; position: absolute; pointer-events: none;
    top: var(--th-t); right: var(--th-r); bottom: var(--th-b); left: var(--th-l);
    opacity: 0; -webkit-transition: opacity .3s; transition: opacity .3s;
  }
  .products--grid .image_link.th-ready::before { z-index: 0; -webkit-box-shadow: 0 10px 22px rgba(60, 30, 100, .22); box-shadow: 0 10px 22px rgba(60, 30, 100, .22); }
  .products--grid .image_link.th-ready::after { z-index: 2; background: linear-gradient(135deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 60%); }
  .products--grid .product:hover .image_link.th-ready::before { opacity: 1; }
  .products--grid .product:hover .image_link.th-ready::after { opacity: var(--th-sh, .3); }
}
