/* Photoalbumz — motion layer (preview: sh motion.sh → http://localhost:9906).
 * Animations, hover and movement on top of every look; it never changes a look's colours.
 * Everything is scoped to html.motion, which the server sets before the first paint and never for
 * visitors who ask their device to reduce motion. motion.js adds the scroll and pointer parts. */

:root {
  --m-out: cubic-bezier(.16, 1, .3, 1);      /* arrive: fast, then a long soft landing */
  --m-spring: cubic-bezier(.34, 1.56, .64, 1); /* a small overshoot, like a spring */
  --m-in: cubic-bezier(.4, 0, 1, 1);         /* leave: speed up and go */
}

/* ---------- hero entrance (on load) ---------- */
html.motion .hero-show .showcase { animation: m-book-in 1.3s var(--m-out) backwards; }
html.motion .hero-show .hero-copy > :not(h1) { animation: m-rise .9s var(--m-out) backwards; }
html.motion .hero-show .hero-copy > .cta { animation-delay: .35s; }
html.motion .hero-show .hero-copy > .eyebrow { animation-delay: .45s; }
html.motion .hero-show .hero-copy > .lead { animation-delay: .8s; }
html.motion .hero-show .hero-copy > .resume { animation-delay: .9s; }
html.motion .hero-show .hero-copy > .ticks { animation-delay: 1s; }
html.motion .hero-show h1:not(.m-split) { animation: m-rise .9s .55s var(--m-out) backwards; } /* until motion.js splits it */
html.motion .hero-show h1.m-split .m-w { animation: m-word 1s var(--m-out) backwards; animation-delay: calc(.55s + var(--w) * 70ms); }
@keyframes m-book-in { from { opacity: 0; translate: 0 48px; scale: .93; } }
@keyframes m-rise { from { opacity: 0; translate: 0 26px; } }
@keyframes m-word { from { opacity: 0; translate: 0 .55em; filter: blur(10px); } }
/* the book eases back a little as you scroll past it */
html.motion .hero-show .showcase.m-so { scale: calc(1 - var(--so, 0) * .06); opacity: calc(1 - var(--so, 0) * .45); }

/* words of big headings (motion.js wraps each word) */
html.motion .m-w { display: inline-block; }
html.motion .section-head h2.m-split .m-w { opacity: 0; translate: 0 .5em; filter: blur(8px);
  transition: opacity .7s var(--m-out), translate .9s var(--m-out), filter .7s var(--m-out); transition-delay: calc(var(--w) * 55ms); }
html.motion .section-head h2.m-split.m-in .m-w { opacity: 1; translate: none; filter: none; }

/* ---------- buttons: springy lift, press, magnetic pull ---------- */
html.motion .btn { transition: transform .45s var(--m-spring), translate .55s var(--m-out), scale .25s var(--m-spring),
  background .2s, background-color .2s, box-shadow .25s, color .2s, border-color .2s; }
html.motion .btn:hover { transform: translateY(-2px); }
html.motion .btn:active { scale: .96; transition-duration: .45s, .55s, .08s, .2s, .2s, .25s, .2s, .2s; }
html.motion .m-mag { translate: var(--tx, 0px) var(--ty, 0px); }
html.motion .skin-btn, html.motion .sc-arrow, html.motion .sc-sound { transition: transform .4s var(--m-spring), background .2s, color .2s, box-shadow .2s, border-color .2s; }
html.motion .skin-btn:active, html.motion .sc-sound:active { scale: .94; }

/* nav links: an underline that draws in from the left */
html.motion .links a { position: relative; transition: color .2s; }
html.motion .links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -5px; height: 2px; border-radius: 2px; background: var(--accent);
  scale: 0 1; transform-origin: 100% 50%; transition: scale .45s var(--m-out); }
html.motion .links a:hover::after, html.motion .links a:focus-visible::after { scale: 1 1; transform-origin: 0 50%; }

/* the header slides away while you scroll down and comes back as soon as you scroll up */
html.motion .nav { transition: translate .5s var(--m-out), box-shadow .3s; }
html.motion .nav.m-hide { translate: 0 -100%; transition-timing-function: var(--m-in); transition-duration: .3s; }

/* the look menu opens with a little spring */
html.motion .skin-menu:not([hidden]) { animation: m-menu .38s var(--m-spring); transform-origin: 90% 0; }
@keyframes m-menu { from { opacity: 0; scale: .92; translate: 0 -6px; } }
html.motion .skin-menu button { transition: background .15s, translate .3s var(--m-out); }
html.motion .skin-menu button:hover { translate: 3px 0; }

