/* Mastermusic hero – "KULTUR IN BALLWIL" floating balls
 *
 * Structure:  .mm-hero (width)  >  .mm-hero__frame (height)  >  .mm-hero__stage (artwork in its
 * original proportions; background + balls always stay aligned).
 *
 * Height: --mm-height (default 70vh, shortcode attribute height="..."). The whole artwork
 * scales down to fit that height (nothing is cropped); the hero is never taller than the
 * full-width artwork.
 */
.mm-hero {
  --d: 7.86;                         /* ball diameter, % of artwork width (desktop) */
  --mm-ratio: calc(1025 / 2200);     /* artwork height / width */
  --mm-height: 70vh;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 2200px;
  margin: 0 auto;
  padding: 0;
  background: #fff;
  line-height: 0;
  container-type: inline-size;
}
/* break out of the theme's content column: [mastermusic_hero fullwidth="yes"] */
.mm-hero.mm-hero--full {
  --mm-vw: calc(100vw - var(--mm-sbw, 0px));   /* viewport width without scrollbar (set by JS) */
  width: var(--mm-vw);
  max-width: 2200px;
  margin-left: calc(50% - min(var(--mm-vw) / 2, 1100px));
  margin-right: 0;
}
.mm-hero .mm-hero__frame {
  position: relative;
  overflow: hidden;
  /* never taller than the full-width artwork */
  height: min(var(--mm-height), calc(100cqw * var(--mm-ratio)));
}
.mm-hero .mm-hero__stage {
  /* artwork scales down to fit the height (no cropping), centred horizontally */
  position: absolute;
  top: 0;
  left: 50%;
  width: min(100cqw, calc(var(--mm-height) / var(--mm-ratio)));
  aspect-ratio: 2200 / 1025;
  transform: translateX(-50%);
  container-type: inline-size;       /* 1cqw = 1% of artwork width (ball size) */
}
/* safety net: older markup without frame/stage (e.g. cached HTML) – show artwork in full proportions */
.mm-hero:not(:has(.mm-hero__frame)) {
  aspect-ratio: 2200 / 1025;
  overflow: hidden;
}
.mm-hero .mm-hero__bg,
.mm-hero .mm-hero__bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  max-width: none;
  object-fit: cover;
  box-shadow: none;
  border-radius: 0;
}
.mm-hero .mm-hero__balls {
  position: absolute;
  inset: 0;
  margin: 0;
}
.mm-hero .mm-hero__ball {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: 0;
  height: 0;
  will-change: transform;
}
.mm-hero .mm-hero__ball svg {
  position: absolute;
  left: 0;
  top: 0;
  /* SVG circle (outer edge incl. stroke) fills 96.73% of the viewBox width */
  width: calc(var(--d) * 1vw / .9673);   /* fallback for browsers without container units */
  width: calc(var(--d) * 1cqw / .9673);
  max-width: none;
  height: auto;
  aspect-ratio: 539.01 / 532.65;
  transform: translate(-50%, -50%);
  overflow: visible;
}

@media (max-width: 767px) {
  .mm-hero,
  .mm-hero.mm-hero--full {
    --d: 8.6;
    --mm-ratio: calc(1025 / 500);
    max-width: none;
  }
  .mm-hero.mm-hero--full { margin-left: calc(50% - var(--mm-vw) / 2); }
  .mm-hero .mm-hero__stage { aspect-ratio: 500 / 920; }
  .mm-hero:not(:has(.mm-hero__frame)) { aspect-ratio: 500 / 920; }
  .mm-hero .mm-hero__ball {
    left: calc(var(--mx) * 1%);
    top: calc(var(--my) * 1%);
  }
}

.mm-hero .mm-hero__sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
