/* The mobile call and quote buttons stay separate from the scrolling page. */
@media (max-width: 739.98px) {
  /* env() is read at every use site, never through a custom property.

     Safari does not reliably resolve env() stored in a var: it falls back to
     the 0px default, while Chrome resolves it. That is exactly how this
     presented, correct on Chrome for Android and wrong on an iPhone, with the
     banner sitting at top: 0 under the status bar and the strip below
     collapsing to nothing.

     The repetition is the point. Do not fold these back into a variable. */
  .callbar {
    --floating-cta-gutter: clamp(16px, 5vw, 24px);
    --floating-cta-column: calc(50vw - var(--floating-cta-gutter) - 6px);
    --floating-cta-width: calc(var(--floating-cta-column) * .9 - 4px);
    --floating-cta-inset: calc(var(--floating-cta-gutter) + var(--floating-cta-column) * .05 + 2px);
    --floating-cta-center-shift: calc((100vw - var(--floating-cta-width)) / 2 - var(--floating-cta-inset) - 3px);
    /* One beat of the entrance choreography. `STAGE_BEAT_MS` in script.js
       sequences the beats against this number and must be changed with it,
       or the next beat starts before this one has landed. */
    --floating-cta-beat: 1.25s;
    /* One curve for every beat and both buttons: a smooth deceleration into
       place, gentler than the easeOutQuint this once ran, which covered 42%
       of the distance in its first 100ms and read as a snap.

       Used by the entrance and the rejoin, where the call button is visible
       for the whole move, so the easing is read directly as motion. */
    --floating-cta-slide: cubic-bezier(.33, 1, .68, 1);
    /* The separation is linear, and that is not an oversight.

       What the eye tracks in that beat is not a button travelling - it is the
       quote button being *uncovered*, and the uncovering finishes early: the
       pair separates 176px in total but the quote is fully exposed once they
       are its own width apart, 148px, which is 84% of the travel. Any ease-out
       reaches 84% in under half the beat, so the whole reveal was crammed into
       the front of the move and then nothing happened for the rest of it. That
       is what read as a pop, and why easing it harder only made it worse.

       Measured over the exposed width rather than the transform, worst reveal
       in any 150ms window: ease-in-out 41%, easeOutCubic 38%, linear 16%, and
       the reveal spans 1044ms of the 1250ms beat instead of 578ms. For
       reference the call button's own entrance, which reads as smooth, runs at
       29%. Linear is the only curve that spreads the reveal across the beat.

       It is not applied to the entrance: there the call button is visible
       throughout and linear would look mechanical, and its two axes must share
       one curve or they desync (see the note further down). */
    --floating-cta-part: linear;
    position: static;
    display: contents;
    background: transparent;
    box-shadow: none;
  }
  .callbar a {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    left: calc((100vw - var(--floating-cta-width)) / 2);
    width: var(--floating-cta-width);
    min-height: 58px;
    z-index: 71;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-dark);
    background: var(--ink);
    clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
    translate: 0 calc(100% + env(safe-area-inset-bottom, 0px) + 24px);
    visibility: hidden;
    transition: transform var(--floating-cta-beat) var(--floating-cta-slide),
      translate var(--floating-cta-beat) var(--floating-cta-slide),
      background-color .65s ease-in-out,
      color .65s ease-in-out,
      visibility 0s linear var(--floating-cta-beat);
  }
  /* Stage two. `transform` is the horizontal separation and takes the linear
     curve; `translate` is the vertical lift and keeps the slide curve. Both
     buttons move apart on the same curve so the split stays symmetric. */
  .callbar.is-on a {
    translate: 0 0;
    visibility: visible;
    transition: transform var(--floating-cta-beat) var(--floating-cta-part),
      translate var(--floating-cta-beat) var(--floating-cta-slide),
      background-color .65s ease-in-out,
      color .65s ease-in-out,
      visibility 0s;
  }
  /* `.callbar a` above also sets z-index, and at (0,1,1) it outranks a lone
     class, so the 72 this rule used to carry never actually applied: both
     buttons computed to 71 and paint order fell through to DOM order, putting
     the quote button *over* the call button. Sliding out from under it was
     geometrically impossible, which the old opacity fade hid. Matching that
     selector's shape puts the call button genuinely on top. */
  .callbar a.callbar-call {
    z-index: 72;
    background: var(--ink);
    transform: translateX(calc(0px - var(--floating-cta-center-shift)));
  }
  .callbar.is-over-footer .callbar-call {
    background: var(--white);
    color: var(--black);
  }
  .callbar a.callbar-quote {
    background: var(--floating-quote);
    color: var(--on-dark);
  }
  .callbar-quote {
    /* Resting position is the call button's, not its own: the quote rides
       directly underneath it until the separation beat. See the note on
       `.callbar.is-on:not(.is-call-only) .callbar-quote` below. */
    transform: translateX(calc(0px - var(--floating-cta-center-shift)));
    opacity: 1;
    visibility: visible;
  }
  /* Stage two, the quote emerging, and the only state in which it has a
     position of its own.

     The quote is never hidden by opacity or visibility while the bar is up -
     it is hidden by being *covered*, sitting exactly under the call button
     with the same box, the same clip and one z-index below. So the only
     property this beat animates is transform, and the reveal is the quote
     being uncovered as the pair slides apart.

     That matters for more than tidiness. Flipping visibility and changing
     transform in the same frame is a transition Safari does not reliably
     interpolate: it lands the element at its final position instead of
     sliding it, which is exactly how this presented - the quote appeared
     already in place beside the call button rather than sliding out from
     under it. The way back up never had the bug because the quote stayed
     visible throughout and only transform moved. This makes the way down
     identical to the way back up. Do not reintroduce an opacity or
     visibility change on this element while `is-on` is set. */
  .callbar.is-on:not(.is-call-only) .callbar-quote {
    transform: translateX(var(--floating-cta-center-shift));
  }
  .callbar.is-on .callbar-quote {
    transition: transform var(--floating-cta-beat) var(--floating-cta-part),
      translate var(--floating-cta-beat) var(--floating-cta-slide),
      visibility 0s;
  }
  .callbar.is-call-only .callbar-call { transform: translateX(0); }
  /* The entrance moves the call button on two axes at once: `translate` lifts
     it off the bottom edge while `transform` carries it from the left inset to
     the centre. Both must ride the same curve or the two axes finish at wildly
     different times - with translate on easeOutQuint and transform on
     easeInOut the button was 95% of the way up while only 42% of the way
     across, so it read as a fast pop upward followed by a slow sideways
     crawl rather than one diagonal glide. Every beat now shares that curve,
     so this rule no longer differs from the base one in timing; it is kept
     because it is the natural place to change the entrance alone, and
     because dropping it would silently re-expose the two-axis desync if the
     base transition is ever edited. */
  .callbar.is-on.is-call-only .callbar-call {
    transition: transform var(--floating-cta-beat) var(--floating-cta-slide),
      translate var(--floating-cta-beat) var(--floating-cta-slide),
      background-color .65s ease-in-out,
      color .65s ease-in-out,
      visibility 0s;
  }
  /* Stage one: tucked under the call button, both at the centre. It stays
     visible and opaque here and is simply covered. `pointer-events` keeps it
     from taking taps through the call button; script.js pairs this with
     aria-hidden and tabindex so it leaves the accessibility tree too, which
     `visibility: hidden` used to do on its own. */
  .callbar.is-call-only .callbar-quote {
    pointer-events: none;
    transform: translateX(0);
  }
  /* Entrance and rejoin: the quote must track the call button exactly. Any
     difference in curve or duration between these two elements and they drift
     apart mid-beat, uncovering the quote while it is meant to be hidden. */
  .callbar.is-on.is-call-only .callbar-quote {
    transition: transform var(--floating-cta-beat) var(--floating-cta-slide),
      translate var(--floating-cta-beat) var(--floating-cta-slide),
      visibility 0s;
  }

  /* Only while JS runs explicit separation keyframes. The iPhone capture
     showed the CSS transform transition running while its painted result
     jumped to the endpoint. Do not let that transition compete with WAAPI.
     Removing this class restores the existing entrance/rejoin transitions. */
  .callbar.is-on.is-separating a {
    transition: translate var(--floating-cta-beat) var(--floating-cta-slide),
      background-color .65s ease-in-out, color .65s ease-in-out, visibility 0s;
  }

  /* Both entrance axes are explicit pixel keyframes. The quote follows the
     same path underneath Call Now, including on the first reveal after load. */
  .callbar.is-on.is-call-only.is-entering a {
    transition: background-color .65s ease-in-out, color .65s ease-in-out, visibility 0s;
  }

  @media (max-width: 289.98px) {
    .callbar a,
    .callbar.is-on a {
      left: 16px;
      width: calc(100vw - 32px);
      transform: none;
      clip-path: none;
    }
    /* The buttons stack at this width instead of sitting side by side, so none
       of the horizontal choreography applies. These selectors exist only to
       outrank the stage rules above, which carry up to four classes: without
       them the quote keeps its separation shift and sits 62px off the stacked
       column. Spelled out rather than left to source order so reordering this
       file cannot quietly break the layout. */
    .callbar a.callbar-call,
    .callbar.is-call-only a.callbar-call,
    .callbar.is-on.is-call-only a.callbar-quote,
    .callbar.is-on:not(.is-call-only) a.callbar-quote,
    .callbar.is-call-only a.callbar-quote { transform: none; }
    /* With the buttons stacked the quote is never covered by the call button,
       so occlusion cannot hide it during the call-only stage and it has to be
       hidden outright. Safe here precisely because nothing slides at this
       width: the Safari interpolation problem that banished opacity from the
       wider layout needs a transform change in the same frame, and there is
       none. A short fade is the right reveal when there is no motion. */
    .callbar.is-call-only a.callbar-quote {
      opacity: 0;
      visibility: hidden;
    }
    .callbar.is-on a.callbar-quote {
      transition: opacity .35s ease, visibility 0s;
    }
    .callbar.is-on.is-call-only a.callbar-quote {
      transition: opacity .35s ease, visibility 0s linear .35s;
    }
    .callbar a.callbar-quote {
      bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    }
    .callbar a.callbar-call {
      bottom: calc(env(safe-area-inset-bottom, 0px) + 90px);
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .callbar a,
    .callbar.is-on a { transition: none; }
    .callbar.is-on a { translate: 0 0; }
  }
}
