/* ═══ Christmas motion (the motion kit, 1 Dec 2026) ══════════════════════════════

   The kit's moves, timings and easing, wired to the site. Everything here is gated on
   body.xm-motion, which xm-motion.js adds only when motion is allowed: the Christmas
   theme is live, the visitor has not asked for reduced motion, and the page is not a
   health, checkout, payment, prescription, booking or account page. Without that class
   nothing moves and every element simply shows its end state (gift open, number in
   place, tag still), which is also what reduced motion shows.

   Transform and opacity only, so nothing on the page shifts. An animation runs when
   xm-motion.js adds "play" (once, when first in view or when the customer acts). The
   fairy lights are the one loop, paused off screen.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Reduced motion and no-JS: the end states */
.xm-gift .xm-lid { transform: translate(30px, -34px) rotate(22deg); }
.xm-motion .xm-gift:not(.played) .xm-lid { transform: none; }
.xm-bulb { opacity: 1; }

/* ── 1. Present opens: lid pops off, gold sparkles burst (900 ms) ────────── */
.xm-motion .xm-gift.play .xm-lid { animation: xm-lid .9s cubic-bezier(.34, 1.56, .64, 1) both; }
.xm-motion .xm-gift.play .xm-burst { animation: xm-burst .7s .3s ease-out both; }
@keyframes xm-lid { 0% { transform: none } 12% { transform: rotate(-4deg) } 24% { transform: rotate(3deg) } 36% { transform: none } 100% { transform: translate(30px, -34px) rotate(22deg) } }
@keyframes xm-burst { 0% { opacity: 0; transform: scale(.3) } 40% { opacity: 1 } 100% { opacity: 0; transform: scale(1.3) } }

/* ── 2. Bauble swing: four settling swings (1800 ms) ─────────────────────── */
.xm-motion .play .xm-swing { animation: xm-swing 1.8s ease-out both; }
.xm-motion .play .xm-swing:nth-child(2) { animation-delay: .15s; }
@keyframes xm-swing { 0% { transform: rotate(16deg) } 25% { transform: rotate(-11deg) } 50% { transform: rotate(6deg) } 75% { transform: rotate(-3deg) } 100% { transform: rotate(0) } }

/* ── 3. Bauble drops into the cart, the count pops (700 ms) ──────────────── */
.xm-drop { position: fixed; z-index: 3000; width: 18px; height: 22px; pointer-events: none; opacity: 0; animation: xm-drop .7s cubic-bezier(.3, 0, .3, 1) both; }
@keyframes xm-drop { 0% { opacity: 0; transform: translateY(-44px) scale(.9) } 20% { opacity: 1 } 55% { transform: translateY(0) scale(.9) } 70% { transform: translateY(-10px) scale(.9) } 85% { opacity: 1; transform: translateY(0) scale(.9) } 100% { opacity: 0; transform: translateY(6px) scale(.4) } }
/* XM-08: the Add button never moves; it changes into the stepper without a pop */
.pf-theme-christmas .cqs-pop, .pf-theme-christmas .cqs-bump { animation: none !important; }
.xm-motion .xm-pop { animation: xm-pop .35s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes xm-pop { 0% { transform: scale(1) } 50% { transform: scale(1.45) } 100% { transform: scale(1) } }

/* ── 4. Gift tag sparkle: a gold glint and three twinkles; sways on hover (1200 ms) ── */
.pf-theme-christmas.xm-motion .product-card .sale-badge--pf { overflow: hidden; }
.pf-theme-christmas.xm-motion .product-card .sale-badge--pf::after {
    content: "" !important; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; z-index: 1; pointer-events: none;
    background: linear-gradient(100deg, transparent, rgba(255, 212, 94, .85), transparent);
    transform: translateX(-160%) skewX(-20deg);
    -webkit-mask: none; mask: none; animation: none; rotate: none; scale: none;
}
.pf-theme-christmas.xm-motion .product-card .sale-badge--pf::before {
    content: "" !important; position: absolute; top: 12%; right: 4%; width: 9px; height: 9px; z-index: 2; pointer-events: none;
    background: #FFD45E; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    opacity: 0; left: auto; bottom: auto; background-image: none;
}
.pf-theme-christmas.xm-motion .product-card.play .sale-badge--pf::after { animation: xm-glint 1.2s ease-in-out both; }
.pf-theme-christmas.xm-motion .product-card.play .sale-badge--pf::before { animation: xm-tw .4s ease-in-out .2s 3 both; }
@keyframes xm-glint { from { transform: translateX(-160%) skewX(-20deg) } to { transform: translateX(330%) skewX(-20deg) } }
@keyframes xm-tw { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0) } 50% { opacity: 1; transform: scale(1) rotate(45deg) } }

