/* Side Sync motion language: generic, no product facts, no build step, no libraries.
   Spec: docs/brand/SIDE-SYNC-MOTION.md. Pair with motion.js. Checked by test/own-brand-motion.mjs.
   Rules this file keeps (borrowed from a production landing page's hard-won motion contract):
   1. No CSS transition ever names `transform` (or `all`): transforms that are written per frame
      (tilt, parallax) are never eased by CSS. Hover lift and press ride the individual `translate`
      and `scale` properties; entrances are one-shot animations that end and let go.
   2. `perspective` lives only on .mo-stage, paired with preserve-3d on .mo-stack. Never put a
      perspective parent over staggered siblings.
   3. One --motion-dir variable (1, or -1 in RTL) flips every horizontal offset. Declared once on
      :root and once in the [dir="rtl"] rule. Never redeclare it anywhere else.
   4. Every keyframe and every hover/press move has a prefers-reduced-motion fallback (see the end).
   5. All durations and easings come from the tokens below. No raw ms, s or cubic-bezier outside them.
   6. Logical properties only (inline-start/end, inset-inline): no left/right, so Arabic mirrors itself. */

/* ds:scale begin (generated from templates/motion-kit/scale.css: node scripts/lib/motion-kit.mjs sync) */
html {
  /* space */
  --ds-sp-_1rem: .1rem; --ds-sp-_25rem: .25rem; --ds-sp-4px: 4px; --ds-sp-_35rem: .35rem; --ds-sp-6px: 6px; --ds-sp-_4em: .4em; --ds-sp-_5rem: .5rem; --ds-sp-8px: 8px; --ds-sp-_55rem: .55rem; --ds-sp-0_6em: 0.6em; --ds-sp-_6rem: .6rem; --ds-sp-_65rem: .65rem; --ds-sp-_65em: .65em; --ds-sp-_7rem: .7rem; --ds-sp-_75rem: .75rem; --ds-sp-12px: 12px; --ds-sp-_8rem: .8rem; --ds-sp-14px: 14px; --ds-sp-_9rem: .9rem; --ds-sp-_9em: .9em; --ds-sp-1rem: 1rem; --ds-sp-16px: 16px; --ds-sp-1_1rem: 1.1rem; --ds-sp-18px: 18px; --ds-sp-1_25rem: 1.25rem; --ds-sp-20px: 20px; --ds-sp-1_3em: 1.3em; --ds-sp-1_5rem: 1.5rem; --ds-sp-1_75rem: 1.75rem; --ds-sp-28px: 28px; --ds-sp-2rem: 2rem; --ds-sp-36px: 36px; --ds-sp-48px: 48px; --ds-sp-4rem: 4rem; --ds-sp-150px: 150px;
  /* corner radius */
  --ds-r-10px: 10px; --ds-r-14px: 14px; --ds-r-16px: 16px; --ds-r-999px: 999px;
  /* type size */
  --ds-fs-_8rem: .8rem; --ds-fs-_9rem: .9rem; --ds-fs-_92rem: .92rem; --ds-fs-_95rem: .95rem; --ds-fs-1_05rem: 1.05rem; --ds-fs-1_1rem: 1.1rem; --ds-fs-1_15rem: 1.15rem; --ds-fs-1_3rem: 1.3rem; --ds-fs-1_6rem: 1.6rem; --ds-fs-1_8rem: 1.8rem; --ds-fs-2rem: 2rem;
  /* stacking */
  --ds-z-n1: -1; --ds-z-1: 1; --ds-z-2: 2; --ds-z-30: 30; --ds-z-40: 40;
  /* shadow geometry (offset, blur, spread): the colour stays in the rule, because a card may wear its own accent; a rule writes var(--ds-shadow-geo-x) <colour> */
  --ds-shadow-geo-hair: 0 1px 0; --ds-shadow-geo-ring-1: 0 0 0 1px; --ds-shadow-geo-ring-2: 0 0 0 2px; --ds-shadow-geo-underline-2: inset 0 -2px 0; --ds-shadow-geo-bleed: 0 0 0 100vmax;
  --ds-shadow-geo-stuck: 0 8px 22px -12px; --ds-shadow-geo-lift-sm: 0 8px 20px -10px; --ds-shadow-geo-lift-lg: 0 14px 30px -14px;
  --ds-shadow-geo-pop: 0 10px 28px; --ds-shadow-geo-card: 0 10px 30px; --ds-shadow-geo-raise: 0 14px 34px; --ds-shadow-geo-float: 0 18px 50px; --ds-shadow-geo-glow: 0 8px 22px;
  /* time steps of the hero sequence and the settle (the entrance and ui durations are the kit's own --mo-* / --motion-* tokens) */
  --ds-dur-70ms: 70ms; --ds-dur-140ms: 140ms; --ds-dur-210ms: 210ms; --ds-dur-220ms: 220ms; --ds-dur-640ms: 640ms;
}
/* ds:scale end */

