/* ═══════════════════════════════════════════════════════════════════════
   Blog motion pieces: small animations, built in code, that show the
   point a post is making (Design guardrails in CONTRIBUTING.md).
   ───────────────────────────────────────────────────────────────────────
   Each piece is plain HTML (put it in an "HTML" block), so every number is
   live text that reads correctly with no JavaScript, for screen readers and
   for anyone whose phone is set to reduce motion. assets/js/blog-motion.js
   only adds the movement. Brand colours only: navy, blue, light blue,
   white. Lime is for actions, never here.

   Pieces so far:
     .mo-breakdown   a payment that shrinks as costs come off it
                     (see "Motion pieces" in CONTRIBUTING.md for the HTML)
   ═══════════════════════════════════════════════════════════════════════ */

.mo {
  --mo-navy: #153461;
  --mo-deep: #0d2a52;
  --mo-blue: #4791fe;
  --mo-sky: #c1d8ff;
  --mo-ice: #f1f5fb;
  margin: 40px 0;
  font-family: 'Inter', sans-serif;
}
.mo figcaption { margin-top: 12px; font-size: 14px; line-height: 1.5; color: #52637d; text-align: center; }

/* The stage: a real photo (softly blurred, navy-shaded) or, without one,
   navy with the brand's two glows. Set a photo on the figure:
   style="--mo-photo: url('/assets/images/blog/stage-fabric-shop.webp')" */
.mo-stage {
  position: relative;
  isolation: isolate;
  border-radius: 24px;
  overflow: hidden;
  padding: 56px 40px;
  min-height: 380px;
  display: flex;
  align-items: center;
  background: var(--mo-navy);
}
.mo-stage::before {
  content: "";
  position: absolute;
  inset: -24px;
  z-index: -2;
  background: var(--mo-photo, none) center / cover no-repeat;
  filter: blur(5px) saturate(1.1);
}
.mo-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(40% 50% at 85% 10%, rgba(71, 145, 254, .38), transparent 70%),
    radial-gradient(35% 45% at 8% 95%, rgba(255, 90, 0, .22), transparent 70%),
    linear-gradient(100deg, rgba(14, 37, 71, .72), rgba(14, 37, 71, .38) 65%, rgba(14, 37, 71, .2));
}

