/* GIVING MOTION - the applied motion for giving.html: desktop from 900px
   (this part) and the phone below it (PHONE, the last section).
   100-motion-design/motion-guidance.md explains it.

   DESKTOP, from 900px. The selection work behind
   it is in 100-motion-design/giving/combined/, where this file is
   selected-motion.css with preview paths; its README.md records the combining
   rules and picker.json lists the selections. Paths below that start with
   ../proposals/ are relative to that folder. Cheyne's picks:
   1. Hero: proposal 2026-10-31-a's Hero push and Hero settle, unchanged
      (held from the photo's lower-right corner; still on scroll).
   2. Thank you for giving: proposal 2026-10-31-c's band, unchanged. The
      photo rises 48px (Photo rise with Photo light, Home's values); the
      rule, heading and sentence arrive 220ms after it (Copy arrival).
   Everything else on the page is still.

   The head gate in giving.html adds pilot-intro-pending and sel-on at 900px
   and up without reduced motion; giving-motion.js adds pilot-settle-run
   (hero) and sel-ready (below the hero). Without those classes the page is
   the still baseline.

   Sources: the hero rules below are ../proposals/2026-10-31-a/
   giving-motion.css, unchanged. The waiting poses are C's Copy arrival and
   Photo rise rules (../proposals/2026-10-31-c/giving-motion.css),
   unchanged; C's Gathering rhythm and Crest bearing rules are left out
   (GIVE-02 is still). */

/* ---- Hero push and Hero settle: Plan Your Visit's, About's, Connect
   Groups' and Events' values, unchanged.

   Anchor: the library frames this photo from calc(50% + 80px)
   calc(35% + 20px) of the photo box, which is also the scale's origin. For
   a scale s about origin O, translating by (1 - s) times a point's offset
   from O holds that point. object-fit crops the picture to the photo box,
   so any push smaller than 1 opens a gap on some side. Here the anchor holds
   the box's bottom-right corner, whose offset from the origin is
   calc(50% - 80px) across and calc(65% - 20px) down at every width: the
   right edge (no scrim) and the bottom edge (on the red rule) never open.
   The gap opens only at the left, 7% of the hero's width (about 101px at
   1440), inside the left scrim's solid black (14%), and at the top, 7% of
   its height (about 50px), under the top scrim's black shoulder, over the
   hero's own ink ground. The kneeling young woman and the cross grow toward
   their place, moving about 45px up and toward the words as the room closes
   in around them. */
:root {
  --hero-push-from: 0.93;
  --hero-push-duration: 2.4s;
  --hero-push-ease: cubic-bezier(0.2, 0.55, 0.4, 0.92);
  --hero-anchor-x: calc(50% - 80px);
  --hero-anchor-y: calc(65% - 20px);
  --hero-text-start: 0.6s;
  --hero-text-offset: 0s;
  --hero-text-ease: var(--hero-push-ease);
  --pilot-settle-start: var(--hero-text-start);
  --pilot-settle-stagger: 80ms;
  --pilot-settle-duration: calc(var(--hero-push-duration) + var(--hero-text-offset) - var(--hero-text-start) - 2 * var(--pilot-settle-stagger));
  --pilot-settle-scale: 1.08;
  --pilot-settle-blur: 8px;
  --pilot-settle-ease: var(--hero-text-ease);
}
@property --hero-arrive {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}
.pilot-intro-pending .cc-hero__photo { --hero-arrive: var(--hero-push-from); }
.pilot-intro-pending .cc-hero__photo,
.sel-on .cc-hero__photo {
  transform: scale(var(--hero-arrive));
  translate: calc((1 - var(--hero-arrive)) * var(--hero-anchor-x)) calc((1 - var(--hero-arrive)) * var(--hero-anchor-y));
}
.pilot-settle-run .cc-hero__photo {
  animation: hero-push var(--hero-push-duration) var(--hero-push-ease) both;
}
@keyframes hero-push {
  from { --hero-arrive: var(--hero-push-from); }
  to { --hero-arrive: 1; }
}
.pilot-intro-pending .cc-hero__body > * { opacity: 0; }
.pilot-settle-run .cc-hero__body > * {
  transform-origin: left center;
  animation: pilot-settle var(--pilot-settle-duration) var(--pilot-settle-ease) both;
  animation-delay: calc(var(--pilot-settle-start) + var(--pilot-beat, 0) * var(--pilot-settle-stagger) - var(--pilot-clip-at, 0s));
}
.cc-hero__body > .cc-eyebrow,
.cc-hero__body > .cc-hero__title { --pilot-beat: 0; }
.cc-hero__body > .cc-hero__lead { --pilot-beat: 1; }
.cc-hero__body > .cc-hero__actions { --pilot-beat: 2; }
@keyframes pilot-settle {
  from { opacity: 0; scale: var(--pilot-settle-scale); filter: blur(var(--pilot-settle-blur)); }
  to { opacity: 1; scale: 1; filter: blur(0); }
}

