/* Entrance animations (motion.php + motion.js). Everything is scoped to html.ots-motion, which the head script in
   motion.php only sets when motion is allowed and removes again after 3 s if motion.js never ran, so content is never
   left hidden. Only opacity, transform, filter and clip-path animate: nothing shifts the layout. The first section on
   a page never starts invisible (LCP): its text moves up a little from full opacity and its images stay put. */

/* Waiting states: a section is hidden until motion.js has picked its parts, then each part until the section is in. */
.ots-motion [data-ots-motion]:not([data-ots-motion="none"],[data-ots-motion-first],.is-motion-ready){opacity:0}
.ots-motion .is-motion-ready:not(.is-motion-in) .ots-motion-part{opacity:0}
.ots-motion [data-ots-motion-first].is-motion-ready .ots-motion-part{opacity:1}
.ots-motion [data-ots-motion-heading]:not(.is-motion-ready) :is(h1,h2){opacity:.06}
/* Highlights draw only once their part (or split heading) has arrived. */
/* In the first section the text is visible from the start, so its highlights draw as before; split headings still wait. */
.ots-motion :is([data-ots-motion]:not([data-ots-motion-first]) .ots-motion-part,.ots-motion-heading):not(.is-motion-done) :is(mark,.ots-mark__line){background-size:0 100%!important;color:inherit!important;transition:none!important}

/* Shared timing: --ots-motion-duration is a factor (1 = standard, ×0.6 on phones), --ots-motion-gap the pause between
   parts, --ots-motion-lead the wait after a heading effect. */
.ots-motion .is-motion-in .ots-motion-part{animation-duration:calc(.8s * var(--ots-motion-duration,1));animation-timing-function:cubic-bezier(.2,.7,.2,1);animation-fill-mode:both;animation-delay:calc(var(--ots-motion-i,0) * var(--ots-motion-gap,200ms) + var(--ots-motion-lead,0ms) * var(--ots-motion-duration,1))}
/* Finished parts drop their animation: a part that is hidden and shown again (grid filters, <details>) would
   otherwise replay its entrance from opacity 0. */
.ots-motion .ots-motion-part.is-motion-done,.ots-motion .ots-motion-part.is-motion-done *,.ots-motion .ots-motion-heading.is-motion-done,.ots-motion .ots-motion-heading.is-motion-done .ots-motion-ch{animation:none!important}
.ots-motion .is-motion-instant .ots-motion-part,.ots-motion .is-motion-instant .ots-motion-part *{animation:none!important;opacity:1!important}