/* ── 5. Fairy lights twinkle: the one loop (2400 ms), paused off screen ───── */
.xm-motion .xm-lights.is-on .xm-bulb { animation: xm-bulb 2.4s ease-in-out infinite alternate; }
.xm-motion .xm-lights .xm-bulb:nth-of-type(3n) { animation-delay: -.8s; }
.xm-motion .xm-lights .xm-bulb:nth-of-type(3n+1) { animation-delay: -1.6s; }
@keyframes xm-bulb { from { opacity: .55 } to { opacity: 1 } }

/* ── 14. Fairy lights on section headers (XM-25): set once, so nothing shifts ── */
.xm-hashead { position: relative; }
.xm-headlights { position: absolute; left: 0; right: 0; top: -9px; width: 100%; height: 18px; pointer-events: none; overflow: visible; z-index: 1; }
.xm-headlights path { stroke: #0B7A3E; stroke-opacity: .45; }
.xm-headlights .xm-bulb { opacity: .8; }
.xm-headlights--band path { stroke: #FFF1E6; stroke-opacity: .7; }
.xm-headlights--band .xm-bulb__core { fill: #FFF8EE; }
.xm-motion .xm-headlights.is-on .xm-bulb { animation: xm-bulb 2.4s ease-in-out infinite alternate; }
.xm-motion .xm-headlights.is-on .xm-bulb:nth-of-type(3n) { animation-delay: -.8s; }
.xm-motion .xm-headlights.is-on .xm-bulb:nth-of-type(3n+1) { animation-delay: -1.6s; }
.xm-headbauble { position: absolute; right: 12px; top: -6px; z-index: 2; line-height: 0; pointer-events: none; }
.xm-headbauble .xm-swing { transform-origin: 50% 0; }
.xm-motion .xm-headbauble.play .xm-swing { animation: xm-swing 1.8s ease-out both; }
@media (prefers-reduced-motion: reduce) { .xm-headlights .xm-bulb { animation: none !important; opacity: 1; } }

/* ── 6. Gold sparkles drift in: 1400 ms, 120 ms apart ────────────────────── */
.xm-motion .xm-sparkles:not(.played) .xm-dr, .xm-motion .xm-wall__head:not(.played) .xm-star { opacity: 0; }
.xm-motion .play .xm-dr { animation: xm-drift 1.4s cubic-bezier(.2, .7, .2, 1) both; }
.xm-motion .play .xm-dr:nth-child(2) { animation-delay: .12s; }
.xm-motion .play .xm-dr:nth-child(3) { animation-delay: .24s; }
.xm-motion .play .xm-dr:nth-child(4) { animation-delay: .36s; }
@keyframes xm-drift { 0% { opacity: 0; transform: translateY(24px) scale(.4) } 60% { opacity: 1; transform: translateY(-4px) scale(1.15) rotate(30deg) } 100% { opacity: 1; transform: none } }

/* ── 7. Tile unwraps: bow lifts, ribbon slides away, paper splits (1000 ms, 80 ms apart) ── */
.xm-unwrap { position: absolute; inset: 0; z-index: 5; overflow: hidden; border-radius: inherit; pointer-events: none; }
.xm-unwrap i { position: absolute; display: block; }
.xm-unwrap .xm-pl, .xm-unwrap .xm-pr { top: 0; bottom: 0; width: 50%; background: var(--xm-pink-deep, #D4106F); }
.xm-unwrap .xm-pl { left: 0; }
.xm-unwrap .xm-pr { right: 0; background: var(--xm-pink, #ED1D7F); }
.xm-unwrap .xm-rv { left: 44%; width: 12%; top: 0; bottom: 0; background: var(--xm-gold, #F0B83A); transform-origin: 50% 0; }
.xm-unwrap .xm-rh { top: 44%; height: 10%; left: 0; right: 0; background: var(--xm-gold, #F0B83A); transform-origin: 0 50%; }
.xm-unwrap .xm-bow { left: 50%; top: 40%; width: 34%; aspect-ratio: 1.6; margin-left: -17%; border-radius: 50% 50% 40% 40%; background: radial-gradient(circle at 50% 60%, #FFD45E 0 18%, var(--xm-gold, #F0B83A) 19%); }
.xm-motion .play .xm-bow { animation: xm-bow .4s cubic-bezier(.65, 0, .35, 1) both; }
.xm-motion .play .xm-rv { animation: xm-rv .35s .25s cubic-bezier(.65, 0, .35, 1) both; }
.xm-motion .play .xm-rh { animation: xm-rh .35s .25s cubic-bezier(.65, 0, .35, 1) both; }
.xm-motion .play .xm-pl { animation: xm-pl .45s .55s cubic-bezier(.65, 0, .35, 1) both; }
.xm-motion .play .xm-pr { animation: xm-pr .45s .55s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes xm-bow { to { transform: translateY(-30px) scale(1.2); opacity: 0 } }
@keyframes xm-rv { to { transform: scaleY(0) } }
@keyframes xm-rh { to { transform: scaleX(0) } }
@keyframes xm-pl { to { transform: translateX(-102%) } }
@keyframes xm-pr { to { transform: translateX(102%) } }

/* ── 8. Day counter flips (600 ms) and its gold ring shines (800 ms) ─────── */
.xm-motion .xm-day.play .xm-old { animation: xm-out .3s cubic-bezier(.4, 0, .2, 1) both; }
.xm-motion .xm-day.play .xm-new { animation: xm-in .3s .3s cubic-bezier(.4, 0, .2, 1) both; }
.xm-motion .xm-day.play .xm-shine { animation: xm-shine .8s .5s ease-in-out both; }
@keyframes xm-out { to { transform: rotateX(90deg); opacity: 0 } }
@keyframes xm-in { from { transform: rotateX(-90deg); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes xm-shine { from { transform: translateX(-120%) } to { transform: translateX(120%) } }

/* ── 9. Countdown digits flip: pf.setDigit (pf-motion.css), 400 ms ──────── */

/* ── 11. Free delivery gold burst: pf.confetti in the theme's golds (pf-motion.js) ── */

/* ── 12. Today's pick glow: the rings, then a fading pink halo (1200 ms) ─── */
.xm-motion .xm-tile.xm-pick.play { animation: xm-pick 1.2s ease-out both; }
.xm-motion .xm-pickcard.play { animation: xm-pickcard 1.2s ease-out both; }
@keyframes xm-pick { 0% { box-shadow: 0 0 0 3px #ED1D7F, 0 0 0 3px rgba(237, 29, 127, .5) } 100% { box-shadow: 0 0 0 3px #ED1D7F, 0 0 0 20px rgba(237, 29, 127, 0) } }
@keyframes xm-pickcard { 0% { box-shadow: 0 0 0 0 rgba(237, 29, 127, .5) } 100% { box-shadow: 0 0 0 18px rgba(237, 29, 127, 0) } }

/* Belt and braces: the device setting always wins */
@media (prefers-reduced-motion: reduce) {
    .xm-motion *, .xm-motion *::before, .xm-motion *::after { animation: none !important; transition: none !important; }
    .xm-unwrap, .xm-drop { display: none !important; }
}

/* ── More motion, asked for on 3 Dec ─────────────────────────────────────────── */
/* Santa hat wiggle (motion kit 10, 900 ms) */
.xm-motion .xm-twelve.play .xm-hat { animation: xm-hat .9s ease-in-out both; }
@keyframes xm-hat { 0% { transform: rotate(-16deg) } 20% { transform: rotate(-26deg) } 40% { transform: rotate(-8deg) } 60% { transform: rotate(-20deg) } 80% { transform: rotate(-13deg) } 100% { transform: rotate(-16deg) } }
/* 12 Days tiles: a little lift and a gold twinkle on hover */
.xm-motion .xm-tile--open, .xm-motion .xm-tile--peek { transition: translate .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s; }
@media (hover: hover) {
    .xm-motion .xm-tile--open:hover, .xm-motion .xm-tile--peek:hover { translate: 0 -4px; }
    .xm-motion .xm-tile--open::before { content: ""; position: absolute; right: 7px; top: 7px; z-index: 5; width: 12px; height: 12px; background: #FFD45E; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; scale: .3; pointer-events: none; }
    .xm-motion .xm-tile--open:hover::before { animation: xm-tw .5s ease-in-out 2 both; }
}
/* the day counter's ring shines again on hover */
.xm-motion .xm-day.xm-hovershine .xm-shine { animation: xm-shine .8s ease-in-out both; }
/* the burst of stars over the heading (1300 ms) */
.xm-motion .xm-headburst.play i { animation: xm-starburst 1.1s cubic-bezier(.2, .7, .2, 1) both; }
.xm-motion .xm-headburst.play i:nth-child(even) { animation-delay: .08s; }
@keyframes xm-starburst { 0% { opacity: 0; transform: rotate(var(--a)) translateX(0) scale(.3) } 25% { opacity: 1 } 100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(1) rotate(120deg) } }
/* falling snow: a slow fall with a sideways drift, the one loop besides the lights */
.xm-snow i { animation: xm-snow var(--dur, 12s) linear var(--delay, 0s) infinite; }
.xm-snow.is-paused i { animation-play-state: paused; }
@keyframes xm-snow { 0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0) } 8% { opacity: var(--o, .7) } 90% { opacity: var(--o, .7) } 100% { opacity: 0; transform: translate3d(var(--drift, 0), 104vh, 0) rotate(200deg) } }
@media (prefers-reduced-motion: reduce) { .xm-snow { display: none; } }