:root {
  /* Durations (never above 450 ms for an interface move) */
  --motion-dur-micro: 160ms;   /* hover, press, colour */
  --motion-dur-reveal: 250ms;  /* entrance of a block */
  --motion-dur-panel: 300ms;   /* larger panels, language swap */
  --motion-dur-frame: 450ms;   /* full-frame move, the champagne sweep */
  --motion-stagger: 60ms;      /* gap between cascade siblings (index capped at 5 by motion.js) */
  /* Easings */
  --motion-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --motion-ease-out: cubic-bezier(0, 0, 0.2, 1);
  --motion-ease-in: cubic-bezier(0.4, 0, 1, 1);
  --motion-ease-linear: linear;      /* spinners only */
  /* Direction: 1 in LTR, -1 in RTL. The only declaration besides the [dir="rtl"] rule below. */
  --motion-dir: 1;
  /* Palette hooks (Side Sync: graphite, champagne, teal). Override per site. */
  --mo-accent-rgb: 201 163 92;   /* champagne #C9A35C */
  --mo-accent-2-rgb: 61 181 172; /* teal #3DB5AC */
  --mo-lift: 4px;
  --mo-tilt-max: 6deg;
}
:root[dir="rtl"] { --motion-dir: -1; }

/* Page guard: translated blocks before they reveal must not create a horizontal scrollbar */
.mo-clip { overflow-x: clip; }

/* ---------- 1. Reveal cascade (eyebrow, title, subtitle, then cards) ----------
   Hidden only when motion.js is running (html.mo-js), so without JS everything is simply visible. */
.mo-js [data-reveal]:not(.is-in) {
  opacity: 0;
  transform: translate3d(calc(var(--motion-dir) * var(--reveal-x, 0px)), var(--reveal-y, 14px), 0);
}
.mo-js [data-reveal].is-in {
  animation: mo-rise var(--motion-dur-reveal) var(--motion-ease-out) backwards;
  animation-delay: calc(var(--i, 0) * var(--motion-stagger));
}
@keyframes mo-rise {
  from {
    opacity: 0;
    transform: translate3d(calc(var(--motion-dir) * var(--reveal-x, 0px)), var(--reveal-y, 14px), 0);
  }
}
[data-reveal-y="10"] { --reveal-y: 10px; }
[data-reveal-y="24"] { --reveal-y: 24px; }
[data-reveal-x="start"] { --reveal-x: -20px; }
[data-reveal-x="end"] { --reveal-x: 20px; }

/* ---------- 2. Hero layered stack: pointer tilt + scroll parallax ----------
   Perspective only here, paired with preserve-3d on the stack. Tilt and parallax variables are
   written per frame by motion.js, so there is NO transition on these transforms. */
.mo-stage {
  perspective: 1400px;
  perspective-origin: 50% 38%;
}
.mo-stack {
  position: relative;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}
.mo-stack[data-live] { will-change: transform; } /* armed only while the pointer is moving it */
.mo-layer {
  grid-area: 1 / 1;
  transform: translate3d(0, var(--parallax-y, 0px), var(--z, 0px));
  transition: translate var(--motion-dur-micro) var(--motion-ease-standard); /* the individual property: independent of the scrubbed transform */
}
.mo-layer[data-layer-start] { justify-self: start; }
.mo-layer[data-layer-end] { justify-self: end; }
@media (hover: hover) and (pointer: fine) {
  .mo-layer:hover { translate: 0 calc(var(--mo-lift) * -1); }
}

/* ---------- 3. Cursor glow (a champagne wash that follows the pointer inside a card) ---------- */
[data-glow] { position: relative; isolation: isolate; }
[data-glow]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: var(--ds-z-n1);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(240px circle at var(--glow-x, 50%) var(--glow-y, 50%), rgb(var(--mo-accent-rgb) / 0.16), transparent 70%);
  transition: opacity var(--motion-dur-panel) var(--motion-ease-standard);
}
[data-glow].is-glow::before { opacity: 1; }

/* ---------- 4. Counters (motion.js runs each once; the markup holds the final value) ---------- */
[data-count] { font-variant-numeric: tabular-nums; display: inline-block; min-inline-size: 1ch; }

/* ---------- 5. Product cards: hover lift, press, focus ---------- */
.mo-lift {
  transition:
    translate var(--motion-dur-micro) var(--motion-ease-standard),
    box-shadow var(--motion-dur-micro) var(--motion-ease-standard),
    border-color var(--motion-dur-micro) var(--motion-ease-standard);
}
@media (hover: hover) and (pointer: fine) {
  .mo-lift:hover {
    translate: 0 calc(var(--mo-lift) * -1);
    box-shadow: var(--ds-shadow-geo-pop) rgb(0 0 0 / 0.28), var(--ds-shadow-geo-ring-1) rgb(var(--mo-accent-rgb) / 0.22);
  }
}
.mo-lift:focus-within { box-shadow: var(--ds-shadow-geo-ring-2) rgb(var(--mo-accent-rgb) / 0.55); }

