/* story-motion kit (our rewrite of the techniques seen on wedtrack.app, 2026-11-21).
   Everything that hides or moves is scoped to html.js-motion. Without it the page is complete and still.
   Retheme with the tokens below. */
:root {
  --sm-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sm-ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --sm-spring: cubic-bezier(0.2, 0.9, 0.25, 1.04);
  --sm-pop-spring: cubic-bezier(0.3, 1.3, 0.5, 1);
  --sm-ink: #14131f;
  --sm-ink-subtle: #67657a; /* 4.5:1+ on light bg */
  --sm-surface: #ffffff;
  --sm-sunken: #f2f1ee;
  --sm-dark: #0f0e1a;
  --sm-accent: #c9a46a;
  --sm-accent-2: #b5653f;
  --sm-grad: linear-gradient(60deg, var(--sm-accent) 0%, var(--sm-accent-2) 100%);
  --sm-on-grad: #14131f;
}

/* ---------- keyframes (entrances use `backwards` fill) ---------- */
@keyframes sm-rise     { from { opacity: 0; transform: translateY(28px); } }
@keyframes sm-rise-sm  { from { opacity: 0; transform: translateY(10px); } }
@keyframes sm-lift     { from { transform: translateY(16px); } }            /* LCP-safe: no fade */
@keyframes sm-fade     { from { opacity: 0; } }
@keyframes sm-in-left  { from { opacity: 0; transform: translateX(-48px); } }
@keyframes sm-in-right { from { opacity: 0; transform: translateX(48px); } }
@keyframes sm-in-up    { from { opacity: 0; transform: translateY(64px) rotate(-3deg); } }
@keyframes sm-drop     { from { opacity: 0; transform: translateY(-18px) scale(0.96); } }
@keyframes sm-pop      { from { opacity: 0; transform: scale(0.6); } 70% { transform: scale(1.08); } }
@keyframes sm-toss     { from { opacity: 0; transform: translateY(-36px) rotate(calc(var(--r, 0deg) * 3)) scale(0.9); } }
@keyframes sm-settle   { to { opacity: 0.5; transform: rotate(0) scale(0.97); } }
@keyframes sm-float    { from { transform: translateY(0); } to { transform: translateY(-12px); } }
@keyframes sm-drift    { from { transform: scale(1.18) translate(-3%, -2%); } to { transform: scale(1.18) translate(3%, 2.5%); } }
@keyframes sm-draw     { from { stroke-dashoffset: 80; } }
@keyframes sm-unstack  { from { transform: translate(-14px, -14px); } }
@keyframes sm-shimmer  { from { transform: translateX(-100%); } 45%, to { transform: translateX(100%); } }
@keyframes sm-skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes sm-tap      { 35% { transform: scale(0.86); } 70% { transform: scale(1.1); } }
@keyframes sm-glow     { from { box-shadow: 0 0 0 3px var(--sm-accent-2), 0 0 0 3px color-mix(in srgb, var(--sm-accent-2) 50%, transparent); }
                         to   { box-shadow: 0 0 0 3px var(--sm-accent-2), 0 0 0 16px transparent; } }
@keyframes sm-breathe  { 0%, 100% { transform: none; box-shadow: 0 0 0 0 transparent; }
                         30% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sm-ink) 30%, transparent); }
                         50% { transform: scale(1.03); }
                         70% { box-shadow: 0 0 0 10px transparent; } }
@keyframes sm-sheet    { from { transform: translateY(105%); } }
@keyframes sm-select   { 0%, 45% { background: var(--sm-sunken); color: var(--sm-ink); transform: none; }
                         45% { transform: scale(0.88); }
                         55% { background: var(--sm-grad); color: var(--sm-on-grad); }
                         75% { transform: scale(1.1); } }
@keyframes sm-island   { from { width: 3.6em; opacity: 0; } 30% { opacity: 1; } }
@keyframes sm-seg      { from { transform: translateX(-100%); } }
@keyframes sm-blink    { 50% { opacity: 0; } }
@keyframes sm-checked  { to { color: var(--sm-ink-subtle); text-decoration: line-through; } }
@keyframes sm-check-dot { 50% { transform: scale(0.6); }
                          to { border-color: transparent; background: var(--sm-ink); transform: none; } }
@keyframes sm-pulse    { from { transform: scale(1); opacity: 0.5; } to { transform: scale(2.6); opacity: 0; } }

