.story-thread {
  padding: .48rem clamp(.85rem, 2vw, 1.65rem) .6rem;
  border-top: 1px solid #48405e18;
  background: #fff9;
}

.story-thread ol {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-thread ol::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: .3rem 16.66% auto;
  height: 1px;
  background: linear-gradient(to right, var(--journey-strong) calc(var(--j-progress, 0) * 100%), var(--journey-chart-line) 0);
}

.story-thread li {
  display: grid;
  justify-items: center;
  gap: .27rem;
  min-width: 0;
  color: #666070;
  font-size: .74rem;
  font-weight: 625;
  line-height: 1.2;
  text-align: center;
}

.story-thread li::before {
  content: "";
  width: .6rem;
  height: .6rem;
  border: 1px solid var(--journey-strong);
  border-radius: 50%;
  background: #f9f6fc;
}

.story-thread li[data-current] { color: var(--journey-ink); font-weight: 760; }
.story-thread li[data-current]::before { border-color: #fff; background: var(--journey-strong); box-shadow: 0 0 0 2px var(--journey-chart-line); }

.story-coffee-entry img, .story-review img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: clamp(.65rem, 2vw, 1.15rem);
  border: 1px solid #ddd3ec;
  border-radius: .6rem;
  background: #fff;
  box-shadow: 0 .55rem 1.2rem -.8rem #40265358;
}

.story-review img { margin-bottom: .7rem; }