/* ---- Below the hero. giving-motion.js plays every entrance as Web
   Animations with fill "backwards" and adds .sel-shown in the frame it
   starts, so a finished element is the library's own rendering. These
   rules hold only the waiting poses; each matches its first keyframe. */
@media (min-width: 900px) {

  /* Copy arrival: words wait unseen; the rule waits undrawn. */
  .sel-on [data-sel]:not(.sel-shown) {
    opacity: 0;
  }
  .sel-on [data-sel="rule-c"]:not(.sel-shown) {
    opacity: 1;
    transform: scaleX(0);
    transform-origin: left center;
  }

  /* Photo rise (GIVE-07), with Photo light: the frame waits partly
     visible, 48px low. */
  .sel-on [data-sel="photo-rise"]:not(.sel-shown) {
    opacity: 0.35;
    translate: 0 48px;
  }
}

/* ============================================================================
   PHONE, below 900px. The selection work behind it is in
   100-motion-design/giving/combined-mobile/, where this section is
   user-picks-motion.css (loaded by its user-picks.html, the composition
   applied here); its README.md records the composition and its combining
   rules. Base: proposal 2026-11-04-mobile-a; substitutions: proposal
   2026-11-04-mobile-d's Check draw on the "You can:" checks (D's values and
   mask under this section's gma- prefix) and proposal 2026-11-04-mobile-c's
   Thank you start (the waiting photo's top at the part line, its picture
   fetched two views ahead), on A's curves, values and photo wait, and
   proposal 2026-11-04-mobile-b's Soft title rise on the Give heading
   (section 1b, the family's phone values unchanged).

   Gating: every rule needs html.gma-on, set by the head gate in giving.html
   below 900px without reduced motion and removed by its fail-safe if the
   phone runtime in giving-motion.js never starts. Every rule also sits below
   900px. The checks also need html.gma-checks-wait, which the gate adds only
   where registered custom properties exist. The desktop rules above (sel-on,
   pilot- classes) are untouched; their hero values are reused here:
   @property --hero-arrive, @keyframes hero-push and the --hero-push-*
   properties on :root.

   ONE PLACE FOR VALUES. Every timing, easing, distance and waiting light the
   phone treatments use is on :root below; the PHONE part of giving-motion.js
   reads the ones it plays from here, so a waiting pose and its first
   keyframe cannot drift apart.

   Few movements, strong leads, with one practical answer:
   1. Kneeling at the cross (GIVE-01 hero photo): Hero push, held on the
      kneeling young woman at the foot of the cross, with the Give heading
      (which stands in for the hero title the phone hides) lighting and
      rising behind a still mask on the push's curve (Soft title rise).
      Header, rule, paragraph and words of the Give through Commission
      Church band are still.
   2. The "You can:" checks: each tick draws in its ring, top to bottom,
      once the hero has had its moment (the family's hero release). Words
      stay still.
   3. Thank you for giving (GIVE-07): the worship photo rises into place
      (Photo rise with Photo light) as it enters the view; the rule
      draws and the heading and sentence arrive (Copy arrival) as they
      enter, never sooner than the copy lead after the photo.
   Questions about giving, the buttons, the footer and the header are still.
   ============================================================================ */
/* Check draw (from D): the tick's wipe edge. Registered so it animates;
   outside @media, as @property must be. */
@property --gma-tick {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 100%;
}

