/* Services reel: one pinned screen, the services swapped in place by scroll.
   js/film/scenes/services-reel.mjs adds .is-reel to the runway of the layout whose media query
   matches (motion on, every service fits the screen) and publishes --reel-o / --reel-y per
   service. Two layouts, two pairs of wrappers: phones pin four services (.services-reel >
   .services-reel-pin), wide screens pin all five (the outer pair, which also carries
   .services-reel-wide / .services-reel-wide-pin). Until .is-reel arrives a pair does not exist
   for layout, so landscape phones, reduced motion and no-JS keep the stacked list. */
.services-reel, .services-reel-pin { display: contents; }
.services-reel-rail { display: none; }

/* Both layouts: the union of the two queries in services-reel.mjs (REEL_QUERY, WIDE_QUERY). */
@media (min-height: 541px) {
  .services-reel.is-reel { display: block; }
  /* The child combinator keeps the phone pair inside an active wide reel out of layout. */
  .services-reel.is-reel > .services-reel-pin {
    display: grid; position: sticky; top: 0; height: 100svh; overflow: clip;
  }
  /* All services share one grid cell. The current one is in place; the others are parked a
     full screen away by --reel-y, so they are never half-visible behind it. */
  #services .services-reel.is-reel .service-row {
    grid-area: 1 / 1; align-self: center; min-width: 0; height: auto; margin: 0;
    opacity: var(--reel-o, 0); transform: translateY(var(--reel-y, 0px));
  }
  /* At rest the service is an ordinary box: a promoted layer at a half-pixel offset left a
     1px ghost row of the proof frame at its bottom edge in Chrome. */
  #services .services-reel.is-reel .service-row[data-reel="rest"] { opacity: 1; transform: none; }
  #services .services-reel.is-reel .service-row[data-reel="parked"] { pointer-events: none; }
  /* Orientation inside the pin: one tick per service, the current one in the accent. It tells
     the visitor how long the pinned screen lasts. */
  .services-reel.is-reel .services-reel-rail {
    grid-area: 1 / 1; align-self: start; justify-self: start; z-index: 1;
    display: flex; gap: 6px; direction: rtl;
  }
  .services-reel-rail i { width: 28px; height: 2px; background: rgb(30 33 80 / 22%); transition: background-color 160ms linear; }
  .services-reel-rail i[data-on] { background: #c9803a; }
}

@media (max-width: 720px) and (min-height: 541px) {
  /* Runway = the pinned screen + travel. Travel = 60svh per service x the weights' sum
     (STEP_SVH and WEIGHTS in services-reel.mjs: .65 + 1 + 1 + 1). */
  .services-reel.is-reel { height: calc(100svh + 3.65 * 60svh); }
  .services-reel.is-reel .services-reel-rail { margin: 28px 24px 0; }
  /* Four services in the phone pin: the fifth tick is the wide reel's. */
  .services-reel-rail i:nth-child(n + 5) { display: none; }
  /* The row ends above the floating tools (56px zone), whichever service is in the frame. */
  #services .services-reel.is-reel .service-row-inner { padding-bottom: 72px; }
  /* The fifth service stands outside the pin (its proof, the turning figure, needs the whole
     screen), but it arrives like the four before it: js/film/scenes/reel-arrival.mjs publishes
     the same two values for its row and for the blocks of its stage while they rise in from
     below. The stage's own lilac ground stays put; only what stands on it moves. */
  #main [data-reel-arrival] { opacity: var(--reel-o, 1); transform: translateY(var(--reel-y, 0px)); }
  #main [data-reel-arrival][data-reel="rest"] { opacity: 1; transform: none; }
}

@media (min-width: 721px) and (min-height: 541px) {
  /* Travel = 50svh per service x the weights' sum (WIDE_STEP_SVH and WIDE_WEIGHTS in
     services-reel.mjs: .65 + 1 + 1 + 1.6 + .35). */
  .services-reel-wide.is-reel { height: calc(100svh + 4.6 * 50svh); }
  /* The rail starts on the same edge as the rows' copy (css/film/services.css: the row is
     capped and padded 6vw), so the ticks sit above the amber dash of each service name. */
  .services-reel-wide.is-reel .services-reel-rail {
    justify-self: center; box-sizing: border-box; width: 100%; max-width: 1440px;
    margin-top: 36px; padding-inline: 6vw;
  }
  /* The persona row is a pointer to the stage below it, not a proof: even room around it. */
  #services .services-reel-wide.is-reel .service-row-persona .service-row-inner { padding-block: 40px; }
}
@media (min-width: 1600px) and (min-height: 541px) {
  .services-reel-wide.is-reel .services-reel-rail { max-width: 1720px; }
}
