/* Playful micro-interactions, shared by every public page (October 2026).
 * Small, quick and one-shot: nothing loops, nothing hides content, and everything is off for
 * visitors who ask their device for reduced motion. Loaded on the homepage directly and on the
 * catalogue, motif and Essence of Earth pages by their shared scripts.
 *
 * Smoothness rules:
 * - Lifts use the `translate` / `scale` properties, the same ones motion.css uses, so the two files
 *   never stack into a double jump, and every transition list names them so nothing snaps.
 * - Hover effects only apply to devices with a real pointer; on phones a tap no longer leaves a
 *   card stuck in its lifted state.
 * - One soft ease-out curve; overshoot is kept for tiny one-shot pops only. */

:root{--fun-ease:cubic-bezier(.22,1,.36,1);--fun-pop:cubic-bezier(.34,1.3,.64,1)}

@media (prefers-reduced-motion:no-preference){

/* ---------- Shared transitions (include translate/scale so nothing jumps) ---------- */
.button,.cq-wa,.cq-advanced,.cq-add-cart,.earth-mini-go,#whatsapp,#advanced,.wa-float,.bag-trigger,.menu-toggle,.earth-mini-shuffle{
 transition:translate .3s var(--fun-ease),scale .2s var(--fun-ease),box-shadow .3s ease,background-color .2s ease,border-color .2s ease,color .2s ease}
.collection-preview-card,.review-card,.store-grid>article,.ordering-info-grid>article,.motif-grid>figure,.original-card{
 transition:translate .4s var(--fun-ease),box-shadow .4s ease,border-color .3s ease,background-color .3s ease}
.collection-preview-card img,.motif-grid .flow-photo img,.hero-mosaic .hero-tile-photo img,.original-card .original-photo img{
 transition:scale .7s var(--fun-ease)}
/* The collection-card photo has no clipping wrapper: clip it to its own rounded frame so a zoom
   stays inside the card instead of spilling past the edges. */
.collection-preview-card .preview-photo{clip-path:inset(0 round var(--image-radius,14px));transition:scale .7s var(--fun-ease),clip-path .7s var(--fun-ease)}
.collection-preview-card .preview-card-footer>span:last-child{transition:transform .35s var(--fun-ease)}
.color-options button,.earth-mini-swatch,.earth-mini-part,.earth-mini-collection,.swatch,.part{
 transition:translate .25s var(--fun-ease),background-color .2s ease,border-color .2s ease,color .2s ease}

/* ---------- Press: a gentle squish, on every device ---------- */
.button:active,.cq-wa:active,.cq-add-cart:active,.earth-mini-go:active,#whatsapp:active,#advanced:active,
.bag-trigger:active,.menu-toggle:active,.earth-mini-shuffle:active{scale:.97}

/* ---------- Hover: only with a mouse or trackpad ---------- */
@media (hover:hover) and (pointer:fine){
 .button:hover,.cq-wa:hover,.cq-add-cart:hover,.earth-mini-go:hover,#whatsapp:hover,#advanced:hover{
  translate:0 -2px;box-shadow:0 10px 22px -16px rgba(37,61,91,.45)}
 /* Only cards with their own padded surface get a shadow. */
 .review-card:hover,.ordering-info-grid>article:hover{
  translate:0 -3px;box-shadow:0 18px 36px -28px rgba(37,61,91,.35)}
 /* Collection cards are transparent with no padding: a box shadow would outline empty space,
    so they just lift while the photo zooms inside its frame. */
 .collection-preview-card:hover{translate:0 -3px;box-shadow:none}
 /* Store cards are flat (top rule, no padding): lift and tint the rule instead of adding a box shadow. */
 .store-grid>article:hover{translate:0 -3px;box-shadow:none;border-top-color:#527bdd}
 .motif-grid>figure:hover{translate:0 -3px}
 .collection-preview-card:hover img,.motif-grid>figure:hover .flow-photo img,.hero-tile-link:hover .hero-tile-photo img,.original-card:hover .original-photo img{
  scale:1.03}
 /* As it grows, the clip shrinks by the same amount, so its edges and corners stay put. */
 .collection-preview-card:hover .preview-photo{clip-path:inset(1.46% round calc(var(--image-radius,14px) / 1.03))}
 .color-options button:hover,.earth-mini-part:hover,.swatch:hover,.part:not(:disabled):hover{translate:0 -2px}
 .wa-float:hover svg{animation:fun-wiggle .6s ease}
 .haven-mascot:hover,.ordering-info-grid>article:hover .haven-mascot{translate:0 -3px;rotate:-3deg}
}

