/* AI-Pay marketing site (v4) — the part of the page that moves with the scroll.
 *
 *   1. Acts            the numbers js/scroll.js writes, and what they default to without it
 *   (2–5 were the previous opening and its two pinned scenes: removed 2026-10-07. The opening is
 *    now css/light.css.)
 *   6. Film            the intro video as a glass-framed 16:9 screen
 *   7. Introduction    the divider in front of "How AI-Pay works"; blocks that rise in
 *   8. Sizes and preferences
 *
 * Every scene is transform + opacity computed from --p (0 → 1 across the act). Without the
 * engine (no JavaScript, reduced motion, a short viewport) --p stays at 1, which is each
 * scene's finished picture, and the acts are ordinary sections.
 * Material and colour come from brand.css; nothing here adds a hue. */

/* ── 1. Acts ─────────────────────────────────────────────────────────────── */
.act {
  position: relative;
  --p: 1; /* finished; js/scroll.js writes the live value on the element itself */
  --v: 0;
}
.act-hero {
  --p: 0; /* the hero's copy fades out towards 1, so it rests at 0 */
}

/* ── 6. Film ─────────────────────────────────────────────────────────────── */
.film {
  --screen-shadow: rgb(14 52 92 / 38%);
  padding-top: clamp(64px, 9vw, 128px);
}
.film-inner {
  display: grid;
  justify-items: center;
  padding-inline: var(--gutter);
  text-align: center;
}
.film .title {
  max-width: 19em;
}
/* The whole 16:9 frame always fits one screen: its width is also bounded by the viewport's
 * height. It is never cropped (the video carries its own "Demo data" label in a corner). */
.film-stage {
  width: min(1200px, 100%, (100vh - 180px) * 16 / 9);
  width: min(1200px, 100%, (100svh - 180px) * 16 / 9);
  margin-top: clamp(26px, 3.6vw, 44px);
}
.screen {
  position: relative;
  padding: 6px;
  box-shadow:
    var(--glass-inset),
    var(--glass-elevation),
    0 44px 90px -52px var(--screen-shadow);
  transform-origin: 50% 62%;
}
/* Arrives a little small and settles to full size as it reaches the middle of the screen
 * (--e comes from js/scroll.js; without it the frame is simply full size). */
.is-motion .screen {
  transform: scale(calc(0.86 + 0.14 * var(--e, 1)));
  will-change: transform;
}
.screen-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  background: #0d0f0e;
}
.screen-video:fullscreen {
  border-radius: 0;
}
/* The large play button: only while the film waits for the visitor (js/film.js unhides it). */
.film-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: clamp(64px, 8vw, 92px);
  aspect-ratio: 1;
  padding: 0 0 0 4px;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 0.2s var(--motion-ease);
  --liquid-body: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-tap-highlight-color: transparent;
}
.film-play .ico {
  width: 44%;
  height: 44%;
  color: var(--link);
}
.film-play:hover {
  --liquid-body: color-mix(in srgb, var(--surface) 94%, transparent);
}
.film-play:active {
  transform: translate(-50%, -50%) scale(0.96);
}
.film-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 18px;
  min-height: 44px;
  margin-top: 16px;
}
.film-ctl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
}
.film-ctl .ctl-label:not([data-when]) {
  display: block;
}
.film-sound {
  margin-right: 6px;
  padding-inline: 14px 18px;
}
.film-sound[aria-pressed="false"] .ico-sound-on,
.film-sound[aria-pressed="true"] .ico-sound-off,
.film-quiet :is(.ico-replay, .ico-full) {
  display: block;
}
/* Sound is on: the pill takes the selected look, like the product's chosen option. */
.film-sound[aria-pressed="true"] {
  --liquid-body: color-mix(in srgb, var(--selection-solid) 88%, transparent);
  color: var(--selection-ink);
}
.film-sound:hover {
  --liquid-body: color-mix(in srgb, var(--surface) 86%, transparent);
}
.film-sound[aria-pressed="true"]:hover {
  --liquid-body: var(--selection-solid);
}
.film-quiet {
  border-radius: 999px;
  color: var(--muted-strong);
}
.film-quiet:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.film-meta {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.4;
}
.film-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin-top: clamp(20px, 2.6vw, 30px);
}
.film-chip {
  padding: 8px 16px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: var(--glass-input-bg);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
/* While the dark frame passes under the floating header (js/film.js sets "over-film"), the
 * bar carries more body, so its glass keeps the page's sky tint instead of turning grey. */
.topbar {
  transition: background-color 0.3s ease;
}
.over-film .topbar {
  background-color: color-mix(in srgb, var(--surface) 92%, transparent);
}

/* ── 7. Introduction ─────────────────────────────────────────────────────────
 * Everything above attracts; from here on the page explains. A hairline with the brand mark
 * says so without another headline. */
.intro {
  padding-top: clamp(56px, 7vw, 100px);
}
.intro-rule {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: clamp(36px, 4.6vw, 60px);
}
.intro-rule::before,
.intro-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--glass-line);
}
.intro-rule .brand-symbol {
  width: 28px;
  height: 28px;
  border-radius: 10px;
}
.intro-rule .brand-symbol svg {
  width: 15px;
  height: 15px;
}
.lede-sm code {
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-strong);
  font-size: 0.86em;
}
/* The explaining part answers the scroll too, quietly: each block rises into place as it
 * enters (--e from js/scroll.js: 0 at the bottom edge of the screen). It is fully there once
 * about a quarter of the way in, and at once when keyboard focus lands inside it. Without the
 * engine --e is absent and everything is simply in place. */