@media (max-width: 899.98px) {

  :root {
    /* Family curves (home-motion.js; giving-motion.js). */
    --gma-light-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --gma-travel-ease: cubic-bezier(0.33, 1, 0.68, 1);
    --gma-copy-ease: cubic-bezier(0.22, 0.61, 0.36, 1);   /* C */

    /* Hero push anchor: the kneeling young woman at the foot of the cross,
       at 61.5% across and 75% down the photo box. Offsets are from the
       library's phone focal origin, calc(79% + 10px) calc(35% + 35px),
       which is also the scale's origin. */
    --gma-hero-anchor-x: calc(61.5% - 79% - 10px);
    --gma-hero-anchor-y: calc(75% - 35% - 35px);

    /* Hero clock (the family's phone values), in ms. */
    --gma-hero-photo-wait: 700;   /* the Give heading starts no later than
                                     this, even if the hero photo is late */
    --gma-hero-release: 1500;     /* parts in view beside the arriving hero
                                     (the ticks, the Thank you band) wait
                                     this long after both the push and the
                                     heading start */

    /* Soft title rise (B's: Plan Your Visit's, About's, Connect Groups'
       and Events' phone values, unchanged), on the Give heading. */
    --gma-title-start: 0.25s;
    --gma-title-duration: 2s;
    --gma-title-ease: var(--hero-push-ease);
    --gma-title-room: 0.18em;     /* descenders and side bearings */
    --gma-title-travel: 0.45em;
    --gma-title-light-ms: 0.7s;

    /* Band moment (phone, C's start): the photo plays as its waiting top
       (48px low) passes the part line, on entering; the words as their top
       passes the same line, no sooner than the copy lead after the photo
       starts (giving.html data-sel-copy-lead). The picture is fetched this
       many views ahead so it is ready at the earlier start. */
    --gma-part-at: 0.92;
    --gma-copy-lead: 220;
    --gma-photo-preload: 2;       /* views ahead (C's) */
    --gma-photo-wait: 600;        /* longest wait for the photo's pixels (A's) */

    /* Photo rise with Photo light (Home's and Giving desktop's values, but
       a longer lift: 1.5s, not 1.2s, so the photo is still rising as the
       words start at C's later line, as in A). */
    --gma-photo-light-from: 0.35;
    --gma-photo-light-ms: 700;
    --gma-photo-rise: 48;         /* px */
    --gma-photo-rise-ms: 1500;

    /* Copy arrival (Giving desktop's and Events phone values). */
    --gma-rule-ms: 640;
    --gma-copy-rise: 14;          /* px */
    --gma-copy-ms: 820;
    --gma-copy-blur: 5;           /* px, heading only */
    --gma-copy-text-after: 130;   /* sentence after the heading */

    /* Check draw (D's values). The first tick waits for the hero release
       (above) and never draws sooner than the beat after the runtime starts;
       later ticks follow at the step, each once its row is above the part
       line. The wipe runs from just before the tick to just past it. */
    --gma-tick-beat: 700;         /* ms */
    --gma-tick-step: 450;         /* ms between tick starts */
    --gma-tick-ms: 380;
    --gma-tick-ease: cubic-bezier(0.65, 0, 0.35, 1);
    --gma-tick-from: 28%;
    --gma-tick-to: 72%;
  }

  /* ---- 1. Hero push (reused): the photo waits slightly small and pushes
     in to its framing on the family's curve and length. The translate holds
     the anchor: for the push s about the scale's origin, (1 - s) times the
     anchor's offset from that origin. At 360 to 899px wide the start pose
     keeps the right and bottom edges filled; the top, under the black
     shoulder of the top scrim, opens about 14px more than at rest. Still on
     scroll. */
  .gma-on.gma-hero-photo-wait .cc-hero__photo {
    --hero-arrive: var(--hero-push-from);
  }
  .gma-on.gma-hero-photo-wait .cc-hero__photo,
  .gma-on.gma-hero-photo-run .cc-hero__photo {
    transform: scale(var(--hero-arrive));
    translate: calc((1 - var(--hero-arrive)) * var(--gma-hero-anchor-x)) calc((1 - var(--hero-arrive)) * var(--gma-hero-anchor-y));
  }
  .gma-on.gma-hero-photo-run .cc-hero__photo {
    animation: hero-push var(--hero-push-duration) var(--hero-push-ease) both;
  }

  /* ---- 1b. Soft title rise (from B) on the Give heading, which stands in
     for the hero title the phone hero withholds. It waits blank from first
     paint (the gate's gma-hero-words-wait), then lights quickly and rises
     behind a still mask at its foot on the push's curve, resting as the
     picture rests. The paragraph, You can:, the foot and Give Online are
     still from first paint. */
  .gma-on.gma-hero-words-wait #giving-recommended-title,
  .gma-on.gma-hero-words-run #giving-recommended-title {
    opacity: 0;
    translate: 0 var(--gma-title-travel);
    clip-path: inset(calc(-1 * var(--gma-title-room)) calc(-1 * var(--gma-title-room)) calc(var(--gma-title-travel) - var(--gma-title-room)) calc(-1 * var(--gma-title-room)));
  }
  .gma-on.gma-hero-words-run #giving-recommended-title {
    animation:
      gma-title-rise-soft var(--gma-title-duration) var(--gma-title-ease) var(--gma-title-start) both,
      gma-title-light var(--gma-title-light-ms) var(--gma-light-ease) var(--gma-title-start) both;
  }
  @keyframes gma-title-rise-soft {
    from {
      translate: 0 var(--gma-title-travel);
      clip-path: inset(calc(-1 * var(--gma-title-room)) calc(-1 * var(--gma-title-room)) calc(var(--gma-title-travel) - var(--gma-title-room)) calc(-1 * var(--gma-title-room)));
    }
    to {
      translate: 0 0;
      clip-path: inset(calc(-1 * var(--gma-title-room)) calc(-1 * var(--gma-title-room)) calc(-1 * var(--gma-title-room)) calc(-1 * var(--gma-title-room)));
    }
  }
  @keyframes gma-title-light {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  /* ---- 2. Thank you for giving. The PHONE part of giving-motion.js adds
     .gma-shown when an entrance starts (photo) or has finished (words), or
     at once when a part rests unseen. */

  /* Photo rise with Photo light: the frame waits partly visible, 48px low.
     Its picture stays hidden until decoded (.gma-img-ready), so a late or
     progressive load never shows inside the waiting frame. */
  .gma-on [data-sel-band] [data-sel="photo-rise"]:not(.gma-shown) {
    opacity: var(--gma-photo-light-from);
    translate: 0 calc(var(--gma-photo-rise) * 1px);
  }
  .gma-on [data-sel-band] [data-sel="photo-rise"]:not(.gma-shown):not(.gma-img-ready) img {
    visibility: hidden;
  }

  /* Copy arrival: the words wait unseen, the rule undrawn. */
  .gma-on [data-sel-band] :is([data-sel="title-c"], [data-sel="text-c"]):not(.gma-shown) {
    opacity: 0;
  }
  .gma-on [data-sel-band] [data-sel="rule-c"]:not(.gma-shown) {
    transform: scaleX(0);
    transform-origin: left center;
  }

  /* ---- 3. Check draw (from D): each "You can:" check waits as its empty
     ring; the tick is then wiped in left to right, which is its pen order
     (the path's x only increases), one row at a time from the top. The
     library icon keeps its own mask (check-circle.svg); its holder gets a
     mask of a ring-keeping radial gradient plus a left-to-right wipe, so the
     ring always shows and the wipe alone reveals the tick. Gradients only:
     the wait needs no file. When a row is ticked the holder's mask drops. */
  .gma-on.gma-checks-wait [data-gma-checks] > .cc-info-list__item:not(.gma-ticked) > .cc-info-list__icon {
    --gma-tick: var(--gma-tick-from);
    -webkit-mask-image: radial-gradient(circle closest-side, transparent 57%, #000 61%),
      linear-gradient(to right, #000 var(--gma-tick), transparent var(--gma-tick));
    mask-image: radial-gradient(circle closest-side, transparent 57%, #000 61%),
      linear-gradient(to right, #000 var(--gma-tick), transparent var(--gma-tick));
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
  }
}