/* Fade up */
.ots-motion [data-ots-motion="fade-up"].is-motion-in .ots-motion-part{animation-name:ots-motion-up}
/* Slide from the sides: text from the left, media from the right */
.ots-motion [data-ots-motion="slide-sides"].is-motion-in .ots-motion-part{animation-duration:calc(.9s * var(--ots-motion-duration,1))}
.ots-motion [data-ots-motion="slide-sides"].is-motion-in .ots-motion-part--text{animation-name:ots-motion-left}
.ots-motion [data-ots-motion="slide-sides"].is-motion-in .ots-motion-part--media{animation-name:ots-motion-right}
/* Blur + image reveal */
.ots-motion [data-ots-motion="blur-reveal"].is-motion-in .ots-motion-part--text{animation-name:ots-motion-blur;animation-duration:calc(1s * var(--ots-motion-duration,1))}
.ots-motion [data-ots-motion="blur-reveal"].is-motion-in .ots-motion-part--media{animation-name:ots-motion-reveal;animation-duration:calc(1.1s * var(--ots-motion-duration,1))}
/* Wipe from left */
.ots-motion [data-ots-motion="wipe"].is-motion-in .ots-motion-part{animation-name:ots-motion-wipe;animation-duration:calc(1s * var(--ots-motion-duration,1));animation-timing-function:cubic-bezier(.7,0,.2,1)}
/* Images zoom out inside their frame */
.ots-motion [data-ots-motion="zoom-out"].is-motion-in .ots-motion-part--text{animation-name:ots-motion-up}
.ots-motion [data-ots-motion="zoom-out"].is-motion-in .ots-motion-part--media{animation-name:ots-motion-fade;animation-duration:calc(.5s * var(--ots-motion-duration,1));overflow:hidden}
.ots-motion [data-ots-motion="zoom-out"].is-motion-in .ots-motion-part--media img{animation:ots-motion-zoom calc(1.6s * var(--ots-motion-duration,1)) cubic-bezier(.2,.7,.2,1) both;animation-delay:inherit}
/* Yellow curtain over images (motion.js adds the .ots-motion-curtain span; bare <img> parts fade up instead) */
.ots-motion [data-ots-motion="curtain"].is-motion-in .ots-motion-part--text,.ots-motion [data-ots-motion="curtain"].is-motion-in img.ots-motion-part--media{animation-name:ots-motion-up}
.ots-motion [data-ots-motion="curtain"].is-motion-in .ots-motion-part--media:has(> .ots-motion-curtain){animation-name:ots-motion-show;animation-duration:calc(1.2s * var(--ots-motion-duration,1))}
.ots-motion [data-ots-motion="curtain"].is-motion-in .ots-motion-part--media > :not(.ots-motion-curtain){animation:ots-motion-late calc(1.2s * var(--ots-motion-duration,1)) steps(1,end) both;animation-delay:inherit}
.ots-motion [data-ots-motion] .ots-motion-part > span.ots-motion-curtain{position:absolute;inset:0;z-index:9;display:block;margin:0;padding:0;background:#ffe600;transform:scaleX(0);pointer-events:none}
.ots-motion [data-ots-motion="curtain"].is-motion-in .ots-motion-curtain{animation:ots-motion-curtain calc(1.2s * var(--ots-motion-duration,1)) cubic-bezier(.7,0,.2,1) both;animation-delay:inherit}
/* Cascade with tilt */
.ots-motion [data-ots-motion="cascade"].is-motion-in .ots-motion-part--text{animation-name:ots-motion-up}
.ots-motion [data-ots-motion="cascade"].is-motion-in .ots-motion-part--media{animation-name:ots-motion-tilt;animation-duration:calc(1s * var(--ots-motion-duration,1));animation-timing-function:cubic-bezier(.2,.9,.25,1)}

/* First section: text rises a little from full opacity, media stays still (comes after the effect rules to win). */
.ots-motion [data-ots-motion][data-ots-motion-first].is-motion-in .ots-motion-part--text{animation-name:ots-motion-first}
.ots-motion [data-ots-motion][data-ots-motion-first].is-motion-in .ots-motion-part--media,.ots-motion [data-ots-motion][data-ots-motion-first].is-motion-in .ots-motion-part--media *{animation:none}
.ots-motion [data-ots-motion-first]{--ots-motion-from:.06}

/* Grid cards (Marker.io OTS-81): each card fades up as one piece when it scrolls into view (motion.js), 80 ms after
   the card to its left; slower and softer than the section parts, and the same on phones. */
.ots-motion .ots-motion-card:not(.is-card-in){opacity:0}
.ots-motion .ots-motion-card.is-card-in:not(.is-card-done){animation:ots-motion-card .9s cubic-bezier(.25,.6,.25,1) both;animation-delay:calc(var(--ots-card-i,0) * 80ms)}
.ots-motion .is-motion-instant .ots-motion-card{opacity:1}

/* These three move with the translate property, not transform: an element that is placed with its own transform (the
   staggered case cards on the homepage, offset by translateY) would otherwise lose that offset while it fades in and
   jump back to it when the animation ends. */
@keyframes ots-motion-card{from{opacity:0;translate:0 16px}to{opacity:1;translate:none}}
@keyframes ots-motion-up{from{opacity:0;translate:0 28px}to{opacity:1;translate:none}}
@keyframes ots-motion-first{from{translate:0 12px}to{translate:none}}
@keyframes ots-motion-left{from{opacity:0;transform:translateX(-40px)}to{opacity:1;transform:none}}
@keyframes ots-motion-right{from{opacity:0;transform:translateX(40px)}to{opacity:1;transform:none}}
@keyframes ots-motion-blur{from{opacity:0;filter:blur(10px);transform:translateY(12px)}to{opacity:1;filter:none;transform:none}}
@keyframes ots-motion-reveal{from{opacity:1;clip-path:inset(100% 0 0 0);transform:scale(1.08)}to{opacity:1;clip-path:inset(0);transform:none}}
@keyframes ots-motion-wipe{from{opacity:1;clip-path:inset(0 100% 0 0)}to{opacity:1;clip-path:inset(0)}}
@keyframes ots-motion-fade{from{opacity:0}to{opacity:1}}
@keyframes ots-motion-zoom{from{transform:scale(1.3)}to{transform:none}}
@keyframes ots-motion-show{from{opacity:1}to{opacity:1}}
@keyframes ots-motion-late{0%{opacity:0}50%,100%{opacity:1}}
@keyframes ots-motion-curtain{0%{transform:scaleX(0);transform-origin:left}50%{transform:scaleX(1);transform-origin:left}50.1%{transform:scaleX(1);transform-origin:right}100%{transform:scaleX(0);transform-origin:right}}
@keyframes ots-motion-tilt{from{opacity:0;transform:translateY(70px) rotate(3deg) scale(.95)}to{opacity:1;transform:none}}

/* Heading effects: motion.js splits the element's first h1/h2 into .ots-motion-ch letters (or words) inside
   .ots-motion-word groups, so lines only break between words. */
.ots-motion-word{display:inline-block;white-space:nowrap}
.ots-motion-ch{display:inline-block;white-space:pre}
.ots-motion-mask{display:inline-block;overflow:hidden;vertical-align:top;padding-bottom:.1em;margin-bottom:-.1em}
.ots-motion .is-motion-ready:not(.is-motion-in) .ots-motion-ch,.ots-motion .is-motion-ready:not(.is-motion-in) .ots-motion-heading[data-effect="beam"]{opacity:var(--ots-motion-from,0)}
.ots-motion .is-motion-in .ots-motion-heading .ots-motion-ch{animation-fill-mode:both;animation-duration:calc(var(--ots-motion-ch-s,.8s) * var(--ots-motion-duration,1));animation-delay:calc((var(--ots-motion-c,0) * var(--ots-motion-ch-step,55ms) + 200ms) * var(--ots-motion-duration,1))}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="fade-left"] .ots-motion-ch{--ots-motion-ch-s:.7s;animation-name:ots-motion-h-fade-left;animation-timing-function:cubic-bezier(.2,.7,.2,1)}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="drop"] .ots-motion-ch{--ots-motion-ch-step:60ms;animation-name:ots-motion-h-drop;animation-timing-function:cubic-bezier(.34,1.45,.5,1)}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="rise"] .ots-motion-ch{--ots-motion-ch-s:.9s;--ots-motion-ch-step:45ms;animation-name:ots-motion-h-rise;animation-timing-function:cubic-bezier(.2,.8,.2,1)}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="light-on"] .ots-motion-ch{animation:ots-motion-h-flicker calc(1.1s * var(--ots-motion-duration,1)) steps(1,end) both,ots-motion-h-glow calc(1.6s * var(--ots-motion-duration,1)) ease-out both;animation-delay:calc((var(--ots-motion-r,0) * 900ms + 200ms) * var(--ots-motion-duration,1))}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="focus"] .ots-motion-ch{--ots-motion-ch-s:1.2s;--ots-motion-ch-step:35ms;animation-name:ots-motion-h-focus;animation-timing-function:cubic-bezier(.2,.7,.2,1)}
.ots-motion-heading[data-effect="flip"]{perspective:700px}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="flip"] .ots-motion-ch{--ots-motion-ch-s:.9s;transform-origin:50% 0;animation-name:ots-motion-h-flip;animation-timing-function:cubic-bezier(.2,.8,.2,1)}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="words"] .ots-motion-ch{--ots-motion-ch-s:1s;--ots-motion-ch-step:160ms;animation-name:ots-motion-h-rise;animation-timing-function:cubic-bezier(.2,.8,.2,1)}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="beam"]{background:linear-gradient(100deg,currentColor 0%,currentColor 40%,#ffe600 47%,rgba(255,255,255,.08) 53%,rgba(255,255,255,.08) 100%) no-repeat;background-size:300% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:ots-motion-h-beam calc(1.8s * var(--ots-motion-duration,1)) cubic-bezier(.45,.05,.25,1) calc(.2s * var(--ots-motion-duration,1)) both}
.ots-motion .is-motion-in .ots-motion-heading[data-effect="tracking"] .ots-motion-ch{animation:ots-motion-h-tracking calc(1.4s * var(--ots-motion-duration,1)) cubic-bezier(.2,.7,.2,1) calc(.1s * var(--ots-motion-duration,1)) both}

/* A finished beam heading drops the gradient and shows its own colour again. */
.ots-motion .ots-motion-heading[data-effect="beam"].is-motion-done{background:none;-webkit-text-fill-color:currentColor}

@keyframes ots-motion-h-fade-left{from{opacity:var(--ots-motion-from,0);transform:translateX(-.18em);filter:blur(6px)}to{opacity:1;transform:none;filter:none}}
@keyframes ots-motion-h-drop{from{opacity:var(--ots-motion-from,0);transform:translateY(-1.1em) rotate(-8deg)}60%{opacity:1}to{opacity:1;transform:none}}
@keyframes ots-motion-h-rise{from{opacity:var(--ots-motion-from,0);transform:translateY(105%)}to{opacity:1;transform:none}}
@keyframes ots-motion-h-flicker{0%{opacity:.06}10%{opacity:.9}14%{opacity:.1}24%{opacity:1}30%{opacity:.25}44%,100%{opacity:1}}
@keyframes ots-motion-h-glow{0%,40%{text-shadow:0 0 18px rgba(255,230,0,.9),0 0 40px rgba(255,200,80,.6)}100%{text-shadow:0 0 0 transparent}}
@keyframes ots-motion-h-focus{from{opacity:var(--ots-motion-from,0);transform:scale(1.6);filter:blur(14px)}to{opacity:1;transform:none;filter:none}}
@keyframes ots-motion-h-flip{from{opacity:var(--ots-motion-from,0);transform:rotateX(-95deg)}40%{opacity:1}to{opacity:1;transform:none}}
@keyframes ots-motion-h-beam{to{background-position:0 0}}
@keyframes ots-motion-h-tracking{from{transform:translateX(calc((var(--ots-motion-c,0) - var(--ots-motion-n,0) / 2) * .4em));opacity:var(--ots-motion-from,0);filter:blur(8px)}to{transform:none;opacity:1;filter:none}}

/* Belt and braces: the head script never sets ots-motion for these, but keep the final state if it is set anyway. */
@media (prefers-reduced-motion:reduce),print{
  .ots-motion [data-ots-motion],.ots-motion .ots-motion-part,.ots-motion .ots-motion-part *,.ots-motion .ots-motion-heading,.ots-motion .ots-motion-ch{animation:none!important;opacity:1!important;transform:none!important;filter:none!important;clip-path:none!important}
  .ots-motion-curtain{display:none}
}