.is-motion [data-enter="rise"] {
  --in: clamp(0, calc(var(--e, 1) * 2.6 - var(--late, 0)), 1);
  opacity: clamp(0, calc(var(--e, 1) * 4.6 - var(--late, 0) * 1.8), 1);
  transform: translate3d(0, calc((1 - var(--in)) * (1 - var(--in)) * 48px), 0);
}
.is-motion [data-enter="rise"]:focus-within {
  opacity: 1;
  transform: none;
}
/* The wallet's spend bars fill as the panel comes up, and the opened receipt shows its
 * fields one after another. */
.is-motion .ledger .limit-fill {
  transform: scaleX(calc(var(--used, 0.3) * clamp(0, calc(var(--e, 1) * 2.2 - 0.5), 1)));
}
.is-motion .receipt .field {
  opacity: clamp(0, calc(var(--e, 1) * 4 - 1.1 - var(--nth, 0) * 0.3), 1);
}
.field:nth-child(2) {
  --nth: 1;
}
.field:nth-child(3) {
  --nth: 2;
}
.field:nth-child(4) {
  --nth: 3;
}
@media (min-width: 940px) {
  /* side by side: the second and third follow the first */
  :is(.step, .panel):nth-child(2) {
    --late: 0.16;
  }
  .step:nth-child(3) {
    --late: 0.32;
  }
}

