.cashback-stage {
  min-height: calc(100svh - var(--header-height, 72px));
  display: grid;
  align-items: center;
  padding-block: clamp(32px, 6vh, 72px);
  text-align: center;
}
.cashback-intro h1 {
  font: italic 400 clamp(36px, 5vw, 72px)/1.05 "Instrument Serif", serif;
  text-wrap: balance;
}
.cashback-intro h1 + p { margin-top: 12px; }
.cashback-description {
  font-weight: 400;
  max-width: 52ch;
  margin: 24px auto 0;
  line-height: 1.5;
  text-wrap: pretty;
}
.cashback-open {
  display: inline-block;
  margin-top: 32px;
  padding: 11px 24px;
  border: 1px solid var(--ink);
  border-radius: 99px;
  transition: background-color 150ms, color 150ms;
}
.cashback-open:is(:hover, :active) {
  background-color: var(--ink);
  color: #fff;
  text-decoration: none;
}
@media (prefers-reduced-motion: reduce) {
  .cashback-open { transition: none; }
}
.cashback-set { display: none; min-width: 0; }
.cashback-set:target { display: block; }
.cashback-stage:has(.cashback-set:target) .cashback-intro { display: none; }
.cashback-phones {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, var(--story-phone-width)));
  justify-content: center;
  gap: clamp(8px, 2.2vw, 32px);
  touch-action: pan-y pinch-zoom;
}
.cashback-mobile { display: none; }
@media (width < 768px) {
  .cashback-stage.has-carousel:has(.cashback-set:target) {
    align-content: center;
    row-gap: 24px;
  }
  .cashback-stage.has-carousel:has(.cashback-set:target) .cashback-intro {
    display: block;
  }
  .cashback-stage:has(.cashback-set:target) .cashback-intro h1 {
    font-size: 26px;
    line-height: 32px;
  }
  .cashback-stage:has(.cashback-set:target) .cashback-intro h1 + p {
    margin-top: 4px;
    font-size: 14px;
    line-height: 21px;
  }
  .cashback-stage:has(.cashback-set:target) .cashback-description {
    max-width: 38ch;
    margin-top: 16px;
    font-size: 14px;
    line-height: 22px;
  }
  .cashback-stage:has(.cashback-set:target) .cashback-open { display: none; }
  .cashback-stage.has-carousel:has(.cashback-set:target) .cashback-mobile {
    display: block;
    width: calc(100% + 2 * var(--gutter));
    margin-inline: calc(-1 * var(--gutter));
    min-width: 0;
    container-type: inline-size;
  }
  .cashback-stage.has-carousel .cashback-set:target { display: none; }
}
.cashback-stage .phone-display {
  aspect-ratio: 1500 / 3248;
  background: #262729;
}
.cashback-controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 32px; }
.cashback-controls [data-direction="replay"] svg { transform: translate(.5px, .75px); }
@media (prefers-reduced-motion: no-preference) {
  .cashback-intro, .cashback-set:target { animation: cashback-in 400ms ease-out both; }
  @keyframes cashback-in { from { opacity: 0; transform: translateY(5px); } }
}

.cashback-page {
  --mass-light: rgb(80 135 248 / 18%);
  --prem-light: rgb(103 173 112 / 15%);
  --private-light: rgb(235 150 85 / 17%);
  transition: background-color 450ms ease, color 300ms ease;
}
.cashback-page:has(.cashback-set:target) {
  --background: #353a40;
  --ink: #fff;
}
.cashback-page:has(.cashback-set:target) .skip-link { color: var(--background); }

.cashback-set .cashback-phones, .cashback-mobile { position: relative; isolation: isolate; }
.cashback-set .cashback-phones { --light-gap: clamp(8px, 2.2vw, 32px); gap: var(--light-gap); }
.cashback-set .cashback-phones::before, .cashback-mobile::before {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
  inset: -32px 0;
  --center: 50%;
  --spread: min(calc(var(--story-phone-width) + var(--light-gap)), calc((100% + var(--light-gap)) / 3));
  --radius: 27%;
  background:
    radial-gradient(ellipse var(--radius) 45% at calc(var(--center) - var(--spread)) 45%, var(--mass-light), transparent 100%),
    radial-gradient(ellipse var(--radius) 45% at var(--center) 45%, var(--prem-light), transparent 100%),
    radial-gradient(ellipse var(--radius) 45% at calc(var(--center) + var(--spread)) 45%, var(--private-light), transparent 100%);
}
.cashback-mobile::before {
  --radius: 60%;
  --spread: calc(60% - 3.2px);
  --center: calc(50% + var(--spread) - var(--story-scroll, 0px));
  opacity: 0;
  transition: opacity 350ms ease;
}
.cashback-mobile[data-set]::before { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .cashback-page, .cashback-mobile::before { transition: none; }
}

/* Use the same entrance keyframes and timing as the In-app stories viewer. */
@media (width < 768px) {
  .cashback-page:has(.has-carousel .cashback-set:target) .cashback-intro {
    animation: none;
  }
  .cashback-page:has(.has-carousel .cashback-set:target):not(.entrance-finished) {
    --story-ease: var(--entrance-ease);
    & :is(.mobile-story-phone, .story-progress, .site-footer, .stories-back, .cashback-intro h1, .cashback-intro h1 + p, .cashback-description) {
      animation: var(--enter-name, story-enter-fade) var(--enter-duration, 650ms) var(--story-ease) var(--enter-delay, 400ms) both;
    }
    & .mobile-story-phone {
      --enter-name: story-enter-phone;
      --enter-delay: 0ms;
      --enter-duration: 800ms;
    }
    & :is(.cashback-intro h1, .cashback-intro h1 + p) {
      --enter-name: story-enter-text;
      --enter-delay: 750ms;
    }
    & .cashback-description {
      --enter-name: story-enter-text;
      --enter-delay: 1050ms;
    }
    @media (prefers-reduced-motion: reduce) {
      & :is(.mobile-story-phone, .story-progress, .site-footer, .stories-back, .cashback-intro h1, .cashback-intro h1 + p, .cashback-description) {
        animation: story-enter-fade 120ms linear both;
      }
    }
  }
}

.cashback-controls [aria-disabled="true"] { opacity: .25; pointer-events: none; }

.cashback-stage > .stories-back { display: none; }
.cashback-stage:has(.cashback-set:target) {
  align-content: center;
  row-gap: 24px;
}
.cashback-stage:has(.cashback-set:target) > .stories-back {
  display: inline-block;
  justify-self: center;
}
@media (min-width: 768px) {
  .cashback-set:target {
    --phone-gap: clamp(8px, 2.2vw, 32px);
    display: grid;
    grid-template-columns: 44px minmax(0, calc(3 * var(--story-phone-width) + 2 * var(--phone-gap))) 44px;
    justify-content: center;
    align-items: center;
    column-gap: 24px;
  }
  .cashback-phones { grid-area: 1 / 2; }
  .cashback-controls { display: contents; }
  .cashback-controls [data-direction="previous"] { grid-area: 1 / 1; }
  .cashback-controls :is([data-direction="next"], [data-direction="replay"]) { grid-area: 1 / 3; }
}

.cashback-credits { display: none; line-height: 1.5; }
.cashback-stage:has(#set-4:target) > .cashback-credits { display: block; }

@media (width < 768px) {
  .cashback-stage.has-carousel:has(#set-4:target) .cashback-description { display: none; }
  .cashback-stage.has-carousel:has(#set-4:target) > .cashback-credits {
    grid-row: 2;
    margin-top: -8px;
    font-size: 14px;
    line-height: 22px;
  }
}
