/* Mission Baghdad · module "reveal"
   Word-rise headings, photo wipes, stacked-sheet dark sections.
   Every rule is gated by html.rv-on (set by reveal.js) and by prefers-reduced-motion: no-preference,
   so without JS, or with reduced motion, the page renders exactly as site.css leaves it. */

@media (prefers-reduced-motion:no-preference){

  /* ---------- 1. headings: words rise out of a mask ---------- */
  /* the heading itself stops using the .rv fade, the words carry the motion */
  .rv-on .h2.rvh.rvh{opacity:1;transform:none;transition:none}
  /* clip-path (not overflow) keeps the baseline where it was; negative insets leave room for
     Arabic descenders and marks so nothing is shaved at rest */
  .rv-on .rvh .rvw{display:inline-block;clip-path:inset(-.22em -.12em -.32em)}
  .rv-on .rvh .rvw__i{display:inline-block;transform:translateY(1.75em);
    transition:transform 1.05s var(--ease);transition-delay:calc(var(--i,0) * 60ms + 80ms)}
  .rv-on .rvh:not(.is-in) .rvw__i{will-change:transform}
  .rv-on .rvh.is-in .rvw__i{transform:none}

  /* ---------- 2. photos: inset wipe on the frame, scale settle on the picture ---------- */
  /* armed: hidden the same way .rv hides it, but without the 26px offset */
  .rv-on figure.ph.rvp{opacity:0;transform:none;transition:none;
    --rvp-c:inset(0 100% 0 0 round var(--r));--rvp-x:101%;--rvp-d:0s}
  /* --s opens from the inline-start edge, --e from the inline-end edge */
  .rv-on figure.ph.rvp--e{--rvp-c:inset(0 0 0 100% round var(--r));--rvp-x:-101%}
  .rv-on[dir="rtl"] figure.ph.rvp--s{--rvp-c:inset(0 0 0 100% round var(--r));--rvp-x:-101%}
  .rv-on[dir="rtl"] figure.ph.rvp--e{--rvp-c:inset(0 100% 0 0 round var(--r));--rvp-x:101%}
  /* the .d1/.d2/.d3 stagger of site.css is carried by a variable (the shorthand below resets delay) */
  .rv-on figure.ph.rvp.d1{--rvp-d:.08s}
  .rv-on figure.ph.rvp.d2{--rvp-d:.16s}
  .rv-on figure.ph.rvp.d3{--rvp-d:.24s}
  .rv-on figure.ph.rvp.is-set{opacity:1;clip-path:var(--rvp-c)}
  /* two-stage reveal: the frame opens on a brand-coloured sheet, the sheet then leaves in the same
     direction and uncovers the photo. Transform only; the frame's own overflow keeps it inside. */
  .rv-on figure.ph.rvp::after{content:"";position:absolute;inset:0;z-index:2;pointer-events:none;
    background:linear-gradient(135deg,var(--fire),var(--amber))}
  .rv-on figure.ph.rvp.is-set.is-in::after{transform:translateX(var(--rvp-x));
    transition:transform .95s cubic-bezier(.7,0,.2,1) calc(var(--rvp-d) + .32s)}
  /* the img keeps site.css's scale(1.08) translateY(var(--py)) parallax; 1.09 x 1.08 = 1.18 */
  .rv-on figure.ph.rvp.is-set picture{transform:scale(1.09);will-change:transform}
  .rv-on figure.ph.rvp.is-set.is-in{clip-path:inset(0 0 0 0 round var(--r));
    transition:clip-path 1.15s cubic-bezier(.7,0,.2,1) var(--rvp-d)}
  .rv-on figure.ph.rvp.is-set.is-in picture{transform:none;
    transition:transform 1.9s var(--ease) calc(var(--rvp-d) + .3s)}
  /* wipe finished: drop the clip so borders and shadows (about__inset) paint again */
  .rv-on figure.ph.rvp.is-set.is-in.is-done{clip-path:none;transition:none}
  .rv-on figure.ph.rvp.is-clear picture{will-change:auto}
  .rv-on figure.ph.rvp.is-clear::after{content:none}

  /* ---------- 3. dark sections arrive as a sheet ---------- */
  /* --sp runs 0 (top edge entering the screen) to 1 (settled), written by reveal.js */
  .rv-on .rvs{--sp:1;--rvs-x:clamp(8px,3vw,44px);--rvs-r:clamp(18px,2.6vw,34px);
    clip-path:inset(0 calc((1 - var(--sp)) * var(--rvs-x)) 0 calc((1 - var(--sp)) * var(--rvs-x))
      round calc(var(--rvs-r) * (2.4 - 1.4 * var(--sp))) calc(var(--rvs-r) * (2.4 - 1.4 * var(--sp))) 0 0)}
  /* a tinted light section continues under the sheet's corners (no layout change) */
  .rv-on .rvs-under{box-shadow:0 min(60vh,520px) 0 0 var(--rvs-under,transparent)}
}

@media print{
  .rv-on .rvh .rvw__i{transform:none!important}
  .rv-on figure.ph.rvp{opacity:1!important;clip-path:none!important}
  .rv-on figure.ph.rvp picture{transform:none!important}
  .rv-on figure.ph.rvp::after{display:none!important}
  .rv-on .rvs{clip-path:none!important}
  .rv-on .rvs-under{box-shadow:none!important}
}