/* Buttons: colour and press feedback (scalePress), busy spinner */
.mo-btn {
  transition:
    background-color var(--motion-dur-micro) var(--motion-ease-standard),
    box-shadow var(--motion-dur-micro) var(--motion-ease-standard),
    scale var(--motion-dur-micro) var(--motion-ease-standard);
}
.mo-btn:active { scale: 0.97; }
.mo-btn[aria-busy="true"]::after {
  content: "";
  display: inline-block;
  inline-size: 0.9em;
  block-size: 0.9em;
  margin-inline-start: var(--ds-sp-0_6em);
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: mo-spin var(--motion-dur-frame) var(--motion-ease-linear) infinite;
}
@keyframes mo-spin { to { transform: rotate(360deg); } }

/* ---------- 6. Champagne sweep: the single accent, plays once when its block is revealed ---------- */
.mo-sweep { position: relative; overflow: hidden; }
.mo-sweep::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: 40%;
  pointer-events: none;
  background: linear-gradient(calc(100deg * var(--motion-dir)), transparent, rgb(var(--mo-accent-rgb) / 0.28), transparent);
  translate: calc(-120% * var(--motion-dir)) 0;
  opacity: 0;
}
.mo-js .mo-sweep.is-in::after {
  animation: mo-sweep var(--motion-dur-frame) var(--motion-ease-out) var(--motion-dur-reveal) both;
}
@keyframes mo-sweep {
  from { translate: calc(-120% * var(--motion-dir)) 0; opacity: 1; }
  to { translate: calc(300% * var(--motion-dir)) 0; opacity: 0; }
}

/* ---------- 7. Language switch with RTL mirroring ----------
   motion.js sets lang and dir on <html>; logical properties + --motion-dir mirror the layout. The
   swap itself is one short fade of the page content. */
.mo-lang-swap { animation: mo-fade var(--motion-dur-micro) var(--motion-ease-out) backwards; }
@keyframes mo-fade { from { opacity: 0; } }
[data-lang-set][aria-pressed="true"] { box-shadow: var(--ds-shadow-geo-underline-2) rgb(var(--mo-accent-rgb)); }

/* ---------- 8. Low-power tier (set by motion.js on coarse pointers, low memory, data saver) ----------
   Content still arrives, but as a plain fade: no travel, no tilt, no glow, no sweep. */
html[data-motion="lite"] [data-reveal]:not(.is-in) { transform: none; }
html[data-motion="lite"] [data-reveal].is-in { animation-name: mo-fade; }
html[data-motion="lite"] .mo-stack { transform: none; }
html[data-motion="lite"] .mo-layer { transform: none; }
html[data-motion="lite"] [data-glow]::before { display: none; }
html[data-motion="lite"] .mo-sweep::after { display: none; }

/* ---------- 9. Reduced motion (and html[data-motion="off"], set by motion.js for the same preference) ----------
   Everything is visible and still. State changes keep working through colour and the outline only. */
/* print: a printed or saved page shows every section (nothing waits for a scroll that never comes) */
@media print {
  .mo-js [data-reveal]:not(.is-in) { opacity: 1; transform: none; }
  .mo-js [data-reveal].is-in { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mo-js [data-reveal]:not(.is-in) { opacity: 1; transform: none; }
  .mo-js [data-reveal].is-in { animation: none; }
  .mo-stack { transform: none; }
  .mo-stack[data-live] { will-change: auto; }
  .mo-layer { transform: none; transition: none; }
  .mo-layer:hover { translate: none; }
  [data-glow]::before { display: none; }
  .mo-lift { transition: border-color var(--motion-dur-micro) var(--motion-ease-standard); }
  .mo-lift:hover { translate: none; box-shadow: none; }
  .mo-btn { transition: background-color var(--motion-dur-micro) var(--motion-ease-standard); }
  .mo-btn:active { scale: none; }
  .mo-btn[aria-busy="true"]::after { animation: none; }
  .mo-js .mo-sweep.is-in::after { animation: none; }
  .mo-sweep::after { display: none; }
  .mo-lang-swap { animation: none; }
}
html[data-motion="off"] [data-reveal]:not(.is-in) { opacity: 1; transform: none; }
html[data-motion="off"] [data-reveal].is-in { animation: none; }
html[data-motion="off"] .mo-stack,
html[data-motion="off"] .mo-layer { transform: none; transition: none; }
html[data-motion="off"] [data-glow]::before,
html[data-motion="off"] .mo-sweep::after { display: none; }
html[data-motion="off"] .mo-js .mo-sweep.is-in::after { animation: none; }
html[data-motion="off"] .mo-layer:hover { translate: none; }
html[data-motion="off"] .mo-lift:hover { translate: none; box-shadow: none; }
html[data-motion="off"] .mo-btn:active { scale: none; }
html[data-motion="off"] .mo-btn[aria-busy="true"]::after,
html[data-motion="off"] .mo-lang-swap { animation: none; }
