/* ─────────────────────────────────────────────────────────────────────────
   Section: One Platform — four audience cards that stack as you scroll.

   BEHAVIOUR (ref: payjustnow.com/business), identical on every device.
   The section is a tall scroll runway containing ONE sticky element (the
   pin) that holds the whole deck. Cards sit inside it at fixed offsets, a
   band apart, and each rises into its slot over its own third of the
   pinned scroll. Scroll back up and it reverses.

   Why one sticky element and not four: making each card sticky meant every
   card pinned and unpinned at its own scroll position, so the gaps drifted,
   the last card never reached its slot, and the finished deck came apart
   from the bottom as it left. With a single pin, "the deck moves as one"
   is structural rather than something tuned, the gaps are fixed offsets
   that cannot drift, and the deck sits centred in the viewport instead of
   jamming the first card against the top.

   The motion is scroll-DRIVEN (animation-timeline), not timed: it follows
   the scrollbar, so scrolling fast moves fast and inching the wheel creeps.
   No JS, no scroll listener, no library.

   SIZING — one driver. --space-card-w is the card's width; every other
   measurement is a fixed ratio of it taken from the 900x600 Figma card, so
   the deck holds its exact proportions at every screen size. The width is
   capped three ways: the Figma 900px, the 1920px-canvas vw equivalent, and
   a vh cap so the assembled deck (0.967 x width) always fits the window.

   Capping the WIDTH is what keeps the proportions: an earlier pass capped
   the card's height alone, which on a wide, short window produced a 900x464
   card instead of 900x600 — visibly flattened. Never size the card's height
   off the viewport independently of its width.

   svh (small viewport height) rather than vh for the runway and pin: on
   mobile, vh grows when the URL bar hides, which would resize the pinned
   deck mid-scroll. svh is the stable value.

   Sticky breaks silently under ANY ancestor with overflow hidden/auto/
   scroll. Checked against main.css (its only overflow:hidden is inside
   .sr-only) — keep the section and page wrapper clear of it.

   Figma source: "Synemi Website (All Pages)" (nJoU040QHzVaE5H2P0q1YI),
   slide frames "Slide 1"–"Slide 4", card 900x600, padding l60/r180/b60,
   radius 50, band 90, heading 60. The .figma-cache manifest's 2003:5780 in
   rpxjqrtmweqJ7XFXDOhNLW is stale, as it was for old-model, built-for and
   made-for.
   ───────────────────────────────────────────────────────────────────────── */

.section-one-platform__stack {
  /* Mobile, from the Figma mobile slide: a 320x600 PORTRAIT card — not the
     900x600 landscape card desktop uses. Same single-driver approach, so
     the card keeps its 320:600 shape at any phone size: the width drives
     everything, and every other value is that width times its Figma ratio
     (headpad 30, padding l/r 28, padding-b 60, radius 30, all over 320).

     Every term of the width must be an absolute length — NOT 100%. This
     variable also feeds font-size calcs, where a percentage means "of the
     parent font size", so a 100% term silently collapsed all the card
     type. The column is the viewport minus the section's side padding.

     The svh term keeps the assembled deck on screen: the deck is 2.72x the
     width, so ~33.5svh is the most the width can be.

     Caveat: the band ratio is NOT from Figma. The mobile frame shows one
     slide, never the stack, so there is no measurement for how much of a
     card shows when stacked. 0.28125 of the width is 15% of the card's
     height — the same proportion desktop uses — so the two read alike. */
  --space-card-w: min(calc(100vw - 3rem), 88.9vw, 33.5svh);
  --space-card-band: calc(var(--space-card-w) * 0.28125);
  --space-card-expanded: calc(var(--space-card-w) * 1.875);
  --space-card-headpad: calc(var(--space-card-w) * 0.09375);
  --space-card-pad-l: calc(var(--space-card-w) * 0.0875);
  --space-card-pad-r: calc(var(--space-card-w) * 0.0875);
  --space-card-pad-b: calc(var(--space-card-w) * 0.1875);
  --radius-card-stack: calc(var(--space-card-w) * 0.09375);

  --space-deck-h: calc((3 * var(--space-card-band)) + var(--space-card-expanded));

  position: relative;
  display: block;
  width: 100%;

  /* The runway. One viewport per card: three of stacking, one to enter on.
     Its length is what the sequence is scrubbed against. */
  height: calc(4 * 100svh);

  /* Names a timeline over this element for the cards to animate against. */
  view-timeline-name: --section-one-platform;
  view-timeline-axis: block;
}

