/* ============================================================================
   HOME MOTION - the applied motion for index.html: desktop from 900px and
   the phone below it. 100-motion-design/motion-guidance.md explains it.
   Desktop selection work: 100-motion-design/home/combined/. Phone selection
   work: 100-motion-design/home/combined-mobile/, where this file is
   selected-motion.css with preview paths, plus the phone polish's Give
   waiting pose (in user-picks.html there). The accepted hero motion stays in
   index.html under its pilot- names and is not touched here.

   Gating: every rule needs html.sel-on (set in the head at every width
   without reduced motion; removed by a fail-safe if home-motion.js never
   starts). Without it the page is the still baseline.

   Entrances are Web Animations in home-motion.js with fill "backwards",
   so a finished element is the library's own rendering with nothing left on
   it. This file holds only the waiting state and the CSS-only treatments.
   ============================================================================ */

@media (min-width: 900px) {

  /* Waiting to enter. home-motion.js adds .sel-shown in the frame its
     animation starts; the animation's first keyframe takes over from here. */
  .sel-on [data-sel]:not(.sel-shown) {
    opacity: 0;
  }

  /* Photos wait in their start pose, from half opacity, never 0: a photo
     faded up from hidden reads as an empty bright space, then a flash
     (Cheyne, 2026-10-16). Each pose matches its first keyframe in
     home-motion.js, so nothing jumps when the entrance starts. */
  .sel-on :is([data-sel="settle-p13"], [data-sel="settle-p11"], [data-sel="photo-p14"], [data-sel="rise-fan"]):not(.sel-shown) {
    opacity: 0.35;
  }
  .sel-on [data-sel="settle-p13"]:not(.sel-shown) img {
    transform: scale(1.08);
  }
  .sel-on :is([data-sel="settle-p11"], [data-sel="photo-p14"]):not(.sel-shown) img {
    transform: scale(1.06);
  }
  .sel-on [data-sel="photo-p14"]:not(.sel-shown) {
    transform: translateY(28px);
  }
  .sel-on [data-sel="rise-fan"]:not(.sel-shown) {
    translate: 0 48px;
  }

  /* The hero holds still on scroll, as on the other desktop pages: no rule
     here touches the hero photo or intro clip. */

  /* ---- sunday-card: C Respond. The graphic eases in inside its frame on
     pointer or keyboard focus. Feedback only; no entrance. ---------------- */
  .sel-on [data-sel-respond] .cc-media-frame__img {
    transition: transform 480ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .sel-on [data-sel-respond]:is(:hover, :focus-visible) .cc-media-frame__img {
    transform: scale(1.035);
  }

  /* ---- watch-posters: FAN poster fan, scroll-linked (Cheyne's refinement).
     The front poster holds still; the two older posters fan out from behind
     it. TEXT TIMING ROUND: the graphic stays at full opacity (it used to
     fade from half to full, so it read as dimmed). FAN's values, but the
     progress follows the scroll instead of a 1.4s clock: home-motion.js
     writes --sel-fan (0 to 1, linear in the scroll) and keeps .sel-fan on the
     figure only while the fan is open, so at rest no layering remains.
     The posters are one cut-out image shown 3 times, each copy cut to one
     poster: the <img> is the front, ::before the middle, ::after the back.
     Cut lines are FAN's, measured on watch-sermons.png (1280 x 541): front
     poster ends at x 718, middle at x 1046. A new graphic needs new lines. */
  .sel-on [data-sel-fan].sel-fan {
    position: relative;
    isolation: isolate;
  }
  .sel-on [data-sel-fan].sel-fan .cc-media-frame__img {
    position: relative;
    z-index: 3;
    clip-path: inset(0 calc(100% - 718 / 1280 * 100%) 0 0);
  }
  .sel-on [data-sel-fan].sel-fan::before,
  .sel-on [data-sel-fan].sel-fan::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("photos/watch-sermons.png") center / 100% 100% no-repeat;
    pointer-events: none;
  }
  .sel-on [data-sel-fan].sel-fan::before {
    z-index: 2;
    clip-path: inset(0 calc(100% - 1046 / 1280 * 100%) 0 calc(718 / 1280 * 100%));
    translate: calc(-3% * (1 - var(--sel-fan, 0))) 0;
  }
  .sel-on [data-sel-fan].sel-fan::after {
    z-index: 1;
    clip-path: inset(0 0 0 calc(1046 / 1280 * 100%));
    translate: calc(-6% * (1 - var(--sel-fan, 0))) 0;
  }
}

/* ============================================================================
   PHONE (base proposal 2026-11-01-mobile-b), below 900px. html.sel-on is
   set at every width without reduced motion; home-motion.js runs the phone
   triggers below 900px (see PHONE in its header). The waiting poses are
   desktop's, so each entrance starts from the pose it waits in.

   A waiting photo hides its picture until home-motion.js has it loaded and
   decoded (.sel-img-ready), so a late or progressive load never shows.
   ============================================================================ */
