.story {
  --zh: clamp(260px, 44svh, 440px);
  position: relative; z-index: 2; color: var(--fg); font-family: var(--font-ui);
  padding: clamp(40px, 8svh, 96px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
@media (min-width: 760px) {
  .story { padding-inline: max(48px, env(safe-area-inset-left, 0px)) max(48px, env(safe-area-inset-right, 0px)); }
}
.story-intro, .story-step { max-width: 1280px; margin-inline: auto; }
.story-intro { border-top: 1px solid var(--line); padding-top: 14px; }
.st-label, .st-num, .st-tag {
  margin: 0; font: 500 11px/1.2 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; color: var(--fg-2);
}

.story-step {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; min-height: 120svh;
}
.st-text { grid-row: 1; align-self: center; padding-block: 8svh; transition: opacity .7s var(--ease), transform .7s var(--ease); }
.st-zone { grid-row: 1; min-width: 0; }
.st-zone .slab-box {
  position: sticky; top: calc(50svh - var(--zh) / 2);
  height: var(--zh); width: calc(var(--zh) * .62); margin-inline: auto;
}
.st-zone .slab-fallback { display: block; width: 100%; height: 100%; object-fit: contain; }

[data-step="fees"] .st-text { grid-column: 1 / 6; }  [data-step="fees"] .st-zone { grid-column: 7 / 13; }
[data-step="split"] .st-text { grid-column: 7 / 13; } [data-step="split"] .st-zone { grid-column: 1 / 6; }
[data-step="join"] .st-text { grid-column: 1 / 6; }  [data-step="join"] .st-zone { grid-column: 7 / 13; }

.story-step--end { min-height: 90svh; grid-template-rows: auto auto; justify-items: center; align-content: center; text-align: center; }
.story-step--end .st-zone, .story-step--end .st-text { grid-column: 1 / -1; width: 100%; }
.story-step--end .st-zone { grid-row: 1; padding-top: 6svh; }
.story-step--end .st-text { grid-row: 2; padding-block: 3svh 14svh; }
.story-step--end .st-zone .slab-box { position: relative; top: auto; height: clamp(160px, 26svh, 240px); width: calc(clamp(160px, 26svh, 240px) * .62); }
.story-step--end .st-h { margin-inline: auto; max-width: 14ch; }

.st-num::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%;
  background: var(--accent); vertical-align: 1px; opacity: 0; transition: opacity .4s var(--ease);
}
.story-step[data-active="true"] .st-num::before { opacity: 1; }
.st-num { margin-bottom: 14px; }
.st-h {
  margin: 0 0 20px; font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(30px, 3.6vw, 50px); line-height: .98; color: var(--fg);
}
.st-body { margin: 0 0 14px; max-width: 34em; font: 400 16px/1.55 var(--font-ui); color: var(--fg); }
.st-fine { font-size: 14px; color: var(--fg-2); }

.js-anim .st-text.is-pre { opacity: 0; transform: translateY(18px); }

.st-demo { margin-top: 22px; padding-top: 14px; max-width: 30em; border-top: 1px solid var(--line); }
.st-tag { margin-bottom: 12px; }

/* 01: the meter */
.st-meter { position: relative; height: 12px; border-radius: 999px; background: var(--track); overflow: hidden; }
.st-meter i { position: absolute; inset: 0 30% 0 0; border-radius: inherit; background: var(--fg); }
.st-meter-cap { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font: 500 12px/1.2 var(--font-ui); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.st-meter-cap b { font-weight: 600; color: var(--fg); }

/* 02: who gets paid */
.st-rules { display: grid; gap: 10px; margin: 0 0 18px; max-width: 34em; }
.st-rules li {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 14px; background: var(--panel); font-size: 15px; line-height: 1.45;
}
.st-rules .pill { justify-content: center; }
.st-rules b { font-weight: 600; }

/* 03: join */
.st-how { display: grid; gap: 8px; margin: 0 0 18px; }
.st-how li { display: flex; align-items: baseline; gap: 14px; font: 500 17px/1.3 var(--font-ui); }
.st-how b { font-size: 26px; font-weight: 400; color: var(--accent); min-width: 1ch; }

.page-foot { position: relative; z-index: 2; border-top: 1px solid var(--line); margin: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); padding-block: 20px 28px; text-align: center; }
@media (min-width: 760px) { .page-foot { margin-inline: max(48px, env(safe-area-inset-left, 0px)) max(48px, env(safe-area-inset-right, 0px)); } }
.page-foot p { margin: 0; font: 400 12px/1.5 var(--font-ui); color: var(--fg-2); }

@media (min-width: 760px) and (max-width: 1040px) {
  .story-step:not(.story-step--end) .st-text { grid-column: 1 / 7; }
  .story-step:not(.story-step--end) .st-zone { grid-column: 7 / 13; }
  .story-step[data-step="split"] .st-text { grid-column: 7 / 13; }
  .story-step[data-step="split"] .st-zone { grid-column: 1 / 7; }
}

@media (max-width: 759.98px) {
  .story-step { --zh: 34svh; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100svh; padding-block: 28px 8px; }
  .story-step .st-zone, .story-step .st-text { grid-column: 1; }
  .story-step .st-zone { grid-row: 1; }
  .story-step .st-text { grid-row: 2; align-self: start; padding-block: 20px 4svh; }
  .st-zone .slab-box { top: calc(var(--nav-h) / 2); }
  .story-step--end { min-height: 70svh; }
  .story-step--end .st-zone .slab-box { height: 28svh; width: calc(28svh * .62); }
  .st-rules li { grid-template-columns: 64px minmax(0, 1fr); padding: 12px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .st-text, .st-num::before { transition: none; }
}

/* The explainer belongs to the live view; the pages stand on their own without repeating it. */
body:not([data-view="live"]) .story, body:not([data-view="live"]) .page-foot { display: none; }
