.margin-demo {
  --margin-red: #d91023;
  --margin-direct: #6333c5;
  --margin-ink: #242b27;
  position: relative;
  height: 340vh;
  background: #fffefa;
  color: var(--margin-ink);
  font-family: inherit;
  line-height: 1.4;
}
.margin-demo *, .margin-demo *::before, .margin-demo *::after { box-sizing: border-box; }
.margin-demo ::selection { background: #e1ceff; color: #28143e; }
.margin-demo :focus-visible { outline: 3px solid #9363df; outline-offset: 4px; }
.margin-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.margin-sticky { position: sticky; top: 88px; height: calc(100svh - 88px); min-height: 540px; padding: 24px 0 17px; }
.margin-inner { display: flex; flex-direction: column; width: min(1640px, calc(100% - 100px)); height: 100%; margin-inline: auto; }
.margin-stage-layout { display: grid; flex: 1; min-height: 0; grid-template-columns: 35% minmax(0, 65%); gap: 0; }
.margin-copy { position: relative; display: flex; align-items: center; min-width: 0; padding-right: 28px; }
.margin-title-stack { position: relative; width: 100%; height: 100%; }
.margin-phase-title { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; margin: 0; font-size: clamp(76px, 8.2vw, 148px); font-weight: 500; line-height: .86; letter-spacing: -.04em; text-wrap: initial; transition: opacity 260ms ease, transform 400ms cubic-bezier(.16,1,.3,1); }
.margin-phase-title > span { display: block; }
.margin-phase-apps { color: var(--margin-red); }
.margin-phase-direct { color: var(--margin-direct); font-size: clamp(64px, 6.8vw, 126px); opacity: 0; transform: translateY(35px); }
.margin-phase-direct > span:last-child { white-space: nowrap; }
.margin-demo[data-margin-stage="direct"] .margin-phase-apps { opacity: 0; transform: translateY(-35px); }
.margin-demo[data-margin-stage="direct"] .margin-phase-direct { opacity: 1; transform: translateY(0); }
.margin-figure { min-width: 0; height: 100%; margin: 0; border-left: 5px solid var(--margin-red); border-right: 5px solid var(--margin-red); border-radius: 19px; background: #fff; }
.margin-map { position: relative; width: 100%; height: 100%; }
.margin-way { position: absolute; top: 12%; bottom: 12%; left: 50%; z-index: 0; border-left: 3px dotted #f16a75; transform: translateX(-50%); transition: border-color 250ms ease; }
.margin-demo[data-margin-stage="direct"] .margin-way { border-color: #ad85e4; }
.margin-node { position: absolute; z-index: 2; left: 50%; transform: translate(-50%, -50%); }
.margin-node-client { top: 12%; }
.margin-node-app { top: 50%; transition: opacity 260ms ease, transform 300ms ease; }
.margin-node-restaurant { top: 88%; }
.margin-node-pill { display: block; padding: 23px 33px; border: 1px solid #ece8e2; border-radius: 999px; background: #faf9f7; color: var(--margin-ink); font-size: clamp(26px, 2.65vw, 49px); font-weight: 500; line-height: 1.05; letter-spacing: -.035em; white-space: nowrap; transition: background-color 300ms ease, color 300ms ease, transform 300ms ease; }
.margin-demo[data-margin-stage="direct"] .margin-node-app { opacity: 0; transform: translate(-56%, -50%); }
.margin-demo[data-margin-arrived="true"] .margin-node-restaurant .margin-node-pill { border-color: transparent; background: var(--margin-direct); color: #fff; transform: rotate(3deg) scale(1.04); }
.margin-mini-coins { position: absolute; top: 50%; left: calc(100% + 17px); display: flex; align-items: center; gap: 4px; width: 74px; transform: translateY(-50%); }
.margin-mini-coins > i, .margin-coin { display: grid; place-items: center; border-radius: 50%; background: #ffd324; border: 2px solid #ffbc00; box-shadow: inset 0 0 0 2px #ffe15f; color: #795700; font-family: inherit; font-size: 11px; font-style: normal; font-weight: 600; line-height: 1; }
.margin-mini-coins > i { width: 17px; height: 17px; flex: 0 0 17px; border-width: 1px; box-shadow: inset 0 0 0 1px #ffe15f; font-size: 6px; }
.margin-node-app .margin-mini-coins > i, .margin-node-restaurant .margin-mini-coins > i { opacity: 0; }
.margin-travelling-coins { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.margin-coin { position: absolute; top: 0; left: 0; width: 32px; height: 32px; opacity: 0; }
.margin-legend { position: absolute; top: 32%; left: 60%; z-index: 5; width: 35%; min-height: 42px; color: var(--margin-red); font-size: clamp(11px, 1.05vw, 16px); font-weight: 550; line-height: 1.35; text-transform: uppercase; }
.margin-legend > span { position: absolute; inset: 0; transition: opacity 260ms ease, transform 260ms ease; }
.margin-legend-direct { color: var(--margin-direct); opacity: 0; transform: translateY(8px); }
.margin-demo[data-margin-stage="direct"] .margin-legend-apps { opacity: 0; transform: translateY(-8px); }
.margin-demo[data-margin-stage="direct"] .margin-legend-direct { opacity: 1; transform: translateY(0); }
.margin-footer { display: grid; grid-template-columns: 35% minmax(0, 65%); align-items: center; gap: 0; padding-top: 13px; }
.margin-controls { display: flex; align-items: center; gap: 20px; }
.margin-control { position: relative; min-height: 36px; padding: 6px 0; border: 0; background: transparent; color: #776c78; font: inherit; font-size: 11px; font-weight: 500; line-height: 1.4; cursor: pointer; white-space: nowrap; transition: color 180ms ease; }
.margin-control::after { content: ""; position: absolute; right: 0; bottom: 2px; left: 0; height: 1px; background: currentColor; opacity: 0; }
.margin-control:hover { color: var(--margin-direct); }
.margin-control[aria-pressed="true"] { color: var(--margin-ink); }
.margin-control[aria-pressed="true"]::after { opacity: 1; }
.margin-note { max-width: none; margin: 0; padding-inline: 20px; color: #746a73; font-size: 10px; line-height: 1.6; text-align: center; text-wrap: pretty; }
.margin-static-comparison { display: none; }

@media (min-width: 700px) and (max-width: 1050px) {
  .margin-sticky { top: 80px; height: calc(100svh - 80px); }
  .margin-inner { width: calc(100% - 58px); }
  .margin-stage-layout, .margin-footer { grid-template-columns: 36% minmax(0, 64%); }
  .margin-copy { padding-right: 20px; }
  .margin-phase-title { font-size: clamp(56px, 8vw, 84px); }
  .margin-phase-direct { font-size: clamp(45px, 6.5vw, 69px); }
  .margin-node-pill { padding: 20px 25px; font-size: clamp(23px, 2.65vw, 30px); }
  .margin-mini-coins { left: calc(100% + 10px); gap: 3px; width: 52px; }
  .margin-mini-coins > i { width: 13px; height: 13px; flex-basis: 13px; font-size: 5px; }
  .margin-coin { width: 27px; height: 27px; font-size: 9px; }
  .margin-controls { gap: 12px; }
  .margin-control { font-size: 10px; }
  .margin-legend { left: 58%; width: 37%; font-size: 10px; }
}

@media (max-width: 699px) {
  .margin-demo { height: 320vh; }
  .margin-sticky { top: 68px; height: calc(100svh - 68px); min-height: 530px; padding: 16px 0 12px; }
  .margin-inner { width: calc(100% - 32px); }
  .margin-stage-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: 99px minmax(0, 1fr); gap: 14px; }
  .margin-copy { padding-right: 0; }
  .margin-title-stack { height: 99px; }
  .margin-phase-title { display: block; padding-top: 7px; font-size: clamp(36px, 9.8vw, 49px); line-height: .96; text-align: center; }
  .margin-phase-title > span { display: inline; }
  .margin-phase-title > span:last-child { display: block; }
  .margin-phase-direct { font-size: clamp(36px, 9.8vw, 49px); }
  .margin-figure { border-left-width: 3px; border-right-width: 3px; border-radius: 13px; }
  .margin-node-client { top: 13%; }
  .margin-node-app { top: 50%; }
  .margin-node-restaurant { top: 87%; }
  .margin-way { top: 13%; bottom: 13%; border-left-width: 2px; }
  .margin-node-pill { padding: 16px 21px; font-size: clamp(20px, 5.5vw, 27px); letter-spacing: -.035em; }
  .margin-mini-coins { left: calc(100% + 9px); gap: 3px; width: 45px; }
  .margin-mini-coins > i { width: 11px; height: 11px; flex-basis: 11px; font-size: 4px; }
  .margin-coin { width: 23px; height: 23px; border-width: 1.5px; box-shadow: inset 0 0 0 1.5px #ffe15f; font-size: 8px; }
  .margin-legend { top: 31%; left: 59%; width: 37%; min-height: 35px; font-size: 9px; line-height: 1.4; }
  .margin-footer { grid-template-columns: minmax(0, 1fr); gap: 5px; padding-top: 6px; }
  .margin-controls { justify-content: center; gap: 23px; }
  .margin-control { min-height: 33px; font-size: 10px; }
  .margin-note { padding-inline: 5px; font-size: 9px; line-height: 1.5; }
}

@media (max-width: 699px) and (max-height: 710px) {
  .margin-sticky { min-height: 490px; padding-top: 10px; }
  .margin-stage-layout { grid-template-rows: 82px minmax(0, 1fr); gap: 9px; }
  .margin-title-stack { height: 82px; }
  .margin-phase-title { padding-top: 4px; font-size: 35px; }
  .margin-node-pill { padding: 13px 19px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .margin-demo { height: auto; }
  .margin-sticky { position: static; height: auto; min-height: 0; padding-block: 32px; }
  .margin-stage-layout { flex: none; height: 620px; min-height: 620px; }
  .margin-phase-title, .margin-node-app, .margin-node-pill, .margin-way, .margin-legend > span, .margin-control { transition: none; }
  .margin-static-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; max-width: 800px; margin: 28px auto 0; padding-top: 20px; border-top: 1px solid #e5dfe7; }
  .margin-static-comparison strong { color: #4b229d; font-size: 14px; font-weight: 600; }
  .margin-static-comparison p { margin: 6px 0 0; color: #625d68; font-size: 13px; line-height: 1.6; }
}

@media (max-width: 699px) and (prefers-reduced-motion: reduce) {
  .margin-stage-layout { height: 530px; min-height: 530px; }
  .margin-static-comparison { grid-template-columns: minmax(0, 1fr); gap: 17px; margin-top: 22px; }
}