/* Mobile spacing. The pin stays a full viewport tall: shrinking it to its
   contents was a mistake, because a sticky box shorter than the viewport is
   parked at the BOTTOM of its container once its range ends, so all the
   leftover height collected above the cards as white space. Full height
   keeps the deck centred with the leftover split evenly, and the deck now
   fills ~91% of the screen so there is little leftover to see. */
@media (width < 64rem) {
  .section-one-platform__pin {
    padding-top: 0;
    padding-bottom: 0;
  }

  /* Overrides the partial's mt-8. Between the section's own gap-8 and that
     margin the copy sat ~64px clear of the first card before the pin's
     padding was even counted, which is far more air than the design wants
     at this size. */
  .section-one-platform__stack {
    margin-top: 0;
  }
}

/* The single sticky element holding the whole deck. */
.section-one-platform__pin {
  position: sticky;
  top: 0;
  display: flex;
  height: 100svh;
  align-items: center;
  justify-content: center;
}

.section-one-platform__deck {
  position: relative;
  width: var(--space-card-w);
  height: var(--space-deck-h);
}

/* Type and the description block, as Figma ratios of the card width, so
   they scale with the card instead of staying fixed while it shrinks.
   Mobile slide: heading 28/32, description card 16 padding / 24 radius,
   body 16/22, CTA 50 tall — all over the 320 card. */
.section-one-platform__title {
  font-size: calc(var(--space-card-w) * 0.0875);
  line-height: 1.143;
}

.section-one-platform__card {
  padding: calc(var(--space-card-w) * 0.05);
  border-radius: calc(var(--space-card-w) * 0.075);
  gap: calc(var(--space-card-w) * 0.05);

  /* Translucent, so the photograph reads through the card as in Figma.
     color-mix keeps this tied to the navy token rather than hardcoding a
     fifth navy. */
  background-color: color-mix(in srgb, var(--color-navy-bg) 88%, transparent);
}

.section-one-platform__card-text {
  font-size: calc(var(--space-card-w) * 0.05);
  line-height: 1.375;
}

.section-one-platform__card-cta {
  height: calc(var(--space-card-w) * 0.15625);
  max-width: 100%;
  font-size: calc(var(--space-card-w) * 0.05);
}

/* Cards sit at fixed offsets one band apart — every gap is exactly one
   band, the last included, because nothing depends on when a card happens
   to pin. DOM order gives paint order, so no z-index is needed. */
.section-one-platform__slide {
  position: absolute;
  top: calc(var(--space-card-index) * var(--space-card-band));
  left: 0;
  width: 100%;
  height: var(--space-card-expanded);
}

.section-one-platform__slide:nth-child(1) {
  --space-card-index: 0;
}

.section-one-platform__slide:nth-child(2) {
  --space-card-index: 1;
}

.section-one-platform__slide:nth-child(3) {
  --space-card-index: 2;
}

.section-one-platform__slide:nth-child(4) {
  --space-card-index: 3;
}

/* Each card rises into its slot over its own third of the pinned scroll.
   Card 1 is already in place. Movement only — no fade. */
@keyframes section-one-platform-rise {
  from {
    transform: translateY(100svh);
  }

  to {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .section-one-platform__slide:nth-child(2),
  .section-one-platform__slide:nth-child(3),
  .section-one-platform__slide:nth-child(4) {
    animation: section-one-platform-rise linear both;
    animation-timeline: --section-one-platform;
  }

  .section-one-platform__slide:nth-child(2) {
    animation-range: contain 0% contain 33.333%;
  }

  .section-one-platform__slide:nth-child(3) {
    animation-range: contain 33.333% contain 66.667%;
  }

  .section-one-platform__slide:nth-child(4) {
    animation-range: contain 66.667% contain 100%;
  }
}

/* ── The visible card ─────────────────────────────────────────────────── */

.section-one-platform__frame {
  position: relative;
  display: flex;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-white);
  border-radius: var(--radius-card-stack);

  /* Inset highlight, matching Figma's inset 0 4 4 rgba(255,255,255,0.25) */
  box-shadow: inset 0 4px 4px 0 rgb(255 255 255 / 25%);
}