/* ---------- Swatches and choice chips: a small pop when chosen ---------- */
.color-options button[aria-pressed="true"] .swatch-chip,.earth-mini-swatch[aria-pressed="true"] i,.swatch[aria-pressed="true"] i{
 animation:fun-pop .45s var(--fun-pop)}
.earth-mini-part[aria-pressed="true"] .earth-mini-icon{animation:fun-wiggle .55s ease}

/* ---------- Prices: a small bounce whenever the total changes (class set by fun.js) ---------- */
.fun-bump{display:inline-block;animation:fun-bump .5s var(--fun-ease)}

/* ---------- Trust strip: icons rise in once, one after another ---------- */
.trust-strip.fun-in .trust-item svg{animation:fun-hop .7s var(--fun-ease) backwards}
.trust-strip.fun-in .trust-item:nth-child(2) svg{animation-delay:.08s}
.trust-strip.fun-in .trust-item:nth-child(3) svg{animation-delay:.16s}
.trust-strip.fun-in .trust-item:nth-child(4) svg{animation-delay:.24s}

/* ---------- Floating WhatsApp: slides up after load ---------- */
.wa-float{animation:fun-rise .7s var(--fun-ease) 1.2s backwards}

/* ---------- Header: soft shadow once the page scrolls (class set by fun.js) ---------- */
.site-header{transition:box-shadow .35s ease}
.site-header.fun-scrolled{box-shadow:0 8px 24px -20px rgba(37,61,91,.4)}

/* ---------- Mascots ---------- */
.haven-mascot{transition:translate .4s var(--fun-ease),rotate .4s var(--fun-ease)}

/* ---------- Mini builder: dice-style shake when shuffling; soft fade when switching ---------- */
.earth-mini-shuffle.fun-shake{animation:fun-wiggle .55s ease}
.earth-mini-bed.fun-swap .bed{animation:fun-fade .4s ease}

/* ---------- Mobile menu: links slide in ---------- */
.site-header.nav-open nav a{animation:fun-slide .35s var(--fun-ease) backwards}
.site-header.nav-open nav a:nth-child(2){animation-delay:.04s}
.site-header.nav-open nav a:nth-child(3){animation-delay:.08s}
.site-header.nav-open nav a:nth-child(4){animation-delay:.12s}

}

@keyframes fun-pop{0%{transform:scale(.8)}60%{transform:scale(1.08)}100%{transform:scale(1)}}
@keyframes fun-bump{0%{transform:scale(1)}40%{transform:scale(1.05)}100%{transform:scale(1)}}
@keyframes fun-hop{0%{transform:translateY(8px);opacity:0}100%{transform:none;opacity:1}}
@keyframes fun-rise{0%{transform:translateY(40px);opacity:0}100%{transform:none;opacity:1}}
@keyframes fun-wiggle{0%,100%{transform:rotate(0)}30%{transform:rotate(-8deg)}60%{transform:rotate(6deg)}80%{transform:rotate(-2deg)}}
@keyframes fun-fade{0%{opacity:.6}100%{opacity:1}}
@keyframes fun-slide{0%{transform:translateX(-8px);opacity:0}100%{transform:none;opacity:1}}
