/* All three images share the 1585 × 992 coordinates of the artist's cover. */
.scene__drift {
  container-type: size;
  transform: none;
  will-change: auto;
}

.mandala-art {
  --crop-x: 50%;
  --cover-image: url("assets/ritual-still.jpg");
  position: absolute;
  left: var(--crop-x);
  top: 50%;
  translate: calc(-1 * var(--crop-x)) -50%;
  width: max(100%, 159.77823cqh);
  aspect-ratio: 1585 / 992;
  isolation: isolate;
  filter: brightness(.85);
}

.mandala-art .scene__image,
html.js-motion .mandala-art .scene__image {
  width: 100%;
  height: auto;
  filter: none;
  animation: none;
}

/* Match a 340px crop of the still so only its original gold rim changes brightness. */
html.js-motion .mandala-art::before {
  content: "";
  position: absolute;
  left: calc(100% * 1176 / 1585);
  top: calc(100% * 480 / 992);
  translate: -50% -50%;
  width: calc(100% * 340 / 1585);
  aspect-ratio: 1;
  pointer-events: none;
  background-image: var(--cover-image);
  background-size: calc(100% * 1585 / 340) auto;
  background-position: calc(100% * (1176 - 170) / (1585 - 340))
                       calc(100% * (480 - 170) / (992 - 340));
  background-repeat: no-repeat;
  mask-image: radial-gradient(circle closest-side, transparent 56%, black 70% 83%, transparent 100%);
  animation: corona-breath 4.5s ease-in-out infinite alternate;
}

.mandala-wheel {
  position: absolute;
  /* Shared centre of the original flower and halo: (1192, 484). */
  left: 75.20505%;
  top: 48.79032%;
  translate: -50% -50%;
  aspect-ratio: 1;
  display: block;
  background: center / cover no-repeat;
  mix-blend-mode: screen;
  pointer-events: none;
}

.mandala-petals {
  width: 45.42587%;
}

.mandala-art > .mandala-petals {
  background-image: url("assets/ritual-petals.jpg");
}

.mandala-orbit {
  width: 71.92429%;
}

.mandala-art > .mandala-orbit {
  background-image: url("assets/ritual-orbit.jpg");
}

html.js-motion .mandala-petals {
  animation: petal-turn 180s linear infinite;
}

html.js-motion .mandala-orbit {
  animation: orbit-turn 300s linear infinite;
}

html.motion-paused .mandala-wheel,
html.motion-paused .mandala-art::before,
.hero.is-offscreen .mandala-wheel,
.hero.is-offscreen .mandala-art::before {
  animation-play-state: paused;
}

@keyframes corona-breath {
  from { filter: brightness(.62); }
  to { filter: brightness(1.22); }
}

@keyframes petal-turn {
  from { transform: rotate(0turn); }
  to { transform: rotate(1turn); }
}

@keyframes orbit-turn {
  from { transform: rotate(0turn); }
  to { transform: rotate(-1turn); }
}

@media (max-width: 640px) {
  .mandala-art {
    --crop-x: 74%;
    filter: brightness(.7);
  }
}

.mobile-mandala {
  display: none;
}

@media (max-width: 640px), (max-height: 500px) and (pointer: coarse) {
  .mandala-art { --cover-image: url("assets/ritual-mobile.webp"); }
  .mandala-art > .mandala-wheel { display: none; }
  .mobile-mandala {
    display: block;
    position: absolute;
    inset: 0;
    isolation: isolate;
    opacity: 0;
    transition: opacity .9s ease;
  }
  .mobile-mandala__base {
    display: block;
    width: 100%;
    height: auto;
  }
  .mobile-mandala .mandala-wheel { height: auto; }
  html.js-motion .mobile-mandala:not(.is-ready) .mandala-wheel { animation: none; }
  html.js-motion .mobile-mandala.is-ready { opacity: 1; }
  html.js-motion .mandala-art::before {
    z-index: 1;
    filter: brightness(1.4);
    animation-name: corona-opacity;
  }
}

@keyframes corona-opacity {
  from { opacity: 0; }
  to { opacity: .9; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-mandala { display: none; }
  .mandala-art .mandala-wheel,
  .mandala-art::before {
    animation: none !important;
  }
}
