/* Motion is enabled by the script only where the browser and shopper allow it. */
.shop-motion-on {
  --shop-motion-accent: var(--accent, #392822);
  --shop-motion-ease: cubic-bezier(.22, .75, .24, 1);
  --shop-motion-hover: 210ms;
}

.shop-motion-on.loungewrap,
.shop-motion-on.sc-loungewrap {
  --shop-motion-accent: #823d47;
  --shop-motion-ease: cubic-bezier(.22, .61, .3, 1);
  --shop-motion-hover: 310ms;
}

.shop-motion-on.recliner,
.shop-motion-on.sc-recliner {
  --shop-motion-accent: #667267;
  --shop-motion-ease: cubic-bezier(.16, .78, .24, 1);
  --shop-motion-hover: 260ms;
}

.shop-motion-on.couchtuck,
.shop-motion-on.sc-couchtuck {
  --shop-motion-accent: #b68e27;
  --shop-motion-ease: cubic-bezier(.19, .86, .28, 1);
  --shop-motion-hover: 180ms;
}

.shop-motion-on.sofaseam,
.shop-motion-on.sc-sofaseam {
  --shop-motion-accent: #6f6451;
  --shop-motion-ease: cubic-bezier(.21, .66, .28, 1);
  --shop-motion-hover: 290ms;
}

.shop-motion-on.couchpaws,
.shop-motion-on.sc-couchpaws {
  --shop-motion-accent: #762e29;
}

.shop-motion-progress {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
  display: none;
  transform-origin: left center;
  transform: scaleX(0);
  background: var(--shop-motion-accent);
  background: linear-gradient(90deg, var(--shop-motion-accent), color-mix(in srgb, var(--shop-motion-accent) 56%, #ffc977));
}

.shop-motion-illustration-host { position: relative; }

.shop-motion-illustration {
  position: absolute;
  z-index: 1;
  inset: .75rem .75rem auto auto;
  width: clamp(105px, 13vw, 182px);
  border: 1px solid #74543f33;
  border-radius: 38% 36% 40% 32% / 20% 25% 24% 22%;
  color: var(--shop-motion-accent, var(--accent, #762e29));
  background: #fff6e9f5;
  pointer-events: none;
}

.shop-motion-illustration svg {
  display: block;
  width: 100%;
  max-height: 94px;
  padding: .16rem .28rem;
  box-sizing: border-box;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shop-motion-footprint {
  fill: currentColor;
  stroke: none;
}

.couchpaws [data-shop-motif-scene="home"] {
  inset: .75rem auto auto .75rem;
  width: clamp(126px, 16vw, 204px);
  color: #762e29;
}

[data-shop-motif-scene="product"] { width: clamp(96px, 11vw, 144px); }

[data-shop-motif-scene="journal"] {
  inset: auto .7rem 1.25rem auto;
  width: clamp(111px, 12vw, 167px);
}

[data-shop-motif-scene="fit"] {
  inset: auto .7rem .7rem auto;
  width: clamp(91px, 10vw, 126px);
}

[data-shop-motif-scene="service"] {
  position: relative;
  inset: auto;
  justify-self: end;
  margin: .8rem 0 0 auto;
  width: clamp(121px, 13vw, 172px);
}

[data-shop-motif-scene="collection"] {
  inset: auto .65rem .65rem auto;
  width: clamp(96px, 11vw, 140px);
}

.paws-room-banner > .shop-motion-illustration {
  inset: auto .75rem .45rem auto;
  width: clamp(61px, 8vw, 116px);
  border: 0;
  background: transparent;
  color: #793327;
}

.shop-motion-measure { display: none; }

@media (max-width: 760px) {
  .pdp .productgallery.shop-motion-illustration-host { position: relative; }
  .shop-motion-illustration svg { max-height: 55px; }
  [data-shop-motif-scene="collection"] {
    position: relative;
    inset: auto;
    justify-self: end;
    margin: .55rem 0 0 auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .shop-motion-on .shop-motion-progress:not([hidden]) { display: block; }
  .shop-motion-on.sc-checkout .shop-motion-progress { height: 2px; }
  .shop-motion-on .shop-motion-illustration:not([data-shop-motion-played]) { opacity: 0; }

  .shop-motion-on [data-shop-motif-running] {
    animation: shop-motif-arrive 460ms var(--shop-motion-ease) backwards;
  }

  .shop-motion-on [data-shop-motif-running] svg path {
    animation: shop-motif-draw 1020ms ease-out var(--motif-delay, 120ms) backwards;
  }

  .shop-motion-on [data-shop-motif-running] svg .shop-motion-footprint {
    animation-name: shop-motif-step;
    animation-duration: 420ms;
  }

  .shop-motion-illustration path:nth-child(2) { --motif-delay: 310ms; }
  .shop-motion-illustration path:nth-child(3) { --motif-delay: 500ms; }
  .shop-motion-illustration path:nth-child(4) { --motif-delay: 690ms; }
  .shop-motion-on .editorial-fit-diagram[data-shop-motion-tracing] .shop-motion-measure { display: initial; }
  .shop-motion-on [data-shop-motion-tracing] .shop-motion-measure path {
    animation: shop-motif-measure 1850ms linear var(--trace-delay, 0s) both;
  }
  .shop-motion-measure path:nth-child(2) { --trace-delay: 280ms; }
  .shop-motion-measure path:nth-child(3) { --trace-delay: 560ms; }

  .shop-motion-on [data-shop-motion-crop] {
    overflow: hidden;
    overflow: clip;
  }

  /* Separate translation from the reveal easing so the image can drift under a stable frame. */
  .shop-motion-on [data-shop-motion-drift] {
    translate: 0 var(--shop-motion-shift, 0px);
    scale: var(--shop-motion-scale, 1);
  }

  .shop-motion-on :is(.cta, .paws-button, .paws-room-action, .catalogue-filter-submit, .sc-pay, .sc-checkout-link) {
    transition: translate var(--shop-motion-hover) var(--shop-motion-ease),
                scale var(--shop-motion-hover) var(--shop-motion-ease),
                box-shadow var(--shop-motion-hover) var(--shop-motion-ease);
  }

  .shop-motion-on :is(.cta, .paws-button, .paws-room-action, .catalogue-filter-submit, .sc-pay, .sc-checkout-link):active:not(:disabled) {
    translate: 0 1px;
    scale: .985;
  }

  .shop-motion-on :is(.paws-room-action, .paws-room-price) > [aria-hidden="true"] {
    transition: translate var(--shop-motion-hover) var(--shop-motion-ease);
  }

  .shop-motion-on .catalogue-filter-group,
  .shop-motion-on .catalogue-filter-box {
    transition: border-color var(--shop-motion-hover) var(--shop-motion-ease);
  }

  .shop-motion-on :is(.catalogue-filter-group, .catalogue-filter-box):focus-within {
    border-color: var(--shop-motion-accent);
  }

  .shop-motion-on :is(.thumbs a, .product-gallery-open, .product-gallery-steppers button) {
    transition: translate var(--shop-motion-hover) var(--shop-motion-ease),
                box-shadow var(--shop-motion-hover) var(--shop-motion-ease);
  }

  @media (hover: hover) and (pointer: fine) {
    .shop-motion-on :is(.cta, .paws-button, .paws-room-action, .catalogue-filter-submit, .sc-checkout-link):hover:not(:disabled) {
      translate: 0 -2px;
    }

    .shop-motion-on :is(.paws-room-action, .paws-room-price):hover > [aria-hidden="true"] {
      translate: 4px 0;
    }

    .shop-motion-on :is(.primarylinks, .paws-nav) > a,
    .shop-motion-on :is(.retailfoot, .paws-footer) nav a {
      text-decoration-color: transparent;
      text-decoration-line: underline;
      transition: text-decoration-color var(--shop-motion-hover) var(--shop-motion-ease);
    }

    .shop-motion-on :is(.primarylinks, .paws-nav) > a:is(:hover, :focus-visible),
    .shop-motion-on :is(.retailfoot, .paws-footer) nav a:is(:hover, :focus-visible) {
      text-decoration-color: currentColor;
    }

    .shop-motion-on :is(.cards, .paws-favourites, .journalissues, .journalgrid, .paws-reads) > article > a,
    .shop-motion-on :is(.categorytile, .paws-story-photo, .paws-directory-grid > a) {
      overflow: hidden;
      overflow: clip;
    }

    .shop-motion-on :is(.cards, .paws-favourites, .journalissues, .journalgrid, .paws-reads) > article > a > img,
    .shop-motion-on :is(.categorytile, .paws-story-photo, .paws-directory-grid > a) > img {
      transition: scale 440ms var(--shop-motion-ease);
    }

    .shop-motion-on :is(.cards, .paws-favourites, .journalissues, .journalgrid, .paws-reads) > article > a:hover > img,
    .shop-motion-on :is(.categorytile, .paws-story-photo, .paws-directory-grid > a):hover > img {
      scale: 1.035;
    }

    .shop-motion-on :is(.thumbs a, .product-gallery-open, .product-gallery-steppers button):hover {
      translate: 0 -2px;
    }
  }
}

@keyframes shop-motif-arrive {
  from { opacity: 0; translate: 0 8px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes shop-motif-draw {
  from { stroke-dasharray: 100 100; stroke-dashoffset: 100; }
  to { stroke-dasharray: 100 100; stroke-dashoffset: 0; }
}

@keyframes shop-motif-step {
  0% { opacity: 0; translate: -5px 8px; }
  72% { opacity: .82; translate: 0 -2px; }
  100% { opacity: 1; translate: 0 0; }
}

@keyframes shop-motif-measure {
  0% { stroke-dasharray: 26 100; stroke-dashoffset: 26; opacity: 0; }
  14%, 74% { opacity: 1; }
  100% { stroke-dasharray: 26 100; stroke-dashoffset: -100; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .shop-motion-on .shop-motion-progress { display: none; }
}
