/* mood-gallery — "Backstage": an asymmetric wall of candid photos, pinned up like prints.
   Each figure is laid out absolutely on a stage whose height follows its width, so the
   composition scales as one piece. Nesting, outside in:
     .fx-mood-gallery-item   static box; the core owns its transform (data-speed parallax)
     .fx-mood-gallery-hang   the "pin": resting rotation + scroll sway (set from JS as a custom property)
     .fx-mood-gallery-shape  the static mask: rounded rectangle, blob or torn print
     .fx-mood-gallery-wipe   slides in from one side …
     .fx-mood-gallery-pic    … while this slides the opposite way, so the photo stands still
   Everything hidden-until-revealed lives under html.js, so no-JS and reduced motion get the full wall. */

.fx-mood-gallery{position:relative;margin-top:clamp(70px,10vw,150px);overflow-x:clip}
/* the stage is its own blend group with its own paper: the difference line below then never depends on
   what an ancestor does (a transform or z-index higher up would otherwise leave it paper-on-paper) */
.fx-mood-gallery-stage{position:relative;aspect-ratio:100/78;margin-top:clamp(28px,4vw,60px);isolation:isolate;background:var(--paper)}

/* ---------- photos ---------- */
.fx-mood-gallery-item{position:absolute;margin:0}
.fx-mood-gallery-hang{position:relative;transform-origin:50% 0;transform:rotate(calc(var(--fx-mood-gallery-rot,0deg) + var(--fx-mood-gallery-sway,0deg)))}
.fx-mood-gallery-shape{position:relative;aspect-ratio:4/5;overflow:hidden;border-radius:var(--r-img)}
.fx-mood-gallery-wipe,.fx-mood-gallery-pic,.fx-mood-gallery-pic svg,.fx-mood-gallery-pic img{position:absolute;inset:0;width:100%;height:100%}
.fx-mood-gallery-wipe{overflow:hidden}
.fx-mood-gallery-pic img{object-fit:cover}

