/* Pricing — matches Website Screens/Pricing (Desktop 1–7 at 1440px, Mobile 1–7 at 410px).
   js/pricing.js drives it from the scroll position:
     the photo layer's scale (grows 60% → 90% as the section arrives, then keeps
                 growing while the park photo opens up)
     each photo's position (hover parallax by its depth --d, plus the fly-through)
     line opacity (the paragraph lights up line by line, top to bottom)
     the paragraph splitting and the park photo growing to fill the screen */

.pricing {
  --pricing-gutter: clamp(24px, 4.45vw, 64px);
  --pt-size: clamp(34px, 3.472vw, 58px); /* 50px at 1440px wide */

  position: relative;
  height: calc(100vh + var(--beats, 4) * 75vh);
  background: var(--green);
  color: var(--beige);
}

.pricing__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh; /* the full screen with the browser bars hidden, so no gap opens at the
                     bottom when they slide away while you scroll on a phone */
  overflow: hidden;
}

/* ---------- Background photos ---------- */

.pricing__photos {
  position: absolute;
  inset: 0;
  transform: scale(0.6); /* set each frame by js/pricing.js */
  will-change: transform;
  transform-origin: 50% 50%;
  perspective: 100vh;         /* for the fly-through when the park photo opens */
  perspective-origin: 50% 50%;
}

.pricing__photo {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  max-width: none;
  height: auto;
  aspect-ratio: var(--ar);
  object-fit: cover;
  /* Moved by js/pricing.js (parallax + fly-through). will-change keeps each photo
     on its own GPU layer, so growing it is cheap instead of redrawing it each frame */
  will-change: transform;
}

/* Round frame between the photos and the text: the background green, strong in
   the centre and fading to nothing toward the edges of the screen, so the photos
   look like they're emerging from the centre. It stays put (doesn't scale with
   the photos). */
.pricing__stage::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: radial-gradient(
    circle calc(max(46vw, 44vh) * 0.7) at 50% 50%,
    rgb(108 136 118 / 0.8) 0%,
    rgb(108 136 118 / 0.45) 45%,
    rgb(108 136 118 / 0.3) 75%,
    rgb(108 136 118 / 0) 100%
  );
  pointer-events: none;
}

/* "Get in touch" links land here: the postcard in place (top set by js/pricing.js) */
.pricing__contact-anchor {
  position: absolute;
  left: 0;
}

/* ---------- Title and paragraph ---------- */

.pricing__content {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: calc(100% - 2 * var(--pricing-gutter));
  max-width: 920px;
  /* Extra space underneath balances the title, so the paragraph sits at the centre */
  padding-bottom: calc(var(--pt-size) * 1.1 + 56px);
  transform: translate(-50%, -50%);
  text-align: center;
}

.pricing__title {
  margin: 0 0 56px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--pt-size);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.pricing__title {
  will-change: transform; /* moved up as the paragraph splits */
}

.pricing__title em {
  font-style: italic;
}

.pricing__text {
  max-width: 53ch;
  margin: 0 auto;
  font-family: var(--font-mono);
  font-size: clamp(15px, 1.84vw, 26px);
  line-height: 1.28;
  text-transform: uppercase;
}

/* Words are wrapped by the script so each line can fade and the halves can move */
.pricing__word {
  display: inline-block;
}

/* js/pricing.js wraps each line of the paragraph in one of these, then fades
   and moves whole lines (on the GPU) instead of every word */
.pricing__line {
  display: block;
  will-change: transform, opacity;
}

/* ---------- Park photo that opens up from the split ---------- */

.pricing__reveal {
  position: absolute;
  z-index: 2; /* above the round frame */
  inset: 0;   /* full screen; grows in by scaling up from 0 (cheap), not by resizing */
  overflow: hidden;
  opacity: 0;
  transform: scale(0);
  transform-origin: 50% 50%;
  will-change: transform;
}

.pricing__reveal img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* ---------- Phones and tablets ---------- */

@media (max-width: 959px) {
  .pricing {
    --pt-size: clamp(30px, 8.3vw, 44px);
    --m-photo-size: 1.2; /* phone photos 20% larger than the design, chosen with the slider */
  }

  .pricing__photo {
    left: var(--mx);
    top: var(--my);
    width: calc(var(--mw) * var(--m-photo-size, 1));
    aspect-ratio: var(--mar);
    /* grow each photo around its own centre */
    margin-left: calc(var(--mw) * (1 - var(--m-photo-size, 1)) / 2);
    margin-top: calc(var(--mw) / var(--mar) * (1 - var(--m-photo-size, 1)) / 2);
  }

  .pricing__photo--desktop {
    display: none;
  }

  .pricing__title {
    margin-bottom: 36px;
  }

  .pricing__content {
    padding-bottom: calc(var(--pt-size) * 1.1 + 36px);
  }

  .pricing__text {
    font-size: 15px;
    line-height: 22px;
  }
}
