/* XSTRONG 3D motion + custom cursor (2026-11-20). Script: assets/xs-motion3d.js.
   Everything is inside @layer xs-m3. Each page lists it FIRST in its layer order line
   (<style>@layer xs-m3,xs-apple;</style> at the top of <head>) so these !important rules beat the older layers. */
@layer xs-m3 {

  /* ---------- cursor (2026-11-22): blue + black ring, electric waves on click ---------- */
  html.m3-cur,
  html.m3-cur *,
  html.m3-cur *::before,
  html.m3-cur *::after { cursor: none !important; }
  html.m3-cur :is(input:not([type=checkbox],[type=radio],[type=button],[type=submit],[type=reset],[type=range],[type=color],[type=file],[type=image]), textarea, select, [contenteditable="true"], [contenteditable=""], iframe, video) { cursor: auto !important; }

  #m3-ring {
    --rc: #0071e3;
    --rk: #0b0b0f;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 2147483647 !important;
    pointer-events: none !important;
    opacity: 0;
    transition: opacity .2s ease !important;
  }
  #m3-ring.is-shown { opacity: 1; }
  #m3-ring.is-shown.is-off { opacity: 0; }
  #m3-ring.is-dark { --rc: #2997ff; --rk: #ffffff; }
  #m3-ring > i {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    display: block !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    will-change: transform;
  }
  #m3-ring .m3-r-ring {
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 1.5px solid var(--rc);
    box-shadow: 0 0 0 1px var(--rk);
    background: transparent;
    transition: width .22s cubic-bezier(.2, .8, .2, 1), height .22s cubic-bezier(.2, .8, .2, 1), margin .22s cubic-bezier(.2, .8, .2, 1), background-color .2s ease, border-color .2s ease;
  }
  #m3-ring .m3-r-dot {
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    background: var(--rk);
    box-shadow: 0 0 0 1px var(--rc);
  }
  #m3-ring.is-link .m3-r-ring {
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    background: rgba(0, 113, 227, .1);
  }
  #m3-ring.is-dark.is-link .m3-r-ring { background: rgba(41, 151, 255, .16); }

  .m3-zap {
    --zc: #0071e3;
    --zk: #0b0b0f;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 160px !important;
    height: 160px !important;
    overflow: visible !important;
    pointer-events: none !important;
    z-index: 2147483646 !important;
    filter: drop-shadow(0 0 3px rgba(41, 151, 255, .9));
  }
  .m3-zap.is-dark { --zc: #2997ff; --zk: #ffffff; }
  .m3-zap .m3-zw {
    fill: none;
    stroke: var(--zc);
    stroke-width: 2;
    transform-box: view-box;
    transform-origin: 0 0;
    animation: m3-zw .6s cubic-bezier(.2, .7, .3, 1) both;
  }
  .m3-zap .m3-zw2 { stroke: var(--zk); stroke-width: 1.2; animation-delay: .09s; }
  @keyframes m3-zw {
    from { transform: scale(.3); opacity: 1; }
    to { transform: scale(3.8); opacity: 0; }
  }
  .m3-zap .m3-zb {
    fill: none;
    stroke: var(--zc);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: m3-zb .5s ease-out both;
  }
  .m3-zap .m3-zb2 { stroke: var(--zk); stroke-width: 1.3; animation-delay: .04s; }
  @keyframes m3-zb {
    0% { stroke-dashoffset: 1; opacity: 1; }
    45% { stroke-dashoffset: 0; opacity: 1; }
    100% { stroke-dashoffset: -1; opacity: 0; }
  }

  /* ---------- home: "new here" 4-step guide under the hero (2026-11-22) ---------- */
  #shop-by-category, #explore-bike, #benefits, #why-xstrong, #xs-collections, #newsletter, #xs-guide { scroll-margin-top: 84px; }
  .xs-guide {
    background: #f5f5f7 !important;
    padding: 46px 20px 50px !important;
    color: #1d1d1f;
  }
  .xs-guide-in { max-width: 1120px; margin: 0 auto; }
  .xs-guide-eyebrow {
    margin: 0 0 6px !important;
    text-align: center;
    font: 600 13px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", sans-serif;
    letter-spacing: .02em;
    color: #0071e3 !important;
  }
  .xs-guide-title {
    margin: 0 0 26px !important;
    text-align: center;
    font: 700 clamp(24px, 3.4vw, 36px)/1.12 -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, "Segoe UI", sans-serif;
    letter-spacing: -.02em;
    color: #1d1d1f !important;
  }
  .xs-guide-steps {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }
  .xs-guide-steps li { margin: 0 !important; padding: 0 !important; }
  .xs-guide-steps a {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
    box-sizing: border-box;
    padding: 20px 20px 18px;
    border-radius: 18px;
    background: #fff;
    border: 1.5px solid transparent;
    color: #1d1d1f !important;
    text-decoration: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
  }
  .xs-guide-steps a:hover, .xs-guide-steps a:focus-visible {
    border-color: #0071e3;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -14px rgba(0, 113, 227, .55);
  }
  .xs-guide-n {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #0071e3;
    box-shadow: 0 0 0 1.5px #0b0b0f;
    font: 700 14px/1 -apple-system, BlinkMacSystemFont, Inter, sans-serif;
    color: #0b0b0f;
    margin-bottom: 4px;
  }
  .xs-guide-steps b { font: 600 17px/1.25 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, sans-serif; letter-spacing: -.01em; }
  .xs-guide-steps small { font: 400 14px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, sans-serif; color: #6e6e73; }
  .xs-guide-go { margin-top: auto; padding-top: 6px; font: 600 14px/1 -apple-system, BlinkMacSystemFont, Inter, sans-serif; color: #0071e3; }
  @media (max-width: 900px) { .xs-guide-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 520px) {
    .xs-guide { padding: 34px 16px 38px !important; }
    .xs-guide-steps { grid-template-columns: 1fr; gap: 10px; }
    .xs-guide-steps a { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 12px; padding: 14px 16px; }
    .xs-guide-steps small { flex-basis: 100%; }
    .xs-guide-go { display: none; }
  }

  /* ---------- 3D tilt ---------- */
  html.m3-on .m3-rel { position: relative !important; }
  html.m3-on .m3-act {
    transform: perspective(1100px) translate3d(0, var(--m3-l, 0px), 0) rotateX(var(--m3-rx, 0deg)) rotateY(var(--m3-ry, 0deg)) !important;
    transition: box-shadow .45s ease, background-color .3s ease !important;
    will-change: transform;
    backface-visibility: hidden;
  }
  html.m3-on .m3-act.m3-sh {
    box-shadow:
      calc(var(--m3-ox, 0) * -16px) calc(22px + var(--m3-oy, 0) * -10px) 46px -18px rgba(0, 0, 0, .28),
      0 2px 6px -2px rgba(0, 0, 0, .06) !important;
  }
  /* the theme zooms the photo on hover; while a card tilts that zoom covered the product name, so it is held still */
  html.m3-on .product-card.m3-act .product-image,
  html.m3-on .x-pdp-product-card.m3-act img { transform: none !important; }
  html.m3-on .m3-act.m3-par img {
    translate: calc(var(--m3-ox, 0) * -4px) calc(var(--m3-oy, 0) * -4px) !important;
  }
  html.m3-on .m3-act.m3-par.m3-clip img {
    translate: calc(var(--m3-ox, 0) * -7px) calc(var(--m3-oy, 0) * -7px) !important;
    scale: calc(1 + var(--m3-z, 0)) !important;
  }
  html.m3-on .m3-glare {
    position: absolute !important;
    inset: 0 !important;
    z-index: 6 !important;
    display: block !important;
    border-radius: inherit !important;
    pointer-events: none !important;
    opacity: var(--m3-go, 0) !important;
    background: radial-gradient(circle at var(--m3-gx, 50%) var(--m3-gy, 50%), rgba(255, 255, 255, .62), rgba(255, 255, 255, .16) 32%, rgba(255, 255, 255, 0) 60%) !important;
    transition: none !important;
  }

  /* ---------- cards stand up as they scroll in ---------- */
  html.m3-on .m3-pre {
    opacity: 0 !important;
    transform: perspective(1000px) translate3d(0, 46px, -60px) rotateX(24deg) !important;
    transform-origin: 50% 100% !important;
  }
  html.m3-on .m3-rise {
    transition: opacity .6s cubic-bezier(.2, .7, .3, 1) var(--m3-d, 0ms), transform 1s cubic-bezier(.16, 1, .3, 1) var(--m3-d, 0ms) !important;
    transform-origin: 50% 100% !important;
  }
  /* a card hovered while it is still rising tilts at once */
  html.m3-on .m3-rise.m3-act { transition: box-shadow .45s ease !important; }

  @media print {
    html.m3-on .m3-pre { opacity: 1 !important; transform: none !important; }
    #m3-ring, .m3-zap, .m3-glare { display: none !important; }
  }
}