/* a: the anchor, big and almost straight */
.fx-mood-gallery-a{left:0;top:2%;width:36%;z-index:1;--fx-mood-gallery-rot:-.6deg;--fx-mood-gallery-wx:-101%;--fx-mood-gallery-wy:0%}
/* b: organic blob; the display line runs across its snow */
.fx-mood-gallery-b{left:40%;top:0;width:30%;z-index:2;--fx-mood-gallery-wx:0%;--fx-mood-gallery-wy:-101%;--fx-mood-gallery-d:.18s}
.fx-mood-gallery-b .fx-mood-gallery-hang{transform-origin:50% 50%}
.fx-mood-gallery-b .fx-mood-gallery-shape{aspect-ratio:5/6;border-radius:0;clip-path:url(#blobEd)}
/* c: a print with a white border, taped at the top, torn along the bottom */
.fx-mood-gallery-c{left:67%;top:45%;width:30%;z-index:3;--fx-mood-gallery-rot:2.6deg;--fx-mood-gallery-wx:101%;--fx-mood-gallery-wy:0%;--fx-mood-gallery-d:.1s}
.fx-mood-gallery-c .fx-mood-gallery-hang{filter:drop-shadow(0 22px 24px rgba(30,33,31,.2))}
.fx-mood-gallery-c .fx-mood-gallery-shape{aspect-ratio:100/138;border-radius:0;
  clip-path:polygon(0 0,100% 0,100% 97%,96% 98.6%,91% 96.9%,87% 98.3%,82% 97.1%,78% 99.2%,73% 97.4%,68% 98.8%,63% 96.8%,57% 98.5%,52% 97.2%,47% 99.4%,41% 97.6%,36% 98.9%,30% 97%,25% 98.6%,19% 97.3%,14% 99.2%,8% 97.5%,4% 98.8%,0 97.3%)}
.fx-mood-gallery-c .fx-mood-gallery-pic{background:var(--chalk)}
.fx-mood-gallery-frame{position:absolute;inset:4.5% 4.5% auto;aspect-ratio:4/5;overflow:hidden}
.fx-mood-gallery-tape{position:absolute;left:36%;top:-2.6%;width:28%;height:6%;background:rgba(226,216,190,.82);box-shadow:inset 0 0 0 1px rgba(30,33,31,.05);transform:rotate(-4deg)}
/* d: small, laid over the anchor's corner */
.fx-mood-gallery-d{left:26%;top:50%;width:19%;z-index:5;--fx-mood-gallery-rot:1.4deg;--fx-mood-gallery-wx:0%;--fx-mood-gallery-wy:101%}
/* e: a cloth swatch pinned over the print */
.fx-mood-gallery-e{left:59.5%;top:71%;width:13.5%;z-index:6;--fx-mood-gallery-rot:-5deg;--fx-mood-gallery-wx:101%;--fx-mood-gallery-wy:0%;--fx-mood-gallery-d:.12s}
.fx-mood-gallery-e .fx-mood-gallery-shape{aspect-ratio:1;border-radius:10px}

/* ---------- captions: timestamp on its own line, note under it ---------- */
.fx-mood-gallery-cap{display:block;overflow:hidden;width:max-content;max-width:min(26em,44vw);margin-top:clamp(8px,.9vw,14px);
  font-family:var(--tech);font-size:clamp(10px,.74vw,12px);line-height:1.5;letter-spacing:.14em;text-transform:uppercase;font-weight:500;color:#4a4d4a}
.fx-mood-gallery-cap>span{display:block}
.fx-mood-gallery-cap b{display:block;font-weight:600;color:var(--ink)}
.fx-mood-gallery-b .fx-mood-gallery-cap{position:absolute;left:104%;top:44%;margin:0}
.fx-mood-gallery-c .fx-mood-gallery-cap{position:absolute;left:7%;bottom:5.2%;margin:0;max-width:86%}
.fx-mood-gallery-d .fx-mood-gallery-cap{max-width:100%}
.fx-mood-gallery-e .fx-mood-gallery-cap{position:absolute;right:108%;top:14%;max-width:100%;margin:0;text-align:right}

.fx-mood-gallery-intro{position:absolute;left:74%;top:1%;width:26%;overflow:hidden;color:#4a4d4a}
.fx-mood-gallery-intro>span{display:block}
.fx-mood-gallery-intro b{display:block;margin-bottom:.9em;font-family:var(--tech);font-size:clamp(10px,.74vw,12px);letter-spacing:.14em;text-transform:uppercase;font-weight:500;color:var(--stone-ink)}

.fx-mood-gallery-note{position:absolute;left:0;top:76%;width:22%}
.fx-mood-gallery-note .fx-mood-gallery-cap{max-width:100%}
.fx-mood-gallery-note i{display:block;height:1px;background:var(--ink);transform-origin:0 50%}

/* ---------- the oversized line: solid ink with a paper knockout stroke (painted under the fill), so the letters stay
   whole where they cross the snow photo instead of dissolving into it ---------- */
.fx-mood-gallery-line{margin:0}
.fx-mood-gallery-row{position:absolute;z-index:4;display:block;white-space:nowrap;pointer-events:none;
  font-family:var(--display);font-stretch:125%;font-weight:720;letter-spacing:-.045em;line-height:.92;font-size:6.2vw;color:var(--ink);-webkit-text-stroke:.11em var(--paper);paint-order:stroke fill}
.fx-mood-gallery-row-1{left:37.5%;top:31%}
.fx-mood-gallery-row-2{left:51%;top:38.8%}
.fx-mood-gallery-word{display:inline-block;overflow:hidden;vertical-align:top;padding:0 .05em .2em 0;margin:0 -.05em -.2em 0}
.fx-mood-gallery-word>span{display:inline-block}

.fx-mood-gallery-star{position:absolute;z-index:7;pointer-events:none}
.fx-mood-gallery-star .sparkle{width:100%;height:100%}
.fx-mood-gallery-star-1{left:77%;top:39.2%;width:clamp(22px,3vw,46px);aspect-ratio:1}
.fx-mood-gallery-star-1 .sparkle{color:var(--verm)}
.fx-mood-gallery-star-2{left:37.6%;top:.5%;width:clamp(12px,1.3vw,20px);aspect-ratio:1}
.fx-mood-gallery-star-2 .sparkle{color:var(--stone);animation-delay:-1.9s}

/* =====================================================================
   MOTION (html.js only)
   ===================================================================== */
@keyframes fx-mood-gallery-settle{from{transform:rotate(calc(var(--fx-mood-gallery-rot,0deg) + var(--fx-mood-gallery-kick,5deg))) scale(.93)}}
@keyframes fx-mood-gallery-pop{from{opacity:0;transform:scale(0) rotate(-90deg)}}

/* mask wipe: the window slides in, the photo counter-slides, and the image eases out of a zoom */
html.js .fx-mood-gallery-wipe{transform:translate3d(var(--fx-mood-gallery-wx),var(--fx-mood-gallery-wy),0)}
html.js .fx-mood-gallery-pic{transform:translate3d(calc(var(--fx-mood-gallery-wx)*-1),calc(var(--fx-mood-gallery-wy)*-1),0)}
html.js .fx-mood-gallery-wipe,html.js .fx-mood-gallery-pic{transition:transform 1s cubic-bezier(.215,.61,.355,1) var(--fx-mood-gallery-d,0s)}
html.js .fx-mood-gallery-pic svg,html.js .fx-mood-gallery-pic img{transform:scale(1.28);transition:transform 1.8s var(--out) var(--fx-mood-gallery-d,0s)}
html.js .fx-mood-gallery-item.in .fx-mood-gallery-wipe,html.js .fx-mood-gallery-item.in .fx-mood-gallery-pic{transform:translate3d(0,0,0)}
html.js .fx-mood-gallery-item.in .fx-mood-gallery-pic svg,html.js .fx-mood-gallery-item.in .fx-mood-gallery-pic img{transform:scale(1)}
/* the print swings in a few degrees off and springs back to rest on its pin */
html.js .fx-mood-gallery-item.in .fx-mood-gallery-hang{animation:fx-mood-gallery-settle 1.25s var(--spring) var(--fx-mood-gallery-d,0s) backwards}
html.js .fx-mood-gallery-b,html.js .fx-mood-gallery-d{--fx-mood-gallery-kick:-5deg}

/* tape: slapped on once the print has landed */
html.js .fx-mood-gallery-tape{opacity:0;transform:rotate(-14deg) scale(1.7);transition:opacity .12s linear .85s,transform .45s var(--spring) .85s}
html.js .fx-mood-gallery-item.in .fx-mood-gallery-tape{opacity:1;transform:rotate(-4deg)}

/* captions type on: the same mask move, in steps */
html.js .fx-mood-gallery-cap{transform:translate3d(-101%,0,0)}
html.js .fx-mood-gallery-cap>span{transform:translate3d(101%,0,0)}
html.js .fx-mood-gallery-cap,html.js .fx-mood-gallery-cap>span{transition:transform .9s steps(28,end) calc(var(--fx-mood-gallery-d,0s) + .55s)}
html.js .in .fx-mood-gallery-cap,html.js .in .fx-mood-gallery-cap>span{transform:translate3d(0,0,0)}

/* intro block slides in from the right wall; the closing note draws its rule, then types */
html.js .fx-mood-gallery-intro>span{transform:translate3d(101%,0,0);transition:transform .85s cubic-bezier(.215,.61,.355,1) .3s}
html.js .fx-mood-gallery-intro.in>span{transform:none}
html.js .fx-mood-gallery-note i{transform:scaleX(0);transition:transform .7s var(--inout)}
html.js .fx-mood-gallery-note.in i{transform:none}

/* the line: each word drops through its mask and lands with a small bounce */
html.js .fx-mood-gallery-word>span{transform:translate3d(0,-112%,0);transition:transform .9s cubic-bezier(.3,1.32,.5,1) calc(var(--fx-mood-gallery-i,0)*110ms)}
html.js .fx-mood-gallery-row.in .fx-mood-gallery-word>span{transform:none}
html.js .fx-mood-gallery-row,html.js .fx-mood-gallery-star{will-change:transform}
/* the vermilion sparkle is the full stop: it pops after "laughs" lands */
html.js .fx-mood-gallery-row-2.in~.fx-mood-gallery-star-1 .sparkle{animation:fx-mood-gallery-pop .6s var(--spring) .75s backwards,twinkle 3.6s ease-in-out 1.35s infinite}
html.js .fx-mood-gallery-row-2:not(.in)~.fx-mood-gallery-star-1{visibility:hidden}

@media (hover:hover) and (pointer:fine){
  html.js .fx-mood-gallery-item.in:hover .fx-mood-gallery-pic img,html.js .fx-mood-gallery-item.in:hover .fx-mood-gallery-pic svg{transform:scale(1.06);transition:transform 1.1s var(--out)}
}

/* =====================================================================
   PHONE: one staggered column; the small prints slide over the big one as they scroll in
   ===================================================================== */
@media (max-width:820px){
  .fx-mood-gallery-stage{aspect-ratio:100/410}
  .fx-mood-gallery-intro{left:0;top:0;width:100%}
  .fx-mood-gallery-a{left:0;top:8.5%;width:72%}
  .fx-mood-gallery-b{left:44%;top:27%;width:56%}
  .fx-mood-gallery-cap{max-width:48vw}
  .fx-mood-gallery-b .fx-mood-gallery-cap{left:auto;right:0;top:auto;bottom:103%;max-width:46%;text-align:right}
  .fx-mood-gallery-row{font-size:14.4vw}
  .fx-mood-gallery-row-1{left:0;top:36%}
  .fx-mood-gallery-row-2{left:30%;top:43.1%}
  .fx-mood-gallery-row-1 .fx-mood-gallery-word{display:block}
  .fx-mood-gallery-star-1{left:89.5%;top:43.9%;width:22px}
  .fx-mood-gallery-star-2{left:76%;top:9%}
  .fx-mood-gallery-c{left:26%;top:50.5%;width:72%}
  /* d and e start clear of the print's caption; parallax still slides them over its torn edge on the way in */
  .fx-mood-gallery-d{left:0;top:78%;width:46%}
  .fx-mood-gallery-e{left:58%;top:80.6%;width:34%}
  .fx-mood-gallery-e .fx-mood-gallery-cap{right:0;top:100%;max-width:48vw;margin-top:10px}
  .fx-mood-gallery-note{left:0;top:96.8%;width:100%}
}
