/*!
 * Soclik Motion Pack v1.0.0
 * 12 motion primitives for client sites and dashboards. No dependencies.
 * Usage: add data-sm="<effect>" to an element and load this file + soclik-motion.js.
 * Theming: override the --sm-* variables. Open Props easings are picked up when present.
 */
:root {
  --sm-accent: #2F5BEA;
  --sm-accent-ink: #FFFFFF;
  --sm-surface: #FFFFFF;
  --sm-ink: #15171D;
  --sm-muted: #5E6472;
  --sm-line: #DADDE4;
  --sm-success: #0E8A5F;
  --sm-success-ink: #FFFFFF;
  --sm-confetti-1: #FFC53D;
  --sm-confetti-2: #FF5C8A;
  --sm-ease-out: var(--ease-out-3, cubic-bezier(.22, .61, .36, 1));
  --sm-ease-in-out: var(--ease-in-out-3, cubic-bezier(.65, 0, .35, 1));
  --sm-ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --sm-stagger: 70ms;
}

/* ---------- shared ---------- */
.sm-noanim, .sm-noanim * { transition: none !important; animation: none !important; }
.sm-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* bars that grow when their [data-sm] container plays */
.sm-grow { transform-origin: 50% 100%; transition: transform .9s var(--sm-ease-out); transition-delay: calc(250ms + var(--g, 0) * 70ms); }
.sm-armed:not(.sm-in) .sm-grow { transform: scaleY(0); }

/* ---------- 01 reveal: words arrive one by one ---------- */
[data-sm="reveal"] .sm-w {
  display: inline-block;
  transition: opacity .7s var(--sm-ease-out), transform .8s var(--sm-ease-out), filter .7s var(--sm-ease-out);
  transition-delay: calc(var(--i, 0) * var(--sm-stagger));
}
.sm-armed[data-sm="reveal"]:not(.sm-in) .sm-w { opacity: 0; transform: translateY(.45em); filter: blur(10px); }

/* ---------- 02 rotate: one word cycles through options ---------- */
[data-sm="rotate"] {
  display: inline-grid;
  box-sizing: content-box;
  clip-path: inset(0);
  transition: width .55s var(--sm-ease-in-out);
}
[data-sm="rotate"] > .sm-rot-w {
  grid-area: 1 / 1;
  justify-self: start;
  white-space: nowrap;
  transform: translateY(100%);
  opacity: 0;
  transition: transform .6s var(--sm-ease-out), opacity .45s var(--sm-ease-out);
}
[data-sm="rotate"] > .sm-rot-w.is-on { transform: none; opacity: 1; }
[data-sm="rotate"] > .sm-rot-w.is-off { transform: translateY(-100%); opacity: 0; }