@media (max-width: 899.98px) {

  .sel-on [data-sel]:not(.sel-shown) {
    opacity: 0;
  }
  /* PHONE: band buttons are still on the phone, so they never wait hidden:
     visible at rest from load. */
  .sel-on .cc-feature-split__actions[data-sel]:not(.sel-shown) {
    opacity: 1;
  }
  .sel-on :is([data-sel="settle-p13"], [data-sel="settle-p11"], [data-sel="photo-p14"], [data-sel="rise-fan"]):not(.sel-shown) {
    opacity: 0.35;
  }
  .sel-on :is([data-sel="settle-p13"], [data-sel="settle-p11"], [data-sel="photo-p14"], [data-sel="rise-fan"], [data-sel="push-speaker"]):not(.sel-shown):not(.sel-img-ready) img {
    visibility: hidden;
  }
  .sel-on [data-sel="settle-p13"]:not(.sel-shown) img {
    transform: scale(1.08);
  }
  .sel-on :is([data-sel="settle-p11"], [data-sel="photo-p14"]):not(.sel-shown) img {
    transform: scale(1.06);
  }
  .sel-on [data-sel="photo-p14"]:not(.sel-shown) {
    transform: translateY(28px);
  }
  /* POLISH, Give photo rise: the phone rise is 28px (desktop 48px), so it
     waits 28px low, matching its first keyframe in home-motion.js. */
  .sel-on [data-sel="rise-fan"]:not(.sel-shown) {
    translate: 0 28px;
  }

  /* The phone hero keeps the website's current motion only (intro clip and
     copy settle) and holds still on scroll, as desktop. */

  /* Linked media response, as desktop. Hover only where the device hovers,
     so a tap does not leave the graphic grown. */
  .sel-on [data-sel-respond] .cc-media-frame__img {
    transition: transform 480ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .sel-on [data-sel-respond]:focus-visible .cc-media-frame__img {
    transform: scale(1.035);
  }
  @media (hover: hover) {
    .sel-on [data-sel-respond]:hover .cc-media-frame__img {
      transform: scale(1.035);
    }
  }

  /* Poster fan, as desktop (same cut lines, same offsets). */
  .sel-on [data-sel-fan].sel-fan {
    position: relative;
    isolation: isolate;
  }
  .sel-on [data-sel-fan].sel-fan .cc-media-frame__img {
    position: relative;
    z-index: 3;
    clip-path: inset(0 calc(100% - 718 / 1280 * 100%) 0 0);
  }
  .sel-on [data-sel-fan].sel-fan::before,
  .sel-on [data-sel-fan].sel-fan::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("photos/watch-sermons.png") center / 100% 100% no-repeat;
    pointer-events: none;
  }
  .sel-on [data-sel-fan].sel-fan::before {
    z-index: 2;
    clip-path: inset(0 calc(100% - 1046 / 1280 * 100%) 0 calc(718 / 1280 * 100%));
    translate: calc(-3% * (1 - var(--sel-fan, 0))) 0;
  }
  .sel-on [data-sel-fan].sel-fan::after {
    z-index: 1;
    clip-path: inset(0 0 0 calc(1046 / 1280 * 100%));
    translate: calc(-6% * (1 - var(--sel-fan, 0))) 0;
  }
}

/* ---- identity-photo: Speaker push, both widths. No fade, no frame movement:
   the frame waits at full light with its picture slightly wide, then the
   picture pushes in to the library's framing (home-motion.js "push-speaker").
   --sel-push-from is the start framing: scale(0.9434) about the speaker's face
   and lectern, at 54% / 57% of the frame. Its translate re-centres the scale
   from the library's transform origin (--cc-photo-focal) to that point:
   translate = (1 - 0.9434) x (point - focal) / zoom, in % of the picture box.
     phone    focal 70% 20%, zoom 1.6:  translate(-0.57%, 1.31%)
     desktop  focal 67% 20%, zoom 1.6:  translate(-0.46%, 1.31%)
   The picture still covers the frame at the start (smallest margin about
   18px, at the top, at 390px wide). The picture stays hidden until decoded
   (.sel-img-ready, set by home-motion.js). These rules sit after both blocks
   so they win over the shared waiting rules. */
#home-about-photo {
  --sel-push-from: translate(-0.57%, 1.31%) scale(0.9434);
}
@media (min-width: 900px) {
  #home-about-photo {
    --sel-push-from: translate(-0.46%, 1.31%) scale(0.9434);
  }
}
.sel-on [data-sel="push-speaker"]:not(.sel-shown) {
  opacity: 1;
}
.sel-on [data-sel="push-speaker"]:not(.sel-shown) img {
  transform: var(--sel-push-from);
}
.sel-on [data-sel="push-speaker"]:not(.sel-img-ready) img {
  visibility: hidden;
}
