/* Marry Me — the shared product-photo fit (see js/product-fit.js for the rules and inputs).
   A frame with class "mm-fit" carries its rule as variables (--fm margin, --ftop extra room above,
   --fz zoom limit); a photo with measured jewellery bounds (--fa aspect, --fl/--ft/--fw/--fh the
   jewellery's box in fractions of the photo) is placed so THE JEWELLERY — not the empty canvas —
   fits the safe area, centred, never cropped, never enlarged beyond --fz times a plain whole-photo
   fit (so sibling cards keep a consistent scale). Container units make it exact for any frame size. */
.mm-fit { container-type: size; position: relative; overflow: hidden; }
.mm-fit > img { position: absolute; display: block; max-width: none; max-height: none; margin: 0; }
/* no measurements (yet): the whole photo, contained inside the safe margin */
.mm-fit > img:not([data-fit-measured]) {
  left: calc(var(--fm, .07) * 100%); top: calc(var(--fm, .07) * 100%);
  width: calc(100% - var(--fm, .07) * 200%); height: calc(100% - var(--fm, .07) * 200%);
  object-fit: contain;
}
.mm-fit > img[data-fit-measured] {
  --aw: calc(100cqw * (1 - 2 * var(--fm, .07)));
  --ah: calc(100cqh * (1 - 2 * var(--fm, .07) - var(--ftop, 0)));
  --iw: min(calc(var(--aw) / var(--fw)), calc(var(--ah) * var(--fa) / var(--fh)), calc(min(100cqw, 100cqh * var(--fa)) * var(--fz, 1.2)));
  width: var(--iw);
  height: calc(var(--iw) / var(--fa));
  left: calc(50cqw - var(--iw) * (var(--fl) + var(--fw) / 2));
  top: calc(50cqh + 50cqh * var(--ftop, 0) - var(--iw) / var(--fa) * (var(--ft) + var(--fh) / 2));
  object-fit: fill;
}
/* plain-white studio shots sit IN the paper instead of showing a white rectangle */
.mm-fit.is-onwhite > img:not([data-cut]), .mm-fit.is-onwhite > img[data-cut][src*="orig=1"], img.mm-fit-onwhite:not([data-cut]), img.mm-fit-onwhite[data-cut][src*="orig=1"] { mix-blend-mode: multiply; }
/* (a [data-cut] photo is the transparent catalogue copy: true colours, no blend needed) */