/* ---------- 03 pings: live event toasts ---------- */
[data-sm="pings"] { display: flex; flex-direction: column; gap: 8px; }
.sm-ping {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--sm-surface);
  color: var(--sm-ink);
  border: 1px solid var(--sm-line);
  box-shadow: 0 8px 24px -16px rgb(0 0 0 / .45);
  transition: transform .55s var(--sm-ease-spring), opacity .4s var(--sm-ease-out);
}
.sm-ping.is-enter { transform: translateY(-16px) scale(.94); opacity: 0; }
.sm-ping.is-exit { transform: translateY(8px) scale(.96); opacity: 0; }
.sm-ping-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: color-mix(in srgb, var(--sm-accent) 14%, transparent); color: var(--sm-accent); }
.sm-ping-icon svg { width: 16px; height: 16px; }
.sm-ping-text { display: grid; min-width: 0; }
.sm-ping-title { font-weight: 600; font-size: .875em; line-height: 1.3; }
.sm-ping-meta { font-size: .75em; line-height: 1.4; color: var(--sm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-ping-value { font-weight: 700; font-size: .8125em; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 04 shuffle: stacked cards deal themselves ---------- */
[data-sm="shuffle"] { display: grid; justify-items: center; }
[data-sm="shuffle"] > * {
  grid-area: 1 / 1;
  transform: translateY(calc(var(--pos, 0) * -12px)) scale(calc(1 - var(--pos, 0) * .05));
  opacity: clamp(0, 3 - var(--pos, 0), 1);
  filter: brightness(calc(1 - var(--pos, 0) * .1));
  z-index: calc(20 - var(--pos, 0));
  transition: transform .65s var(--sm-ease-out), opacity .5s var(--sm-ease-out), filter .5s var(--sm-ease-out);
}
[data-sm="shuffle"] > .sm-out { transform: translate(115%, 6%) rotate(10deg); opacity: 0; transition-duration: .42s; }

/* ---------- 05 count + ring ---------- */
[data-sm="count"] { font-variant-numeric: tabular-nums; }
[data-sm="ring"] { position: relative; display: inline-grid; place-items: center; aspect-ratio: 1; max-width: 100%; }
[data-sm="ring"] svg { grid-area: 1 / 1; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.sm-ring-track, .sm-ring-bar { fill: none; stroke-width: 9; }
.sm-ring-track { stroke: var(--sm-line); }
.sm-ring-bar { stroke: var(--sm-accent); stroke-linecap: round; }
.sm-ring-label { grid-area: 1 / 1; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- 06 bento: tiles snap into place ---------- */
[data-sm="bento"] > * {
  transition: opacity .5s var(--sm-ease-out), transform .75s var(--sm-ease-spring);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.sm-armed[data-sm="bento"]:not(.sm-in) > * { opacity: 0; transform: translateY(22px) scale(.92); }

/* ---------- 07 tour: fake cursor demos the product ---------- */
[data-sm="tour"] { position: relative; overflow: hidden; }
.sm-cursor { position: absolute; left: 0; top: 0; z-index: 20; width: 22px; height: 22px; pointer-events: none; transition: transform .85s var(--sm-ease-in-out); }
.sm-cursor svg { display: block; width: 100%; height: 100%; transform-origin: 4px 3px; transition: transform .14s ease; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .35)); }
.sm-cursor.is-down svg { transform: scale(.82); }
.sm-ripple { position: absolute; z-index: 19; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: color-mix(in srgb, var(--sm-accent) 40%, transparent); pointer-events: none; animation: sm-ripple .6s var(--sm-ease-out) forwards; }
.sm-pressed { transform: scale(.95); transition: transform .12s ease; }
.sm-typing::after { content: ""; display: inline-block; width: 1.5px; height: 1.05em; margin-left: 1px; vertical-align: -.18em; background: currentColor; animation: sm-blink 1s steps(1) infinite; }
@keyframes sm-ripple { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
@keyframes sm-blink { 50% { opacity: 0; } }

/* ---------- 08 draw: a line runs through the steps ---------- */
[data-sm="draw"] { position: relative; display: grid; grid-template-columns: repeat(var(--sm-n, 3), minmax(0, 1fr)); gap: 14px; padding-top: 84px; }
[data-sm="draw"].sm-vertical { grid-template-columns: minmax(0, 1fr); padding-top: 0; padding-left: 52px; }
.sm-track { position: absolute; top: 0; left: 0; right: 0; height: 84px; pointer-events: none; }
.sm-vertical > .sm-track { right: auto; bottom: 0; width: 52px; height: auto; }
.sm-track svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sm-track-bg, .sm-track-line { fill: none; stroke-linecap: round; }
.sm-track-bg { stroke: var(--sm-line); stroke-width: 2; stroke-dasharray: 3 6; }
.sm-track-line { stroke: var(--sm-accent); stroke-width: 3; transition: stroke-dashoffset var(--sm-draw-dur, 2.4s) linear; }
.sm-node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: var(--sm-surface);
  border: 2px solid var(--sm-line);
  color: var(--sm-muted);
  font-size: 12px;
  font-weight: 700;
  transition: background-color .3s, border-color .3s, color .3s;
  transition-delay: var(--d, 0ms);
}
.sm-node > * { grid-area: 1 / 1; transition: opacity .25s, transform .4s var(--sm-ease-spring); transition-delay: var(--d, 0ms); }
.sm-node svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.4); }
[data-sm="draw"].sm-in .sm-node { background: var(--sm-accent); border-color: var(--sm-accent); color: var(--sm-accent-ink); }
[data-sm="draw"].sm-in .sm-node b { opacity: 0; transform: scale(.4); }
[data-sm="draw"].sm-in .sm-node svg { opacity: 1; transform: none; }

/* ---------- 09 compare: drag to see before / after ---------- */
[data-sm="compare"] { --sm-pos: 50%; position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; }
[data-sm="compare"] > .sm-before { position: absolute; inset: 0; z-index: 1; clip-path: inset(0 calc(100% - var(--sm-pos)) 0 0); }
.sm-handle { position: absolute; top: 0; bottom: 0; left: var(--sm-pos); z-index: 3; width: 2px; margin-left: -1px; background: var(--sm-surface); box-shadow: 0 0 0 1px rgb(0 0 0 / .12); pointer-events: none; }
.sm-knob { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 36px; height: 36px; translate: -50% -50%; border-radius: 50%; background: var(--sm-surface); color: var(--sm-ink); box-shadow: 0 4px 14px rgb(0 0 0 / .25); transition: scale .2s var(--sm-ease-spring); }
.sm-knob svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sm-range { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.sm-range:focus-visible ~ .sm-handle .sm-knob { outline: 2px solid var(--sm-accent); outline-offset: 3px; }
[data-sm="compare"]:active .sm-knob { scale: 1.1; }

/* ---------- 10 price: odometer digits + period toggle ---------- */
.sm-price { display: inline-flex; line-height: 1; font-variant-numeric: tabular-nums; }
.sm-digit { display: inline-block; height: 1em; overflow: hidden; line-height: 1; }
.sm-reel { display: flex; flex-direction: column; transform: translateY(calc(var(--v, 0) * -1em)); transition: transform .9s var(--sm-ease-out); transition-delay: calc(var(--k, 0) * 60ms); }
.sm-reel > span { display: block; height: 1em; line-height: 1; }
.sm-sep { line-height: 1; }
.sm-toggle { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--sm-ink) 8%, transparent); }
.sm-toggle::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--sm-surface); box-shadow: 0 1px 4px rgb(0 0 0 / .18); transition: transform .45s var(--sm-ease-spring); }
.sm-toggle[data-sm-index="1"]::before { transform: translateX(100%); }
.sm-toggle > button { position: relative; z-index: 1; padding: 7px 14px; border: 0; border-radius: 999px; background: none; color: var(--sm-muted); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sm-toggle > button[aria-pressed="true"] { color: var(--sm-ink); }
.sm-toggle > button:focus-visible { outline: 2px solid var(--sm-accent); outline-offset: 2px; }

/* ---------- 11 versus: checks for you, crosses for them ---------- */
[data-sm="versus"] tbody tr { transition: opacity .5s var(--sm-ease-out), transform .6s var(--sm-ease-out); transition-delay: calc(var(--i, 0) * 130ms); }
.sm-armed[data-sm="versus"]:not(.sm-in) tbody tr { opacity: 0; transform: translateX(-12px); }
.sm-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; vertical-align: middle; }
.sm-mark svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sm-mark path { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset .45s var(--sm-ease-out); transition-delay: calc(var(--i, 0) * 130ms + 280ms); }
.sm-armed[data-sm="versus"]:not(.sm-in) .sm-mark path { stroke-dashoffset: 1; }
.sm-mark-yes { background: var(--sm-accent); color: var(--sm-accent-ink); transition: transform .5s var(--sm-ease-spring); transition-delay: calc(var(--i, 0) * 130ms + 160ms); }
.sm-armed[data-sm="versus"]:not(.sm-in) .sm-mark-yes { transform: scale(0); }
.sm-mark-no { color: var(--sm-muted); }