/* ── 8. Sizes and preferences ────────────────────────────────────────────── */
@media (max-width: 1039.98px) {
  /* Three narrower columns: the amount is the receipt; the app name is in the lens. */
  .rcp-field {
    width: min(100%, 640px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 clamp(6px, 1.6vw, 14px);
  }
  .rcp .rc-app {
    display: none;
  }
  .rcp .rc-face {
    justify-content: center;
    gap: 7px;
    padding-inline: 10px;
  }
  .rcp .rc-amt {
    margin-left: 0;
  }
  .rcp-lens {
    width: min(100%, 340px);
  }
}
@media (max-width: 899.98px) {
  /* A shorter track: the pills that stay outside rest in two rows (three, then two). */
  .lim-stage {
    --rows: 2;
    --pw: min(150px, (100vw - 2 * var(--gutter) - 38px) / 3);
  }
  /* The lanes are too close here for one pill to pass another: they all travel at one speed. */
  .lim-pills .rq.is-in {
    --d: 0.3;
  }
  .rq:nth-child(13) {
    --at: 0.5;
    --from: 0.5;
  }
  .rq:nth-child(14) {
    --at: 0.835;
    --from: 0.835;
  }
  .rq:nth-child(15) {
    --at: 0.165;
    --from: 0.165;
  }
  /* The last two stop under the first row instead of going through it. */
  .rq:nth-child(16) {
    --at: 0.6675;
    --from: 0.6675;
    --row: 1;
    --stop: calc(var(--rest) - 8px);
  }
  .rq:nth-child(17) {
    --at: 0.3325;
    --from: 0.3325;
    --row: 1;
    --stop: calc(var(--rest) - 8px);
  }
}
@media (max-width: 720px) {
  /* Phones: no large blurred surfaces (the header bar keeps its own). */
  .lim-track.glass-blur {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .lim-track {
    background: var(--glass-panel-wash), color-mix(in srgb, var(--surface) 78%, transparent);
  }
  .lim-stage {
    --th: clamp(54px, 8vh, 72px);
    --ph: clamp(34px, 5vh, 44px);
    --gap: 16px;
  }
  .rq-face {
    font-size: clamp(12px, 3.4vw, 14px);
  }
  .lim-chip {
    min-width: 0;
    padding-inline: 10px;
  }
  /* Receipts: two columns, and the lens docks at the bottom. Receipts come up out of the
   * glass, so nothing ever passes behind the read-out; the reading line runs through the
   * lens. Without blur the lens is solid. */
  .rcp-stage {
    --slot: clamp(46px, 6.4vh, 58px);
    --lens-h: calc(var(--slot) * 3);
    --line: calc(100% - var(--lens-h) / 2);
  }
  .rcp-view {
    height: calc(var(--slot) * 8.4);
  }
  .rcp-field {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 10px;
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0,
      #000 14%,
      #000 calc(100% - var(--lens-h) - var(--slot) * 0.7),
      transparent calc(100% - var(--lens-h) + 4px)
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0,
      #000 14%,
      #000 calc(100% - var(--lens-h) - var(--slot) * 0.7),
      transparent calc(100% - var(--lens-h) + 4px)
    );
  }
  .rcp-b {
    -webkit-mask-image: none;
    mask-image: none;
  }
  .rcp-c,
  .rcp-line {
    display: none;
  }
  .rcp-lens {
    --liquid-body: var(--surface);
    width: 100%;
  }
  .act-scene .rcp-lens::before {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .rcp .rc-face {
    font-size: 13.5px;
  }
  .rcp .rc-tick {
    width: 16px;
    height: 16px;
  }
  .rcp-big {
    font-size: 2.875rem;
  }
  .rcp-id {
    margin-top: 12px;
  }
  /* The film runs closer to the edges of the screen. */
  .film-stage {
    width: min(100% + 2 * (var(--gutter) - 8px), (100vh - 180px) * 16 / 9);
    width: min(100% + 2 * (var(--gutter) - 8px), (100svh - 180px) * 16 / 9);
  }
  .screen {
    padding: 4px;
    border-radius: 18px;
  }
  .screen-video {
    border-radius: 14px;
  }
  .film-chip {
    font-size: 14.5px;
  }
}
@media (max-width: 720px) and (min-height: 560px) {
  .is-motion .rcp-view {
    height: 100%;
  }
}
@media (max-width: 400px) {
  .lim-head .sim-flag {
    flex-basis: 100%;
  }
  .rcp .rc-face {
    font-size: 13px;
  }
}
@media (max-width: 350px) {
  .lim-chip {
    padding-inline: 8px;
  }
  .lim-k {
    font-size: 11px;
  }
  .rcp .rc-face {
    padding-inline: 8px;
    font-size: 12.5px;
    letter-spacing: -0.02em;
  }
  .rcp-big {
    font-size: 2.5rem;
  }
  .film-chip {
    padding-inline: 13px;
    font-size: 14px;
  }
}
@media (prefers-color-scheme: dark) {
  .film {
    --screen-shadow: rgb(0 0 0 / 62%);
  }
}
@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  .lim-track {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .rcp-lens {
    --liquid-body: var(--surface);
  }
  .act-scene .rcp-lens::before {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .rcp-field,
  .rcp-b {
    -webkit-mask-image: none;
    mask-image: none;
  }
}
@media (forced-colors: active) {
  .lim-fill {
    background: Highlight;
  }
  .lim-mark,
  .lim-chip,
  .film-chip,
  .rcp-lens {
    border-color: CanvasText;
  }
  .rcp-line,
  .lim-chip.is-on::after {
    background: CanvasText;
  }
}