/* ---------- 1. reveal once ---------- */
html.js-motion main { overflow-x: clip; }
html.js-motion [data-reveal]:not(.is-in) { opacity: 0; }
html.js-motion [data-reveal].is-in { animation: sm-rise 0.8s var(--sm-ease-out) var(--rv-delay, 0ms) backwards; }
/* hero copy: on load, h1/lead lift only (LCP) */
html.js-motion .sm-hero-copy > * { animation: sm-rise 0.8s var(--sm-ease-out) backwards; }
html.js-motion .sm-hero-copy > :nth-child(2) { animation-delay: 40ms; }
html.js-motion .sm-hero-copy > :nth-child(3) { animation-delay: 120ms; }
html.js-motion .sm-hero-copy > :nth-child(4) { animation-delay: 220ms; }
html.js-motion .sm-hero-copy :is(h1, .lead) { animation-name: sm-lift; }

/* ---------- loops pause off screen: done in kit.js (infinite animations only, so entrances never freeze) ---------- */

/* ---------- 2. chaos -> order ---------- */
.sm-chaos { display: grid; gap: 12px; justify-items: start; }
.sm-chaos > * { max-width: 19rem; padding: 0.7rem 1rem; border-radius: 14px; background: var(--sm-surface);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.08); opacity: 0.85; transform: rotate(var(--r, 0deg)); }
.sm-chaos > :nth-child(even) { justify-self: end; }
html.js-motion .is-in .sm-chaos > * { animation: sm-toss 0.6s var(--sm-ease-out) 0.1s backwards, sm-settle 0.9s var(--sm-ease-io) 1.6s forwards; }
html.js-motion .is-in .sm-chaos > :nth-child(2) { animation-delay: 0.2s, 1.6s; }
html.js-motion .is-in .sm-chaos > :nth-child(3) { animation-delay: 0.3s, 1.6s; }
html.js-motion .is-in .sm-chaos > :nth-child(4) { animation-delay: 0.4s, 1.6s; }
html.js-motion .is-in .sm-chaos > :nth-child(5) { animation-delay: 0.5s, 1.6s; }
.sm-order { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.sm-order > li { position: relative; overflow: hidden; display: grid; grid-template-columns: 4.5rem 1fr auto; align-items: center;
  gap: 12px; padding: 0.85rem 1rem; border: 1px solid rgb(0 0 0 / 0.08); border-radius: 14px; background: var(--sm-surface); }
.sm-order .is-done { color: var(--sm-ink-subtle); }
.sm-order .is-done span { text-decoration: line-through; }
.sm-order .is-now { border: 0; background: var(--sm-grad); color: var(--sm-on-grad); font-weight: 600; }
html.js-motion .is-in .sm-order > li { animation: sm-in-right 0.7s var(--sm-ease-out) 0.8s backwards; }
html.js-motion .is-in .sm-order > li:nth-child(2) { animation-delay: 0.95s; }
html.js-motion .is-in .sm-order > li:nth-child(3) { animation-delay: 1.1s; }
html.js-motion .is-in .sm-order > li:nth-child(4) { animation-delay: 1.25s; }
html.js-motion .sm-order .is-now::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 0.45) 50%, transparent 70%);
  transform: translateX(-100%); animation: sm-shimmer 3.5s var(--sm-ease-io) 2.2s infinite; }

/* ---------- 3. device fly-in + float ---------- */
html.js-motion .sm-device { animation: sm-in-up 1.1s var(--sm-ease-out) 0.15s backwards, sm-float 7s var(--sm-ease-io) 1.25s infinite alternate; }
html.js-motion .sm-side-l { animation: sm-in-left 0.9s var(--sm-ease-out) 0.7s backwards, sm-float 6s var(--sm-ease-io) 1.6s infinite alternate-reverse; }
html.js-motion .sm-side-r { animation: sm-in-right 0.9s var(--sm-ease-out) 0.9s backwards, sm-float 8s var(--sm-ease-io) 1.8s infinite alternate; }
html.js-motion .sm-float { animation: sm-float 5s var(--sm-ease-io) infinite alternate; }

/* ---------- 4. live countdown bar ---------- */
.sm-bar { height: 6px; border-radius: 999px; background: rgb(0 0 0 / 0.15); overflow: hidden; }
.sm-bar > i { display: block; height: 100%; width: var(--sm-elapsed, 65%); border-radius: inherit; background: currentColor; }
html.js-motion .sm-bar > i { transition: width 1s linear; }

/* ---------- 5. live dot ---------- */
.sm-dot { position: relative; display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; background: currentColor; }
@media (prefers-reduced-motion: no-preference) {
  html.js-motion .sm-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: sm-pulse 2s var(--sm-ease-out) infinite; }
}