/* ── Breakdown ─────────────────────────────────────────────────────────── */
/* David's milky frosted glass: cool grey-white, heavy blur, bright top edge */
.mo-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 330px;
  margin-right: auto;
  padding: 28px 28px 24px;
  border-radius: 28px;
  color: #fff;
  background: rgba(140, 158, 184, .34);
  -webkit-backdrop-filter: blur(30px) saturate(1.3);
  backdrop-filter: blur(30px) saturate(1.3);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, .55),
    inset 0 0 0 1px rgba(255, 255, 255, .22),
    0 30px 60px -30px rgba(5, 20, 45, .65);
}
.mo .mo-kicker { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: #dbe6f7; }
.mo .mo-total {
  margin: 6px 0 2px;
  font-size: 46px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -1.6px;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.mo .mo-total-label { margin: 0; font-size: 14px; color: #c9d6ea; }

/* The costs: account-token chips that pop out of the card's right edge */
.mo .mo-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  left: calc(100% - 36px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mo .mo-lines li + li { margin-top: 0; }
.mo .mo-lines li {
  display: grid;
  grid-template-columns: 40px auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  width: max-content;
  padding: 9px 20px 9px 9px;
  border-radius: 100px;
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 14px 30px -14px rgba(9, 30, 66, .5);
}
.mo .mo-lines li:nth-child(2) { margin-left: 22px; }
.mo .mo-lines li:nth-child(3) { margin-left: 8px; }
/* the round icon: a "money out" arrow on pale blue */
.mo .mo-lines li::before {
  content: "";
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #eaf2ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f74e8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.mo .mo-lines li span:last-child { grid-column: 2; grid-row: 1; font-size: 17px; line-height: 22px; font-weight: 600; color: #0a1d38; font-variant-numeric: tabular-nums; }
.mo .mo-lines li span:first-child { grid-column: 2; grid-row: 2; font-size: 13px; line-height: 18px; color: #52637d; }
.mo-replay {
  margin-top: 16px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #dbe6f7;
  cursor: pointer;
  display: inline-block;
  visibility: hidden;        /* space kept from the start, so the card never changes height */
}
.mo-replay:hover { color: #fff; }

/* While playing (blog-motion.js adds these classes): chips pop out one by one */
.mo.is-armed .mo-lines li { opacity: 0; transform: translateX(-18px) scale(.9); }
.mo.is-armed .mo-lines li.is-in { opacity: 1; transform: none; transition: opacity .4s ease, transform .55s cubic-bezier(.2, .9, .25, 1.2); }
.mo.is-armed .mo-total-label { opacity: 0; }
.mo.is-done .mo-total-label { opacity: 1; transition: opacity .4s ease; }
.mo.is-done .mo-replay { visibility: visible; }

/* Narrow screens: the chips sit under the card instead of beside it */
@media (max-width: 720px) {
  .mo-stage { padding: 28px 18px; border-radius: 20px; flex-direction: column; align-items: stretch; }
  .mo-card { max-width: none; padding: 22px 20px 18px; margin-right: 0; }
  .mo .mo-total { font-size: 38px; }
  .mo .mo-lines { position: static; transform: none; margin-top: 18px; }
  .mo .mo-lines li:nth-child(n) { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mo.is-armed .mo-lines li { opacity: 1; transform: none; }
  .mo.is-armed .mo-total-label { opacity: 1; }
}

/* ── Live cover (post page only; see LiveCover in blog/[slug]/page.tsx) ──
   The cover image without its pop-out, plus real pop-out chips that take
   turns. Sizes are in cqw (% of the cover's width) so the chips scale
   exactly with the image, as if they were part of it. */
.lc {
  position: relative;
  container-type: inline-size;
  border-radius: 28px;
  overflow: hidden;
  aspect-ratio: 1200 / 630;
  box-shadow: 0 0 0 1px #e3e9f3;
}
.bp-cover .lc > img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; box-shadow: none; }
.lc-slot { position: absolute; left: var(--lc-x, 58%); top: var(--lc-y, 72%); animation: lc-float 5s ease-in-out infinite; }
.lc-chip {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 1.4cqw;
  white-space: nowrap;
  padding: 1.5cqw 2.6cqw 1.5cqw 1.5cqw;
  border-radius: 100px;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 1.6cqw 3.8cqw -1.4cqw rgba(9, 30, 66, .45);
  font-family: 'Inter', sans-serif;
  opacity: 0;
  transform: translateY(1.2cqw) scale(.94);
  transform-origin: left center;
}
.lc-chip:first-child { opacity: 1; transform: none; }   /* no JavaScript: the first chip just sits there */
.lc-ico { width: 5.6cqw; height: 5.6cqw; border-radius: 50%; background: #eaf2ff; display: grid; place-items: center; flex: none; }
.lc-ico svg { width: 2.7cqw; height: 2.7cqw; }
.lc-t { display: block; font-weight: 600; font-size: 2.55cqw; line-height: 1.15; color: #0a1d38; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.lc-m { display: block; font-size: 2.05cqw; line-height: 1.25; color: #52637d; }
.lc.is-armed .lc-chip { opacity: 0; transform: translateY(1.2cqw) scale(.94); }
.lc.is-armed .lc-chip.is-in { opacity: 1; transform: none; transition: opacity .5s ease, transform .6s cubic-bezier(.2, .9, .25, 1.15); }
.lc.is-armed .lc-chip.is-out { opacity: 0; transform: translateY(-1cqw) scale(.98); transition: opacity .4s ease, transform .4s ease; }
@keyframes lc-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.6cqw); } }
@media (max-width: 640px) { .lc { border-radius: 20px; } }
@media (prefers-reduced-motion: reduce) { .lc-slot { animation: none; } }

/* ── Live cover: the words and glass, drawn in code over the photo ───────
   Sizes in cqw (% of the cover's width), matching the Figma covers at
   1200 wide: logo 150, headline 64 (milky) / 96 (navy), subline 24. */
.lc-copy { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); font-family: 'Inter', sans-serif; color: #fff; }
.lc--left .lc-copy { left: 4cqw; }
.lc--right .lc-copy { right: 4cqw; }
.lc .lc-logo { display: block; width: 12.5cqw; height: auto; margin: 0 0 2.4cqw; border-radius: 0; box-shadow: none; } /* not the cover-image edge from blog.css */
.lc .lc-h { margin: 0; font-weight: 600; letter-spacing: -.03em; line-height: 1.04; color: #fff; }
.lc .lc-s { margin: 1.7cqw 0 0; font-weight: 500; line-height: 1.3; color: #c1d8ff; }

/* Milky frosted glass: navy-cool tint, heavy blur, bright top edge, soft glows inside */
.lc--milky .lc-copy {
  width: 43.3cqw;
  padding: 3cqw 3.3cqw;
  border-radius: 3.3cqw;
  overflow: hidden;
  isolation: isolate;
  background: rgba(70, 92, 130, .30);
  -webkit-backdrop-filter: blur(36px) saturate(1.25);
  backdrop-filter: blur(36px) saturate(1.25);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .55), inset 0 0 0 1px rgba(255, 255, 255, .24);
}
.lc--milky .lc-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(45% 55% at 90% 0%, rgba(71, 145, 254, .42), transparent 70%),
    radial-gradient(35% 40% at 0% 100%, rgba(255, 90, 0, .16), transparent 70%);
}
.lc--milky .lc-h { font-size: 5.33cqw; }
.lc--milky .lc-s { font-size: 2cqw; }

/* Navy gradient glass: navy fading in from the words' side, no hard edge */
.lc-fade { position: absolute; z-index: 1; top: 0; bottom: 0; width: 82cqw; pointer-events: none; }
.lc--left .lc-fade { left: 0; background: linear-gradient(90deg, #0e2547 0%, #0e2547 30%, rgba(14, 37, 71, .97) 40%, rgba(14, 37, 71, .9) 48%, rgba(14, 37, 71, .78) 56%, rgba(14, 37, 71, .6) 64%, rgba(14, 37, 71, .4) 72%, rgba(14, 37, 71, .22) 80%, rgba(14, 37, 71, .09) 88%, rgba(14, 37, 71, .02) 95%, rgba(14, 37, 71, 0) 100%); }
.lc--right .lc-fade { right: 0; background: linear-gradient(270deg, #0e2547 0%, #0e2547 30%, rgba(14, 37, 71, .97) 40%, rgba(14, 37, 71, .9) 48%, rgba(14, 37, 71, .78) 56%, rgba(14, 37, 71, .6) 64%, rgba(14, 37, 71, .4) 72%, rgba(14, 37, 71, .22) 80%, rgba(14, 37, 71, .09) 88%, rgba(14, 37, 71, .02) 95%, rgba(14, 37, 71, 0) 100%); }
.lc--navy.lc--left .lc-copy { left: 5.3cqw; }
.lc--navy.lc--right .lc-copy { right: 5.3cqw; }
.lc--navy .lc-copy { width: 46cqw; }
.lc--navy .lc-logo { width: 13.3cqw; margin-bottom: 2.2cqw; }
.lc--navy .lc-h { font-size: 8cqw; line-height: 1; letter-spacing: -.035em; }
.lc--navy .lc-s { font-size: 2.17cqw; margin-top: 2.2cqw; }
.lc-slot { z-index: 3; }

/* The slow reveal (blog-motion.js): glass eases in, words rise, then the chips start */
.lc.is-armed .lc-copy { opacity: 0; transform: translateY(-47%); }
.lc.is-armed .lc-copy > * { opacity: 0; transform: translateY(1.2cqw); }
.lc.is-armed .lc-fade { opacity: 0; }
/* Deliberate order: the surface (fade/glass) first, then logo → headline → subline,
   each about a quarter-second apart; the first chip follows once they've settled (JS) */
.lc.is-shown .lc-fade { opacity: 1; transition: opacity 1s ease; }
/* Navy style: the base photo already carries the navy fade (exported with it on),
   so the photo never shows a hard edge; the coded gradient only deepens it behind the words */
.lc--navy.is-shown .lc-fade, .lc--navy:not(.is-armed) .lc-fade { opacity: .5; }
.lc.is-shown .lc-copy { opacity: 1; transform: translateY(-50%); transition: opacity .9s ease, transform 1.1s cubic-bezier(.2, .8, .2, 1); }
.lc.is-shown .lc-copy > * { opacity: 1; transform: none; transition: opacity .7s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
.lc.is-shown .lc-copy > :nth-child(1) { transition-delay: .35s; }
.lc.is-shown .lc-copy > :nth-child(2) { transition-delay: .6s; }
.lc.is-shown .lc-copy > :nth-child(3) { transition-delay: .85s; }

/* Small covers (phones): drop the supporting line, give the headline room */
@container (max-width: 520px) {
  .lc .lc-s { display: none; }
  .lc--milky .lc-copy { width: 50cqw; padding: 3.6cqw 4cqw; }
  .lc--milky .lc-h { font-size: 6.2cqw; }
  .lc-t { font-size: 3.2cqw; }
  .lc-m { font-size: 2.6cqw; }
}

/* ═══ Sequence pieces (data-mo="sequence") ═══════════════════════════════
   Parts arrive one by one, in the order of their data-step numbers, and any
   number with data-count-step counts up or down when its step comes. The
   HTML holds the finished picture; the script only adds the arrival.
   Pieces built on it: .mo-note (credit alert vs order note) and
   .mo-flow (Wallet or Sub Account?). HTML in CONTRIBUTING.md. */
.mo.is-armed [data-step] { opacity: 0; transform: translateY(12px); }
.mo.is-armed [data-step].is-in { opacity: 1; transform: none; transition: opacity .55s ease, transform .75s cubic-bezier(.2, .9, .25, 1.12); }
.mo .mo-stage > .mo-replay { position: absolute; right: 22px; bottom: 16px; z-index: 2; margin: 0; }

/* A white account-token row: icon, name, detail, amount (the house chip, wider) */
.mo-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  column-gap: 12px;
  align-items: center;
  padding: 10px 16px 10px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 14px 30px -16px rgba(9, 30, 66, .5);
  color: #0a1d38;
}
.mo-row-ico { width: 40px; height: 40px; border-radius: 50%; background: #eaf2ff; display: grid; place-items: center; }
.mo-row-ico svg { width: 20px; height: 20px; }
.mo .mo-row-t { margin: 0; font-size: 15px; line-height: 20px; font-weight: 600; }
.mo .mo-row-m { margin: 0; font-size: 12.5px; line-height: 17px; color: #52637d; }
.mo .mo-row-v { margin: 0; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ── Credit alert vs order note ─────────────────────────────────────────── */
.mo-note .mo-stage { gap: 22px; justify-content: center; align-items: flex-start; padding: 44px 32px 56px; }
.mo-alert { width: 250px; flex: none; margin-top: 18px; }
.mo.is-armed .mo-alert[data-step]:not(.is-in) { transform: translateY(-20px) scale(.96); }
.mo-note .mo-card { width: auto; flex: 1 1 0; min-width: 0; max-width: none; margin-right: 0; }
.mo .mo-notes { list-style: none; margin: 14px 0 0; padding: 0; }
.mo .mo-notes li { margin: 0; padding: 9px 0; border-top: 1px dashed rgba(255, 255, 255, .25); font-size: 15px; line-height: 21px; color: #eef3fb; }
.mo .mo-notes li:first-child { font-weight: 600; color: #fff; }

/* ── Wallet or Sub Account? ─────────────────────────────────────────────── */
/* The two lanes stack (side by side they get cramped in a 720px article) */
.mo-flow .mo-stage { flex-direction: column; gap: 16px; align-items: stretch; padding: 36px 40px 52px; }
.mo-lane {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 20px;
  border-radius: 24px;
  background: rgba(140, 158, 184, .30);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
  backdrop-filter: blur(28px) saturate(1.25);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .5), inset 0 0 0 1px rgba(255, 255, 255, .2);
  color: #fff;
}
.mo .mo-lane-h { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #c1d8ff; }
.mo .mo-lane-p { margin: 0; font-size: 14px; line-height: 20px; color: #e6eefb; }
.mo-move {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 100px;
  background: #4791fe;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 22px -12px rgba(9, 30, 66, .6);
}
.mo-move svg { width: 14px; height: 14px; }
.mo.is-armed .mo-move[data-step]:not(.is-in) { transform: translateY(-14px) scale(.94); }

/* Narrow screens: everything stacks; heights stay fixed through the motion */
@media (max-width: 720px) {
  .mo-note .mo-stage, .mo-flow .mo-stage { flex-direction: column; align-items: stretch; padding: 26px 16px 48px; }
  .mo-alert { width: auto; margin-top: 0; }
  .mo-note .mo-card { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mo.is-armed [data-step] { opacity: 1; transform: none; }
}
