/* EVENTS MOTION - the applied motion for events.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/events/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. The head gate in events.html adds
   pilot-intro-pending and sel-on at 900px and up without reduced motion;
   events-motion.js adds pilot-settle-run (hero) and sel-ready (below the
   hero). Without those classes the page is the still baseline.

   Cheyne's picks:
   1. Hero arrival: Hero push and Hero settle, proposal 2026-10-31-a's,
      unchanged. The push is held on the young woman at the centre of the
      photograph (MADE NEW, 2 Corinthians 5:17).
   2. Regular gatherings: each list row lights as its top passes 92% of
      the view, 200ms apart at least (Gathering steps, R2). The rule,
      heading, sentence and View Events are still.
   The event cards have no entrance; their graphic answers hover and the
   Learn More button's keyboard focus (A's Linked media response). */

/* ---- Hero push and Hero settle: Plan Your Visit's, About's and Connect
   Groups' values, unchanged (120-website/site/connect-groups-motion.css).

   Anchor: the library frames this photo from about 49.7% 139px of the photo
   box (also the scale's origin). For a scale s about origin O, translating
   by (1 - s) times the subject's rendered offset from O holds the subject.
   At 1440 the young woman's face sits about 140px right of and 150px below
   the origin: 9.7% and 20.7% of the photo box. The left and top edges open
   at most about 12px, under the left and top scrims. */
: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: 9.7%;
  --hero-anchor-y: 20.7%;
  --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. events-motion.js plays the entrances as Web
   Animations with fill "backwards" and adds .sel-shown in the frame they
   start, so a finished element is the library's own rendering. These rules
   hold only the waiting poses; each matches its first keyframe. Proposal
   2026-10-31-c's rules, unchanged, without its card entrance. */
@media (min-width: 900px) {

  /* The Regular gatherings words and View Events are still: no waiting
     pose (Cheyne's stillness; they competed with the icon rows). */

  /* Gathering steps: while the list carries .sel-steps, each row waits
     faint and grey (the family's waiting light for words, 0.18), its icon a
     little small, its hairline undrawn. The library's own border is swapped
     for a drawn line of the same colour only while the walk runs. */
  .sel-on [data-sel-steps].sel-steps > .cc-info-list__item {
    position: relative;
    border-top-color: transparent;
  }
  .sel-on [data-sel-steps].sel-steps > .cc-info-list__item + .cc-info-list__item::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 1px;
    background: var(--cc-border);
    transform-origin: left center;
  }
  .sel-on [data-sel-steps].sel-steps > .cc-info-list__item:not(.sel-shown)::before {
    transform: scaleX(0);
  }
  .sel-on [data-sel-steps].sel-steps > .cc-info-list__item:not(.sel-shown) > .cc-info-list__body {
    opacity: var(--step-wait-light, 0.18);
    translate: 0 var(--step-rise, 12px);
  }
  .sel-on [data-sel-steps].sel-steps > .cc-info-list__item:not(.sel-shown) > .cc-info-list__icon {
    opacity: var(--step-wait-light, 0.18);
    filter: grayscale(1);
    scale: var(--step-icon-from, 0.72);
  }

  /* Linked media response on the event cards (Home's values). On pointer
     over the graphic or the Learn More button, or keyboard focus on the
     button (the graphic's link is tabindex -1), the graphic grows slightly
     inside its frame. No entrance. The library frame already clips. */
  .sel-on [data-sel-cards] .cc-media-frame__img {
    transition: transform 480ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .sel-on [data-sel-cards] .cc-event-card:has(.cc-event-card__media:hover, .cc-event-card__action a:is(:hover, :focus-visible)) .cc-media-frame__img {
    transform: scale(1.035);
  }
}