.section-one-platform__media,
.section-one-platform__scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.section-one-platform__media {
  object-fit: cover;
}

.section-one-platform__scrim {
  background-color: rgb(0 0 0 / 20%);
}

/* Exactly one band tall, heading pinned at a fixed offset from the card's
   top edge. That keeps every heading fully legible in the sliver left
   showing by the card in front, and on the same line as its neighbours. A
   two-line heading has its second line covered while stacked and revealed
   as the card comes to the front. */
.section-one-platform__header {
  position: relative;
  height: var(--space-card-band);
  flex: none;
  padding-top: var(--space-card-headpad);
  padding-right: var(--space-card-pad-r);
  padding-left: var(--space-card-pad-l);
}

.section-one-platform__panel {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-end;
  padding-right: var(--space-card-pad-r);
  padding-bottom: var(--space-card-pad-b);
  padding-left: var(--space-card-pad-l);
}

/* ── Tablet and up ────────────────────────────────────────────────────────
   Everything below is a fixed ratio of --space-card-w, straight off the
   900x600 LANDSCAPE Figma card: band 90, headpad 15, padding l60/r180/b60,
   radius 50, heading 60, description card 596 wide with 34/26 padding,
   radius 30 and 20/26 text, CTA 250x60 at 18.

   Starts at 48rem (768px), not 64rem. The portrait 320x600 card in the base
   block is a PHONE design, and leaving this at 64rem handed it to tablets
   too — an 800px-wide iPad rendering a narrow portrait card. 768 is also
   the tablet boundary the design system itself records (Figma 1533:172:
   mobile <=767, tablet 768-1023, laptop 1024-1439, desktop 1440+), which
   nothing in this file observed before. */

@media (width >= 48rem) {
  .section-one-platform__stack {
    --space-card-w: min(56.25rem, 46.875vw, 95svh);
    --space-card-band: calc(var(--space-card-w) / 10);
    --space-card-expanded: calc(var(--space-card-w) / 1.5);
    --space-card-headpad: calc(var(--space-card-w) / 60);
    --space-card-pad-l: calc(var(--space-card-w) / 15);
    --space-card-pad-r: calc(var(--space-card-w) / 5);
    --space-card-pad-b: calc(var(--space-card-w) / 15);
    --radius-card-stack: calc(var(--space-card-w) / 18);
  }

  .section-one-platform__deck {
    width: var(--space-card-w);
  }

  .section-one-platform__title {
    font-size: calc(var(--space-card-w) / 15);
    line-height: 1.2;
  }

  .section-one-platform__card {
    width: calc(var(--space-card-w) / 1.51);
    max-width: 100%;
    padding: calc(var(--space-card-w) / 34.6) calc(var(--space-card-w) / 26.5);
    border-radius: calc(var(--space-card-w) / 30);
    gap: calc(var(--space-card-w) / 30);
  }

  .section-one-platform__card-text {
    font-size: calc(var(--space-card-w) / 45);
    line-height: calc(var(--space-card-w) / 34.6);
  }

  .section-one-platform__card-cta {
    height: calc(var(--space-card-w) / 15);
    max-width: calc(var(--space-card-w) / 3.6);
    font-size: calc(var(--space-card-w) / 50);
  }
}

/* ── Tablet width only ────────────────────────────────────────────────────
   The 1920-canvas vw share is too mean at tablet widths — 46.875vw is just
   360px at 768, a card barely wider than the phone one. Give the card more
   of the viewport here. Only the width changes: every other measurement is
   a ratio of it, so the card keeps its 900x600 shape. */

@media (width >= 48rem) and (width < 64rem) {
  .section-one-platform__stack {
    --space-card-w: min(56.25rem, 88vw, 95svh);
  }
}
