/* Cardi motion layer: floating header, 3D reveals, hover tilt, the sliding
   banner and the live dashboard numbers. Loaded after each page's own styles
   (home, design, tap to link, account) and before assets/theme.css, so the
   light view can restyle it. assets/motion.js drives the moving parts.
   Everything here stands still under prefers-reduced-motion. */

/* ---------- floating header ----------
   The bar no longer spans the page: it floats as a glass pill with the page
   showing round it. Same markup on every page: .nav > .wrap (home) or
   .nav > .nav-inner (style.css pages). */
.nav {
  top: calc(env(safe-area-inset-top, 0px) + 12px) !important;
  margin-top: 12px;
  padding-inline: 12px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: none;            /* the gap round the pill clicks through */
}
.nav > .wrap,
.nav > .nav-inner {
  pointer-events: auto;
  max-width: 1180px;
  margin-inline: auto;
  height: 72px;
  padding: 0 12px 0 26px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(52,65,86,.78), rgba(36,46,62,.82));
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  transition: height .3s ease, box-shadow .3s ease, background .3s ease;
}
.nav.is-scrolled > .wrap,
.nav.is-scrolled > .nav-inner {
  height: 62px;
  background: linear-gradient(180deg, rgba(52,65,86,.9), rgba(36,46,62,.92));
  box-shadow: 0 26px 60px -16px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.06);
}
@media (max-width: 640px) {
  .nav { margin-top: 8px; padding-inline: 10px; top: calc(env(safe-area-inset-top, 0px) + 8px) !important; }
  .nav > .wrap, .nav > .nav-inner { height: 56px; padding: 0 8px 0 14px; border-radius: 18px; }
  .nav.is-scrolled > .wrap, .nav.is-scrolled > .nav-inner { height: 54px; }
}
/* Bigger wordmark and links, like a product header. */
.nav .logo { font-size: 22px; gap: 11px; }
.nav .logo svg { width: 26px; height: 26px; }
.nav .logo-word { font-size: 24px; }
.nav nav a, .nav .nav-links .nav-link--page { font-size: 16px; color: #AEB8C6; transition: color .2s ease; }
.nav nav a:hover, .nav .nav-links .nav-link--page:hover { color: #FFFFFF; }
@media (max-width: 640px) { .nav .logo { font-size: 20px; } .nav .logo-word { font-size: 21px; } }
/* Tablet widths: tighten the links, then drop them (as below 760px) before they wrap. */
.nav nav a { white-space: nowrap; }
@media (max-width: 1120px) { .nav nav { gap: 18px; } .nav nav a { font-size: 14.5px; } }
@media (max-width: 960px) { .nav nav { display: none; } }

/* The logo mark gives a small wave when the header is hovered. */
.nav .logo svg, .nav .logo-mark { transition: transform .5s cubic-bezier(.2,.9,.2,1.4); }
.nav > :hover .logo svg, .nav > :hover .logo-mark { transform: rotate(-8deg) scale(1.08); }

/* The design page's own step bar gets the same pill. */
.editor-bar {
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 20px;
  padding: 10px 10px 10px 18px !important;
  margin-bottom: 26px !important;
  background: linear-gradient(180deg, rgba(42,53,71,.7), rgba(31,40,54,.7));
  box-shadow: 0 22px 50px -22px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
}

/* ---------- 3D reveals ----------
   Home already reveals .rv boxes (fade up). They now swing up out of the page.
   Other pages use .m3d, added by motion.js. */
.rv-on .rv,
.m3d-on .m3d {
  opacity: 0;
  transform: perspective(1100px) translate3d(0, 46px, -80px) rotateX(18deg);
  transform-origin: 50% 100%;
  transition: opacity .8s cubic-bezier(.2,.8,.2,1), transform .9s cubic-bezier(.2,.8,.2,1);
  transition-delay: var(--d, 0ms);
}
.rv-on .rv.is-in,
.m3d-on .m3d.is-in { opacity: 1; transform: none; }

/* ---------- hover tilt ----------
   Boxes lean toward the pointer once they have landed (.tilt-live). */
html .tilt.tilt-live.tilt-live {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform .2s ease-out, box-shadow .3s ease;
  transition-delay: 0s;
  will-change: transform;
}
html .tilt.tilt-live.is-hover { --lift: -4px; box-shadow: 0 28px 60px -24px rgba(0,0,0,.6); }

/* ---------- sliding banner ---------- */
.mq {
  position: relative; overflow: hidden; padding: 18px 0; direction: ltr;   /* the loop runs the same way in Arabic; items keep their own direction */
  border-block: 1px solid var(--rule, var(--line, #324158));
  background: linear-gradient(90deg, rgba(13,197,180,.06), rgba(13,197,180,0) 30%, rgba(13,197,180,0) 70%, rgba(13,197,180,.06));
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.mq__track { display: flex; width: max-content; direction: ltr; animation: mq-slide 46s linear infinite; }
.mq:hover .mq__track { animation-play-state: paused; }
.mq__set { display: flex; align-items: center; gap: 0; flex: none; }
.mq__item { display: inline-flex; align-items: center; gap: 12px; padding: 0 28px; white-space: nowrap;
  font: 500 16px/1.2 var(--sans, var(--font-ui)); color: var(--text, #E9EEF3); }
[dir="rtl"] .mq__item { direction: rtl; }
.mq__item b { font-weight: 700; color: var(--signal, var(--accent, #0DC5B4)); }
.mq__item::after { content: ''; width: 6px; height: 6px; border-radius: 50%; margin-inline-start: 28px;
  background: var(--signal, var(--accent, #0DC5B4)); box-shadow: 0 0 12px rgba(13,197,180,.7); }
.mq--rev .mq__track { animation-direction: reverse; animation-duration: 58s; }
.mq--rev .mq__item { font-size: 14px; color: var(--muted, var(--text-mute, #8D9AAD)); }
@keyframes mq-slide { to { transform: translateX(-50%); } }

/* ---------- live dashboard ---------- */
.m-num { font-variant-numeric: tabular-nums; }
.m-bump { animation: m-bump .9s ease; }
@keyframes m-bump {
  0% { color: inherit; text-shadow: none; }
  25% { color: var(--signal, var(--accent, #0DC5B4)); text-shadow: 0 0 18px rgba(13,197,180,.55); transform: translateY(-1px); }
  100% { color: inherit; text-shadow: none; }
}
/* Bars rise and question bars fill when the dashboard comes into view. */
.dash .bars > div { transform-origin: 50% 100%; transition: transform .9s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i, 0) * 45ms + 250ms); }
.dash .asks i { transform-origin: 0 50%; transition: transform 1.1s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i, 0) * 120ms + 400ms); }
[dir="rtl"] .dash .asks i { transform-origin: 100% 50%; }
.m-dash-wait .bars > div { transform: scaleY(0); }
.m-dash-wait .asks i { transform: scaleX(0); }
.dash .bars > div.m-tick { animation: m-tick 1s ease; }
@keyframes m-tick { 30% { filter: brightness(1.5); } }
/* A pulsing "live" dot beside the dashboard title. */
.m-live { display: inline-flex; align-items: center; gap: 7px; margin-inline-start: 12px; vertical-align: middle;
  font: 500 12px/1 var(--mono, monospace); color: var(--signal, var(--accent, #0DC5B4)); }
.m-live i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 rgba(13,197,180,.6); animation: m-pulse 1.8s ease-out infinite; }
@keyframes m-pulse { 70% { box-shadow: 0 0 0 9px rgba(13,197,180,0); } 100% { box-shadow: 0 0 0 0 rgba(13,197,180,0); } }

@media (prefers-reduced-motion: reduce) {
  .mq__track, .m-live i, .m-bump, .m-tick { animation: none !important; }
  .mq { overflow-x: auto; }
  .rv-on .rv, .m3d-on .m3d { transform: none !important; }
}