/* ---------- 6/7. step stories ---------- */
html.js-motion .is-in .sm-drop { animation: sm-drop 0.6s var(--sm-ease-out) calc(var(--rv-delay, 0ms) + 0.3s) backwards; }
html.js-motion .is-in .sm-pops > * { animation: sm-pop 0.5s var(--sm-ease-out) calc(var(--rv-delay, 0ms) + 0.6s) backwards; }
html.js-motion .is-in .sm-pops > :nth-child(2) { animation-delay: calc(var(--rv-delay, 0ms) + 0.7s); }
html.js-motion .is-in .sm-pops > :nth-child(3) { animation-delay: calc(var(--rv-delay, 0ms) + 0.8s); }
html.js-motion .is-in .sm-pops > :nth-child(4) { animation-delay: calc(var(--rv-delay, 0ms) + 0.9s); }
/* tap goes on an element INSIDE the popped one, so the two animations never fight */
html.js-motion .is-in .sm-tap { animation: sm-tap 0.5s var(--sm-ease-out) calc(var(--rv-delay, 0ms) + 1.5s) backwards, sm-glow 2.4s var(--sm-ease-out) calc(var(--rv-delay, 0ms) + 2s) infinite; }
html.js-motion .is-in .sm-rows > * { animation: sm-rise-sm 0.5s var(--sm-ease-out) calc(var(--rv-delay, 0ms) + 0.5s) backwards; }
html.js-motion .is-in .sm-rows > :nth-child(2) { animation-delay: calc(var(--rv-delay, 0ms) + 0.9s); }
html.js-motion .is-in .sm-rows > :nth-child(3) { animation-delay: calc(var(--rv-delay, 0ms) + 1.3s); }
html.js-motion .is-in .sm-rows > :nth-child(4) { animation-delay: calc(var(--rv-delay, 0ms) + 1.7s); }
html.js-motion .is-in .sm-rows .sm-ok { animation: sm-pop 0.45s var(--sm-ease-out) calc(var(--rv-delay, 0ms) + 0.8s) backwards; }
html.js-motion .is-in .sm-rows > :nth-child(2) .sm-ok { animation-delay: calc(var(--rv-delay, 0ms) + 1.2s); }
html.js-motion .is-in .sm-rows > :nth-child(3) .sm-ok { animation-delay: calc(var(--rv-delay, 0ms) + 1.6s); }
.sm-skel { height: 0.55rem; border-radius: 999px; background: #e3e1ea; }
html.js-motion .sm-skel { background: linear-gradient(90deg, #e3e1ea 0%, #f3f2f7 50%, #e3e1ea 100%) 0 0 / 200% 100%; animation: sm-skeleton 1.4s linear infinite; }

/* ---------- 8. bottom sheet ---------- */
.sm-sheet-wrap { position: relative; overflow: hidden; }
.sm-sheet-wrap::after { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / 0.55); z-index: 1; }
.sm-sheet { position: absolute; inset: auto 0 0 0; z-index: 2; padding: 14px 18px 22px; border-radius: 22px 22px 0 0; background: var(--sm-surface); }
html.js-motion .is-in.sm-sheet-wrap::after, html.js-motion .is-in .sm-sheet-wrap::after { animation: sm-fade 0.6s ease 0.3s backwards; }
html.js-motion .is-in .sm-sheet { animation: sm-sheet 0.8s var(--sm-spring) 0.5s backwards; }
html.js-motion .is-in .sm-chip-on { animation: sm-select 0.6s var(--sm-ease-out) 1.4s backwards; }
html.js-motion .is-in .sm-amts > * { display: inline-block; animation: sm-pop 0.45s var(--sm-ease-out) 1.9s backwards; }
html.js-motion .is-in .sm-amts > :nth-child(2) { animation-delay: 2.05s; }
html.js-motion .is-in .sm-amts > :nth-child(3) { animation-delay: 2.2s; }
html.js-motion .is-in .sm-breathe-2x { animation: sm-breathe 2.6s var(--sm-ease-io) 2.8s 2; }
html.js-motion .sm-breathe { animation: sm-breathe 2.6s var(--sm-ease-io) 2s infinite; }

/* ---------- 9. check-off ---------- */
.sm-check { display: flex; align-items: center; gap: 0.6rem; }
.sm-check::before { content: ""; flex: none; width: 1rem; height: 1rem; border: 1.5px solid #c9c7d3; border-radius: 50%; }
.sm-check.is-done { color: var(--sm-ink-subtle); text-decoration: line-through; }
.sm-check.is-done::before { border-color: transparent; background: var(--sm-ink); }
html.js-motion .is-in .sm-check.sm-checks-now { animation: sm-checked 0.01s linear 1.9s forwards; }
html.js-motion .is-in .sm-check.sm-checks-now::before { animation: sm-check-dot 0.4s var(--sm-ease-out) 1.7s forwards; }

/* ---------- 10. segment slide ---------- */
.sm-seg { isolation: isolate; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 999px; background: rgb(0 0 0 / 0.07); text-align: center; }
.sm-seg > * { position: relative; padding: 6px 0; }
.sm-seg .is-on::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 999px; background: var(--sm-surface); box-shadow: 0 1px 4px rgb(0 0 0 / 0.12); }
html.js-motion .is-in .sm-seg .is-on::before { animation: sm-seg 0.6s var(--sm-ease-out) 1.1s backwards; }

/* ---------- 11. banner drop ---------- */
html.js-motion .is-in .sm-banners > * { animation: sm-drop 0.6s var(--sm-ease-out) 0.5s backwards; }
html.js-motion .is-in .sm-banners > :nth-child(2) { animation-delay: 1.5s; }
html.js-motion .is-in .sm-banners > :nth-child(3) { animation-delay: 2.5s; }

/* ---------- 12. cursor ---------- */
html.js-motion .sm-cursor::after { content: ""; display: inline-block; width: 1.5px; height: 1.05em; margin-left: 2px; vertical-align: -0.2em; background: var(--sm-accent-2); animation: sm-blink 1.1s steps(1) infinite; }

/* ---------- 13. island ---------- */
.sm-island { display: flex; align-items: center; justify-content: space-between; width: 12em; height: 3.2em; padding: 0 1em; border-radius: 999px; background: #000; color: #fff; overflow: hidden; white-space: nowrap; }
html.js-motion .is-in .sm-island { animation: sm-island 0.9s var(--sm-pop-spring) 0.5s backwards; }
html.js-motion .is-in .sm-island > * { animation: sm-fade 0.4s ease 1.1s backwards; }

/* ---------- 14. mesh drift ---------- */
.sm-mesh { position: relative; isolation: isolate; overflow: clip; background: var(--sm-dark); color: #fff; }
.sm-mesh::before { content: ""; position: absolute; inset: -64px; z-index: -1; pointer-events: none; filter: blur(32px);
  background: radial-gradient(55% 60% at 82% 18%, color-mix(in srgb, var(--sm-accent) 60%, transparent), transparent 72%),
              radial-gradient(50% 55% at 68% 78%, color-mix(in srgb, var(--sm-accent-2) 55%, transparent), transparent 72%); }
html.js-motion .sm-mesh::before { animation: sm-drift 18s var(--sm-ease-io) infinite alternate; will-change: transform; }

/* ---------- 15. self-drawing icons (paths under 80 units, 24px icons) ---------- */
html.js-motion .sm-draw svg > * { stroke-dasharray: 80; }
html.js-motion .is-in .sm-draw svg > *, html.js-motion .sm-draw.is-in svg > * { animation: sm-draw 1.4s var(--sm-ease-io) calc(var(--rv-delay, 0ms) + 0.2s) backwards; }

/* ---------- 16. photo unstack ---------- */
.sm-stack { position: relative; }
.sm-stack__back { position: absolute; inset: 0; transform: translate(14px, 14px); border-radius: inherit; background: var(--sm-grad); z-index: -1; }
html.js-motion .is-in .sm-stack__back, html.js-motion .sm-stack.is-in .sm-stack__back { animation: sm-unstack 0.9s var(--sm-ease-out) 0.45s backwards; }

/* ---------- 18. floating pill nav ---------- */
.sm-nav { position: sticky; top: 12px; z-index: 50; max-width: 1200px; margin: 12px auto 0; padding-inline: 16px; }
.sm-nav__bar { display: flex; align-items: center; gap: 8px; height: 60px; padding-inline: 20px 8px; border-radius: 999px;
  border: 1px solid rgb(0 0 0 / 0.08); background: rgb(251 250 249 / 0.94); }
@supports (backdrop-filter: blur(1px)) { .sm-nav__bar { background: rgb(251 250 249 / 0.8); backdrop-filter: blur(16px) saturate(140%); } }

/* ---------- 19. hover lift ---------- */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .sm-tile { transition: transform 0.3s var(--sm-ease-out), box-shadow 0.3s var(--sm-ease-out); }
  .sm-tile:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgb(0 0 0 / 0.1); }
  .sm-tile .sm-tile__stage > * { transition: transform 0.5s var(--sm-ease-out); }
  .sm-tile:hover .sm-tile__stage > * { transform: scale(1.03); }
}

/* ---------- 20. FAQ slide open ---------- */
@supports (interpolate-size: allow-keywords) {
  html.js-motion { interpolate-size: allow-keywords; }
  html.js-motion details.sm-faq::details-content { block-size: 0; overflow: clip; transition: block-size 0.35s var(--sm-ease-out), content-visibility 0.35s allow-discrete; }
  html.js-motion details.sm-faq[open]::details-content { block-size: auto; }
}