.journey-chart.journey-paper[data-journey-chart="paper"] {
  position: relative;
  width: min(100%, 15.25rem);
  justify-self: center;
  padding: clamp(.75rem, 2.05vw, 1.5rem);
  border: 1px solid #e3d2bd;
  background: linear-gradient(105deg, #f3e8d7, #fffaf1 33%, #fff9ed 78%, #f5ead9);
  box-shadow: 0 1rem 2rem -1.1rem #5840306e;
}

.journey-chart.journey-paper[data-journey-chart="paper"]::after {
  content: "";
  position: absolute;
  inset: auto -1px -.3rem;
  height: .35rem;
  background: linear-gradient(135deg, #f8efe0 50%, transparent calc(50% + 1px)) 0 0 / .65rem .35rem repeat-x,
    linear-gradient(225deg, #f8efe0 50%, transparent calc(50% + 1px)) 0 0 / .65rem .35rem repeat-x;
  pointer-events: none;
}

.journey-chart.journey-paper[data-journey-chart="paper"] .journey-chart-label {
  color: #422f28;
  font-size: clamp(.87rem, 1.4vw, 1.15rem);
  letter-spacing: -.05em;
}

.journey-chart.journey-paper[data-journey-chart="paper"] .journey-paper-lines {
  margin-block: .75rem .5rem;
  padding-block: .65rem;
}

.story-receipt-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: .4rem;
  row-gap: .3rem;
  color: #554136;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.story-receipt-total img {
  display: block;
  flex: 0 1 auto;
  width: min(63%, 7.35rem);
  height: auto;
  opacity: var(--story-paper-number, 1);
  mix-blend-mode: multiply;
}

.story-scan {
  position: absolute;
  inset: -.45rem;
  opacity: var(--story-scan, 0);
  pointer-events: none;
}

.story-scan i {
  position: absolute;
  width: .9rem;
  height: .9rem;
  border-color: #714cae;
  border-style: solid;
  border-width: 2px 0 0 2px;
  border-radius: .22rem 0 0;
}

.story-scan i:nth-child(1) { inset: 0 auto auto 0; }
.story-scan i:nth-child(2) { inset: 0 0 auto auto; transform: rotate(90deg); }
.story-scan i:nth-child(3) { inset: auto 0 0 auto; transform: rotate(180deg); }
.story-scan i:nth-child(4) { inset: auto auto 0 0; transform: rotate(270deg); }

.story-scan b {
  position: absolute;
  inset: var(--story-scan-y, 12%) .5rem auto;
  height: 1px;
  background: #8058bdc9;
  box-shadow: 0 0 .65rem .18rem #9271c65e;
}

.story-flight {
  position: absolute;
  z-index: 5;
  inset: 0 auto auto 0;
  display: block;
  width: var(--story-w, 0px);
  max-width: none;
  height: auto;
  opacity: var(--story-o, 0);
  transform: translate(var(--story-x, 0px), var(--story-y, 0px));
  pointer-events: none;
}

.story-flight[data-story-coffee-flight] {
  border-radius: .45rem;
  box-shadow: 0 .6rem 1.35rem -.6rem #452a5152;
}

.story-ink-flight { mix-blend-mode: multiply; }

.story-budget-flight {
  color: var(--ink);
  font-size: clamp(.68rem, calc(var(--story-w, 64px) * .21), 3rem);
  font-weight: 745;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
  line-height: 1.08;
  white-space: nowrap;
}

.story-ink-mask {
  position: absolute;
  z-index: 2;
  inset: 22.01% auto auto 9.54%;
  width: 42.11%;
  height: 4.225%;
  background: #fff;
  opacity: var(--story-mask, 0);
  pointer-events: none;
}

.story-bill {
  position: relative;
  grid-area: 1 / 1;
  min-width: 0;
  opacity: var(--story-bill-o, 0);
  pointer-events: none;
}

.story-shares {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(clamp(.24rem, .62vw, .58rem) * var(--story-separation, 1));
  margin-top: .79rem;
}

.story-shares::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: calc(50% - .64rem) 0 auto;
  height: 1.28rem;
  border-radius: .32rem;
  background: var(--journey-strong);
  opacity: max(0, calc(1 - 1.7 * var(--story-separation, 1)));
  pointer-events: none;
}

.story-share {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: .2rem;
  min-width: 0;
  min-height: clamp(3.55rem, 5.8vw, 5rem);
  padding: .4rem .13rem;
  overflow: hidden;
  border: 1px solid #ded2e8;
  border-radius: .55rem;
  background: #f4eef9;
  text-align: center;
  opacity: clamp(0, calc((var(--story-separation, 1) - .12) * 1.14), 1);
}

.story-share[data-person="you"] { border-color: #d1bddf; background: #eae0f4; }

.story-share::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: #d7ead9;
  transform: scaleY(var(--story-paid, 0));
  transform-origin: bottom;
  pointer-events: none;
}

.story-share[data-paid] { border-color: #adc9b4; }
.story-share > span { color: #564763; font-size: clamp(.67rem, 1.1vw, .79rem); font-weight: 700; line-height: 1.1; }
.story-share > strong {
  color: #2b2333;
  font-size: clamp(.91rem, 1.95vw, 1.35rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -.055em;
}
.story-share > small { color: #655672; font-size: clamp(.54rem, .79vw, .68rem); font-weight: 630; line-height: 1.12; }
.story-share[data-paid] > small { color: #365746; }

.journey-end {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, .62fr);
  align-items: end;
  gap: 1rem clamp(1.45rem, 5vw, 4.75rem);
  margin-block: clamp(1.75rem, 6vw, 5.5rem) clamp(2rem, 5.8vw, 4.6rem);
  padding-block: clamp(1.25rem, 4vw, 3.4rem);
  border-block: 1px solid var(--line);
}

.journey-end h2 {
  max-width: 17ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.05rem, 5vw, 4.3rem);
  font-weight: 685;
  line-height: 1;
  letter-spacing: -.068em;
  word-spacing: .07em;
  text-wrap: balance;
}

.journey-end h2 em { color: var(--purple); }
.journey-end p, .story-privacy p { max-width: 32ch; color: var(--muted); font-size: clamp(1rem, 1.55vw, 1.2rem); line-height: 1.53; }
.journey-end a, .story-privacy a { color: var(--purple-deep); font-weight: 700; text-decoration: underline; text-underline-offset: .22em; }
.journey-end-copy p { margin-top: 1rem; }
.journey-end-copy a, .story-privacy a { display: inline-block; margin-top: .75rem; }
.journey-end > img, .story-privacy > img {
  width: min(100%, 26rem);
  height: auto;
  align-self: center;
  justify-self: end;
  border: 1px solid #e7ddee;
  border-radius: .85rem;
  background: #fff;
  box-shadow: 0 .85rem 1.85rem -.95rem #59367c44;
}
.story-privacy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, .55fr);
  align-items: center;
  gap: 1rem clamp(1.45rem, 5vw, 4.75rem);
  margin-bottom: clamp(2.2rem, 5vw, 4rem);
  color: var(--muted);
}
.story-privacy h2 { font-size: clamp(1.6rem, 2.5vw, 2.4rem); letter-spacing: -.045em; font-weight: 700; color: var(--ink); }
.story-privacy p { margin-top: .55rem; }

@media (max-width: 600px) {
  .journey-end, .story-privacy { grid-template-columns: minmax(0, 1fr); }
  .journey-end > img, .story-privacy > img { justify-self: start; }
  .story-thread { padding-block: .38rem .42rem; }
  .story-thread li { font-size: .67rem; }
  .story-share > small { max-width: 100%; overflow-wrap: anywhere; }
}

@media (max-width: 393px) {
  .journey-chart.journey-paper[data-journey-chart="paper"] { padding: .55rem .43rem; }
  .journey-chart.journey-paper[data-journey-chart="paper"] .journey-chart-label { font-size: .74rem; }
  .journey-chart.journey-paper[data-journey-chart="paper"] .journey-paper-lines { margin-block: .52rem .32rem; padding-block: .43rem; }
  .story-receipt-total { font-size: .63rem; }
  .story-scan { inset: -.29rem; }
  .story-scan i { width: .66rem; height: .66rem; }
  .story-shares { margin-top: .58rem; }
  .story-share { min-height: 3.45rem; padding-inline: .08rem; border-radius: .41rem; }
  .story-share > span { font-size: .6rem; }
  .story-share > small { font-size: .54rem; }
}

@media (prefers-reduced-motion: reduce) {
  .story-flight, .story-scan, .story-ink-mask { display: none; }
  .story-receipt-total img { opacity: 1; }
}

html[data-motion-off] :is(.story-flight, .story-scan, .story-ink-mask) { display: none; }
html[data-motion-off] .story-receipt-total img { opacity: 1; }

.journey-stage .journey-device { opacity: var(--story-phone, 1); }
[data-story-coffee-source] { opacity: var(--story-coffee-source, 1); }
[data-story-month-amount] { opacity: var(--story-month-source, 1); }
[data-story-budget-spent] { opacity: var(--story-budget-target, 1); }
[data-story-bill-amount] { opacity: var(--story-bill-amount-o, 1); }
.journey-stage .journey-charts {
  transition: background-color .28s var(--ease), border-color .28s var(--ease), box-shadow .28s var(--ease);
}
.journey-stage:is([data-story-sequence="table"],[data-story-sequence="paper"],[data-story-sequence="scan"]) .journey-charts {
  background-color: transparent;
  border-color: transparent;
  box-shadow: none;
}
.journey-stage:is([data-story-sequence="table"],[data-story-sequence="paper"],[data-story-sequence="scan"]) .journey-art::before { opacity: 0; }
.journey-stage[data-story-sequence="scan"] .story-review { padding: .7rem; border-radius: .85rem; background: #fffefb; }
.story-paper-fallback { justify-content: center; min-height: 11rem; background: #fcf4e7; }
.story-paper-fallback > strong { font-size: clamp(1.55rem, 4vw, 2.5rem); color: #483229; letter-spacing: -.06em; }
.journey-end[data-entered] > img { animation: story-return .6s var(--ease) both; }
@keyframes story-return {
  from { opacity: .65; transform: translate(12px,8px); }
  to { opacity: 1; transform: translate(0); }
}
@media (min-width: 821px) {
  .journey[data-journey-mode="sticky"] .journey-beat:is(#spending,#spending-month,#settled) {
    min-height: clamp(21rem, 55svh, 33rem);
  }
}

.journey-chart.journey-paper[data-journey-chart="paper"] {
  translate: var(--story-paper-x, 0px) 0;
}

/* The surrounding story stays the same height while the camera re-frames the actors. */
.journey-art { isolation: isolate; overflow: clip; }
.story-scene-light {
  position: absolute;
  z-index: -3;
  inset: -18%;
  background: radial-gradient(ellipse at var(--shot-light, 50%) 43%, #fffdf8e8 1%, transparent 62%),
    color-mix(in srgb, var(--shot-tint-from, #eee5fb), var(--shot-tint-to, #eee5fb) var(--shot-tint-progress, 0%));
  pointer-events: none;
}
.story-scene-light::after {
  content: "";
  position: absolute;
  inset: 12%;
  background-image: linear-gradient(to right, #6953821f 1px, transparent 1px), linear-gradient(to bottom, #6953821f 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at var(--shot-light, 50%) 48%, #000c, transparent 80%);
  transform: rotate(var(--shot-tilt, 0deg)) scale(1.16);
}
.journey-art::after {
  transform: rotate(calc(24deg + var(--shot-tilt, 0deg) * 2));
  opacity: .65;
}
.journey-stage .journey-charts { transform: translate(var(--shot-chart-x, 0px), var(--shot-chart-y, 0px)) scale(var(--shot-chart-scale, 1)); }
.journey-stage .journey-device { transform: translate(var(--shot-phone-x, 0px), var(--shot-phone-y, 0px)) scale(var(--shot-phone-scale, 1)); }
@media (max-width: 550px) {
  .story-scene-light::after { background-size: 20px 20px; }
}