/* ============================================================================
   PHONE, below 900px. The selection work behind it is in
   100-motion-design/events/combined-mobile/, where this section is
   selected-motion.css (loaded by its index.html, the composition applied
   here); its README.md records the composition and its combining rules.
   Base: proposal 2026-11-04-mobile-a; substitution: proposal
   2026-11-04-mobile-c's Regular gatherings band (Copy arrival on the rule,
   heading and sentence, then Gathering rhythm on desktop R's 520ms start),
   ported under this section's evma classes.

   Gating: every rule needs html.evma-on, set by the head gate in events.html
   below 900px without reduced motion and removed by its fail-safe if the
   phone runtime in events-motion.js never starts. Every rule also sits below
   900px. 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 events-motion.js
   reads the ones it plays from here, so a waiting pose and its first
   keyframe cannot drift apart.

   Two lead moments; everything between them still:
   1. Hero arrival: Hero push + Soft title rise (the family's phone hero).
      The push holds at the library's focal origin (97% 20px), by the head
      of the woman speaking into the microphone. Lead, button and the page
      frame are still.
   2. Regular gatherings: the rule draws and the heading and sentence arrive
      (Copy arrival) as the band reaches the part line; from 520ms later the
      list walks row by row (Gathering rhythm), each row waiting for its own
      top at the part line. View Events stays still.
   The event cards have no entrance; their graphic answers keyboard focus on
   Learn More, and hover where the device hovers (Linked media response).
   ============================================================================ */
