/* ---- GROW: a photo that grows to fill the screen as you scroll (Eric 11-22: "one image trick that would work well
   sometimes is the one where a scroll expands the image to full screen"). See tools/property-page/parts/grow/README.md.
   <div class="grow" style="--gw:2048;--gh:1071">
     <figure class="grow__pin">
       <a class="grow__frame" href="..." data-lb="2"><img ...></a>
       <figcaption class="grow__cap">...</figcaption>
     </figure>
   </div>
   --gw / --gh = the pixel size of the largest image FILE. The frame never gets bigger than that, so the photo is
   never upscaled: on a screen larger than the photo it stops as a large plate with the page colour around it.
   With no JS, or under reduced motion, it is a plain full-width photo with its caption. ---- */
.grow{position:relative;--p:1}
.grow__pin{display:grid;justify-items:center;margin:0}
.grow__frame{display:block;overflow:hidden;width:min(100vw,calc(var(--gw)*1px));aspect-ratio:var(--gw)/var(--gh);max-height:min(100svh,calc(var(--gh)*1px));cursor:zoom-in}
.grow__frame img{display:block;width:100%;height:100%;object-fit:cover;object-position:var(--gpos,50% 50%)}
.grow__cap{margin-top:12px;padding:0 20px;text-align:center;text-wrap:balance}

/* wide screens, JS on, motion allowed: the photo is pinned and grows from a framed plate to the full screen */
@media (min-width:900px){
  /* the negative top margin lifts the small plate up under whatever comes before it (--grow-top = the gap left) */
  .grow.is-live{height:calc(100svh + var(--grow-run,105vh));margin-top:calc(-1*(100svh - min(100svh,calc(var(--gh)*1px))*var(--g0,.56))/2 + var(--grow-top,72px))}
  .grow.is-live .grow__pin{position:sticky;top:0;height:100svh;align-content:center;overflow:hidden}
  .grow.is-live .grow__frame{aspect-ratio:auto;max-height:none;height:min(100svh,calc(var(--gh)*1px));
    transform:scale(calc(var(--g0,.56) + (1 - var(--g0,.56))*var(--p)));border-radius:calc((1 - var(--p))*var(--grow-r,0px));will-change:transform}
  .grow.is-live .grow__cap{position:absolute;left:0;right:0;top:calc(50% + min(100svh,calc(var(--gh)*1px))*var(--g0,.56)/2 + var(--grow-cap-gap,24px));margin:0;opacity:calc(1 - var(--p)*3.2);pointer-events:none}
}
/* phones and small tablets: no pin (a pinned screen feels stuck under a thumb). The photo widens from an inset
   card to edge to edge as it comes into view, at a taller crop so it has some height. */
@media (max-width:899px){
  .grow__frame{aspect-ratio:var(--gm,4/3);max-height:none}
  .grow.is-live .grow__frame{transform:scale(calc(.86 + .14*var(--p)));border-radius:calc((1 - var(--p))*var(--grow-r,0px));will-change:transform}
}