/* reading progress bar along the top */
.m-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; transform-origin: 0 50%;
  scale: var(--p, 0) 1; background: linear-gradient(90deg, var(--accent), var(--gold, var(--accent))); box-shadow: 0 0 12px var(--accent); }

/* ---------- cards: lift, 3D tilt towards the pointer and a soft spotlight that follows it ---------- */
html.motion :is(.occ, .price, .step, .size-group, .album, .sh-cat, .feat, details) {
  transition: transform .5s var(--m-out), translate .5s var(--m-out), box-shadow .35s, border-color .3s, background-color .3s, color .2s; }
html.motion.m-fine :is(.occ, .price, .step, .size-group, .album, .sh-cat) { position: relative;
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px)); }
html.motion.m-fine :is(.occ, .price, .step, .size-group, .album, .sh-cat):hover { --lift: -6px; }
html.motion.m-fine :is(.occ, .price, .step, .size-group, .album, .sh-cat)::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.3), transparent 45%); opacity: 0; transition: opacity .35s; }
html.motion.m-fine :is(.occ, .price, .step, .size-group, .album, .sh-cat):hover::after { opacity: 1; }
html.motion .step .num { transition: scale .5s var(--m-spring), rotate .5s var(--m-spring); }
html.motion .step:hover .num { scale: 1.15; rotate: -8deg; }
html.motion .occ .t { display: inline-block; transition: scale .5s var(--m-spring), rotate .5s var(--m-spring); transform-origin: 30% 70%; }
html.motion .occ:hover .t { scale: 1.25; rotate: -10deg; }
html.motion .feat:hover { translate: 4px 0; }
html.motion .feat h4::before { transition: rotate .6s var(--m-spring), scale .4s var(--m-spring); }
html.motion .feat:hover h4::before { rotate: 135deg; scale: 1.2; }
html.motion .offer-ribbon { animation: m-glow 2.8s ease-in-out infinite; }
@keyframes m-glow { 50% { box-shadow: 0 4px 22px rgba(224, 71, 58, .6); } }

/* ---------- album setup: chosen options pop, options lift on hover ---------- */
html.motion :is(.pill-row, .cover-row, .orient-row, .size-row, .mode-row) span { transition: all .15s, translate .35s var(--m-out); }
html.motion :is(.pill-row, .cover-row, .orient-row, .size-row, .mode-row) label:hover span { translate: 0 -2px; }
html.motion :is(.pill-row, .cover-row, .orient-row, .size-row, .mode-row) input:checked + span { animation: m-pop .45s var(--m-spring); }
@keyframes m-pop { from { scale: .9; } }
html.motion .sum-book { transition: all .6s var(--m-spring); }

/* ---------- questions open and close smoothly (Chrome/Edge; others open instantly) ---------- */
html.motion { interpolate-size: allow-keywords; }
html.motion details::details-content { height: 0; overflow: clip; transition: height .45s var(--m-out), content-visibility .45s allow-discrete; }
html.motion details[open]::details-content { height: auto; }
html.motion details:hover { translate: 0 -2px; }
html.motion summary { transition: color .2s; }

/* ---------- scroll reveals (motion.js adds .m-r below the fold, then .m-in as each one arrives) ---------- */
html.motion .m-r { opacity: 0; translate: 0 34px; transition: opacity .8s var(--m-out), translate 1s var(--m-out); transition-delay: calc(var(--i, 0) * 60ms); }
html.motion .m-r.m-in { opacity: 1; translate: none; }

/* ---------- page changes and look changes ---------- */
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
html:not(.m-look)::view-transition-old(root) { animation: m-vt-out .2s var(--m-in) both; }
html:not(.m-look)::view-transition-new(root) { animation: m-vt-in .55s var(--m-out) both; }
@keyframes m-vt-out { to { opacity: 0; } }
@keyframes m-vt-in { from { opacity: 0; translate: 0 18px; } }
/* switching the look spreads the new one out in a circle from the Look button */
html.m-look::view-transition-old(root) { animation: none; }
html.m-look::view-transition-new(root) { animation: m-look .85s var(--m-out) both; }
@keyframes m-look { from { clip-path: circle(0 at var(--vx, 90%) var(--vy, 30px)); } to { clip-path: circle(150vmax at var(--vx, 90%) var(--vy, 30px)); } }