@media (max-width: 899.98px) {

  :root {
    /* Family curves (home-motion.js; events-motion.js). */
    --evma-light-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --evma-travel-ease: cubic-bezier(0.33, 1, 0.68, 1);
    --evma-draw-ease: cubic-bezier(0.65, 0, 0.35, 1);
    --evma-copy-ease: cubic-bezier(0.22, 0.61, 0.36, 1);   /* C */

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

    /* Hero clock (Connect Groups' phone values), in ms. */
    --evma-hero-photo-wait: 700;   /* longest wait for the hero photo's pixels */
    --evma-feed-wait: 1500;        /* longest wait for the event cards to fill */
    --evma-hero-release: 1500;     /* C: a part in view beside the arriving
                                      hero waits this long after its words start */

    /* C: Copy arrival (About's and Connect Groups' phone values), on the
       Regular gatherings rule, heading and sentence. */
    --evma-rule-ms: 640;
    --evma-copy-rise: 14;          /* px */
    --evma-copy-ms: 820;
    --evma-copy-blur: 5;           /* px, heading only */
    --evma-copy-text-after: 130;   /* sentence after the heading */

    /* Gathering rhythm. Row values: the applied desktop walk (Cheyne's
       quicker R in events-motion.js), unchanged. */
    --evma-step-wait: 0.18;        /* the family's waiting light for words */
    --evma-step-gap: 200;          /* between rows */
    --evma-step-draw-ms: 520;      /* hairline draw */
    --evma-step-light-after: 110;  /* row light after its line */
    --evma-step-light-ms: 480;
    --evma-step-body-lag: 30;      /* words follow the icon */
    --evma-step-icon-from: 0.72;
    --evma-step-rise: 12px;
    --evma-step-rise-ms: 700;
    /* C: desktop R's start (desktop R2 now starts with the words). The
       first row steps no sooner than
       this after the band's words start; every row also waits for its own
       top at the part line, so nothing steps off screen and nothing on
       screen above the line stays faint. */
    --evma-step-start: 520;
    --evma-part-at: 0.92;          /* the family's phone part line */
  }

  /* ---- 1. Hero push (reused, Plan Your Visit's and Connect Groups' phone
     rules): the photo waits slightly small and pushes in to its framing
     about the library's focal origin (97% 20px: the right and top edges have
     almost no overhang, so the hold is there, by the speaker's head; every
     edge stays filled at the start pose, 1.15 x 0.93 = 1.07). */
  .evma-on.evma-hero-photo-wait .cc-hero__photo {
    --hero-arrive: var(--hero-push-from);
    transform: scale(var(--hero-arrive));
  }
  .evma-on.evma-hero-photo-run .cc-hero__photo {
    transform: scale(var(--hero-arrive));
    animation: hero-push var(--hero-push-duration) var(--hero-push-ease) both;
  }

  /* Soft title rise (reused): only "Events" moves. It lights quickly and
     rises behind a still mask at its foot on the push's curve, resting as
     the picture rests. The lead, the paragraph and View Events are still
     from first paint. */
  .evma-on.evma-hero-words-wait .cc-hero__title,
  .evma-on.evma-hero-words-run .cc-hero__title {
    opacity: 0;
    translate: 0 var(--evma-title-travel);
    clip-path: inset(calc(-1 * var(--evma-title-room)) calc(-1 * var(--evma-title-room)) calc(var(--evma-title-travel) - var(--evma-title-room)) calc(-1 * var(--evma-title-room)));
  }
  .evma-on.evma-hero-words-run .cc-hero__title {
    animation:
      evma-title-rise-soft var(--evma-title-duration) var(--evma-title-ease) var(--evma-title-start) both,
      evma-title-light var(--evma-title-light-ms) var(--evma-light-ease) var(--evma-title-start) both;
  }
  @keyframes evma-title-rise-soft {
    from {
      translate: 0 var(--evma-title-travel);
      clip-path: inset(calc(-1 * var(--evma-title-room)) calc(-1 * var(--evma-title-room)) calc(var(--evma-title-travel) - var(--evma-title-room)) calc(-1 * var(--evma-title-room)));
    }
    to {
      translate: 0 0;
      clip-path: inset(calc(-1 * var(--evma-title-room)) calc(-1 * var(--evma-title-room)) calc(-1 * var(--evma-title-room)) calc(-1 * var(--evma-title-room)));
    }
  }
  @keyframes evma-title-light {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  /* ---- 2. Regular gatherings (C). Copy arrival: the words wait unseen,
     the rule undrawn. The phone runtime in events-motion.js adds
     .evma-shown once each entrance has finished, or at once when they rest
     unseen. */
  .evma-on [data-sel-band] :is([data-sel="title-c"], [data-sel="text-c"]):not(.evma-shown) {
    opacity: 0;
  }
  .evma-on [data-sel-band] [data-sel="rule-c"]:not(.evma-shown) {
    transform: scaleX(0);
    transform-origin: left center;
  }

  /* Gathering rhythm (desktop's waiting poses, unchanged, under the
     phone gate). While the list carries .evma-steps each row waits faint and
     grey, its icon a little small, its hairline undrawn. The library's own
     border is swapped for a drawn line of the same colour only while the
     walk runs. The phone runtime in events-motion.js adds .evma-shown in
     the frame a row starts and removes .evma-steps once every row has come
     to rest. */
  .evma-on [data-sel-steps].evma-steps > .cc-info-list__item {
    position: relative;
    border-top-color: transparent;
  }
  .evma-on [data-sel-steps].evma-steps > .cc-info-list__item + .cc-info-list__item::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 1px;
    background: var(--cc-border);
    transform-origin: left center;
  }
  .evma-on [data-sel-steps].evma-steps > .cc-info-list__item:not(.evma-shown)::before {
    transform: scaleX(0);
  }
  .evma-on [data-sel-steps].evma-steps > .cc-info-list__item:not(.evma-shown) > .cc-info-list__body {
    opacity: var(--evma-step-wait);
    translate: 0 var(--evma-step-rise);
  }
  .evma-on [data-sel-steps].evma-steps > .cc-info-list__item:not(.evma-shown) > .cc-info-list__icon {
    opacity: var(--evma-step-wait);
    filter: grayscale(1);
    scale: var(--evma-step-icon-from);
  }

  /* ---- Linked media response on the event cards (reused: Events desktop's
     values; Connect Groups' phone rule for hover). Feedback only, no
     entrance: keyboard focus on Learn More everywhere, hover only where the
     device hovers, so a tap does not leave the graphic grown. The card
     already clips its graphic. */
  .evma-on [data-sel-cards] .cc-media-frame__img {
    transition: transform 480ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .evma-on [data-sel-cards] .cc-event-card:has(.cc-event-card__action a:focus-visible) .cc-media-frame__img {
    transform: scale(1.035);
  }
  @media (hover: hover) {
    .evma-on [data-sel-cards] .cc-event-card:has(.cc-event-card__media:hover, .cc-event-card__action a:hover) .cc-media-frame__img {
      transform: scale(1.035);
    }
  }
}