/* ---------- 12 success: loading, check, confetti ---------- */
[data-sm="success"] {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  transition: width .45s var(--sm-ease-in-out), background-color .3s, color .3s;
}
[data-sm="success"] > span { grid-area: 1 / 1; transition: opacity .25s, transform .35s var(--sm-ease-out); }
.sm-btn-spin, .sm-btn-done { opacity: 0; }
.sm-btn-spin { width: 1.1em; height: 1.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; transform: scale(.6); animation: sm-spin .7s linear infinite; }
.sm-btn-done { display: inline-flex; align-items: center; gap: .5em; transform: translateY(60%); }
.sm-btn-done svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.sm-btn-done path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .4s .2s var(--sm-ease-out); }
.sm-loading > .sm-btn-label, .sm-done > .sm-btn-label { opacity: 0; transform: scale(.85); }
.sm-loading > .sm-btn-spin { opacity: 1; transform: none; }
[data-sm="success"].sm-done { background-color: var(--sm-success); color: var(--sm-success-ink); }
.sm-done > .sm-btn-done { opacity: 1; transform: none; }
.sm-done > .sm-btn-done path { stroke-dashoffset: 0; }
.sm-error { animation: sm-shake .45s; }
.sm-confetti-bit { position: fixed; z-index: 9999; width: 8px; height: 12px; margin: -6px 0 0 -4px; border-radius: 2px; pointer-events: none; }
@keyframes sm-spin { to { rotate: 360deg; } }
@keyframes sm-shake { 20%, 60% { translate: -6px 0; } 40%, 80% { translate: 6px 0; } }

/* ---------- reduced motion: everything lands in its final state ---------- */
@media (prefers-reduced-motion: reduce) {
  [data-sm], [data-sm] *, .sm-ping {
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
