/**
 * Lottie animations on the case studies (inc/lottie.php: Von Block's Lottie block, class
 * kloos-lottie): the animation takes the picture's place. Over the picture when the post has one
 * (.has-fallback: the picture shows until the animation is drawn, and stays for reduced motion), in
 * its place, at the animation's proportions, when it has none.
 */

.kloos-lottie {
  display: block;
  width: 100%;
  overflow: hidden;
}

/* Over the picture, in the picture's link or figure */
.kloos-has-lottie,
.kloos-has-lottie > a {
  position: relative;
}

.kloos-lottie.has-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  aspect-ratio: auto !important;
}

/* The picture until the animation is drawn (the player puts its <svg> in when it is) */
.kloos-has-lottie:has(.kloos-lottie svg) img {
  visibility: hidden;
}

/* Reduced motion: the picture, where there is one, instead of the animation's first frame (hidden,
   the animation never loads) */
@media (prefers-reduced-motion: reduce) {
  .kloos-lottie.has-fallback {
    display: none;
  }
}

/* A card: the animation is its picture, so the title in the box (the card without a picture) is not
   shown, as with a picture (Global CSS "blog-card-media") */
.blog-card-media:has(.kloos-lottie) .blog-card-media-title {
  display: none;
}

.blog-card-media figure.kloos-has-lottie {
  width: 100%;
  margin: 0;
}

/* A case study card fills its box (Global CSS "blog-card-media-cover") */
.blog-card-media-cover figure.kloos-has-lottie,
.blog-card-media-cover figure.kloos-has-lottie > a {
  display: block;
  width: 100%;
  height: 100%;
}

/* (Its size only: whether it shows is said above) */
.blog-card-media-cover .kloos-lottie {
  width: 100%;
  height: 100%;
}
