/* =====================================================================
   SESSION LOADER - shared by login.html, onboarding.html and signed-in.html.
   Each page keeps its own #veil and #veil.hide base rules; everything else
   about the loader lives here and only here.

   The flying figure is adapted from "Redirecting Loader" by Mr Alien,
   https://codepen.io/mr_alien/pen/NWygPw (2014), under the MIT licence:

   Copyright (c) 2014 by Mr Alien (https://codepen.io/mr_alien/pen/NWygPw)

   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software and associated documentation files (the "Software"), to deal
   in the Software without restriction, including without limitation the rights
   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   copies of the Software, and to permit persons to whom the Software is
   furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included in all
   copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   SOFTWARE.
   ===================================================================== */

#veil.hide{transition-delay:.35s}

/* NOTHING MOVES FOR THE FIRST 300ms. The veil's own background covers the page
   at once; the air and the figure fade in only if the check is still running
   after 300ms, so a fast check never flashes them. When the check finishes the
   fade stops where it is: stopped before 300ms, they were never seen. */
.veil-air,.veil-runner-stage{animation:veilShow .3s ease .3s backwards}
@keyframes veilShow{from{opacity:0}}
#veil.hide .veil-runner-stage{animation-play-state:paused}

/* CARRIED OVER (launch slice 6d, §3.3): reached straight from another of the
   three pages with its veil up (assets/session-runner.js puts .veil-carry on
   <html>), the figure and the air are already on screen, so they show at once,
   with no fade-in. When this veil lifts the lines still warp away; veilShow is
   left out of that list here, because added at that moment it would start
   paused at its first keyframe and hide the lines instead. */
.veil-carry .veil-air,.veil-carry .veil-runner-stage{animation:none}
.veil-carry #veil.hide .veil-air{animation:veilWarp .45s cubic-bezier(.5,0,.9,.4) forwards}

/* The air: twelve lines at three depths. Far = thin, faint, slow; near = thick, bright, fast. */
.veil-air{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.veil-air i{position:absolute;left:0;display:block;will-change:transform;
  background:linear-gradient(90deg,rgba(244,244,244,var(--a)),rgba(244,244,244,calc(var(--a) * .6)) 30%,rgba(244,244,244,0));
  animation:veilAir 1s linear infinite}
.veil-air i:nth-child(1){top:12%;width:11vw;height:1px;--a:.12;animation-duration:1.67s;animation-delay:-.68s}
.veil-air i:nth-child(2){top:28%;width:7vw;height:1px;--a:.12;animation-duration:2.16s;animation-delay:-1.02s}
.veil-air i:nth-child(3){top:38%;width:11vw;height:1px;--a:.16;animation-duration:1.96s;animation-delay:-.89s}
.veil-air i:nth-child(4){top:58%;width:9vw;height:1px;--a:.14;animation-duration:1.78s;animation-delay:-2.44s}
.veil-air i:nth-child(5){top:71%;width:11vw;height:1px;--a:.10;animation-duration:1.82s;animation-delay:-1.32s}
.veil-air i:nth-child(6){top:88%;width:10vw;height:1px;--a:.15;animation-duration:2.11s;animation-delay:-1.11s}
.veil-air i:nth-child(7){top:20%;width:14vw;height:1.5px;--a:.25;animation-duration:1.02s;animation-delay:-2.6s}
.veil-air i:nth-child(8){top:33%;width:20vw;height:1.5px;--a:.30;animation-duration:1.16s;animation-delay:-1.12s}
.veil-air i:nth-child(9){top:66%;width:20vw;height:1.5px;--a:.28;animation-duration:1.1s;animation-delay:-.91s}
.veil-air i:nth-child(10){top:81%;width:18vw;height:1.5px;--a:.32;animation-duration:1.09s;animation-delay:-1.42s}
.veil-air i:nth-child(11){top:41%;width:26vw;height:2px;--a:.44;animation-duration:.58s;animation-delay:-.66s}
.veil-air i:nth-child(12){top:57%;width:28vw;height:2px;--a:.48;animation-duration:.56s;animation-delay:-.53s}
@keyframes veilAir{from{transform:translateX(100vw)}to{transform:translateX(-100%)}}
/* when the check finishes the lines stretch into a warp and vanish; veilShow
   stays in the list, paused, so lines not yet shown stay unseen */
#veil.hide .veil-air{animation:veilWarp .45s cubic-bezier(.5,0,.9,.4) forwards,veilShow .3s ease .3s backwards paused}
@keyframes veilWarp{to{transform:scaleX(3.2);transform-origin:0 50%;opacity:0}}

/* The figure (Mr Alien's shapes; colours and sizes adapted). */
.veil-runner-stage{position:relative;z-index:1;width:150px;height:58px;overflow:hidden}
#veil.hide .veil-runner-stage{overflow:visible}
.veil-runner-scene{position:absolute;left:50%;top:50%;width:180px;height:76px;transform:translate(-50%,-50%) scale(.72);transform-origin:center}
#veil.hide .veil-runner-scene{animation:veilRunnerExit .5s cubic-bezier(.55,.08,.85,.35) forwards}
.veil-runner{position:absolute;top:50%;left:50%;margin-left:-50px;animation:veilSpeeder .4s linear infinite}
.veil-runner>span{position:absolute;top:-19px;left:60px;width:35px;height:5px;border-radius:2px 10px 1px 0;background:#f4f4f4}
.veil-runner-base span{position:absolute;width:0;height:0;border-top:6px solid transparent;border-right:100px solid #f4f4f4;border-bottom:6px solid transparent}
.veil-runner-base span::before{content:"";position:absolute;right:-110px;top:-16px;width:22px;height:22px;border-radius:50%;background:#f4f4f4}
.veil-runner-base span::after{content:"";position:absolute;top:-16px;right:-98px;width:0;height:0;border-top:0 solid transparent;border-right:55px solid #f4f4f4;border-bottom:16px solid transparent}
.veil-runner-face{position:absolute;right:-125px;top:-15px;width:20px;height:12px;border-radius:20px 20px 0 0;background:#f4f4f4;transform:rotate(-40deg)}
.veil-runner-face::after{content:"";position:absolute;right:4px;top:7px;width:12px;height:12px;border-radius:0 0 0 2px;background:#f4f4f4;transform:rotate(40deg);transform-origin:50% 50%}
.veil-runner>span>span{position:absolute;width:30px;height:1px;background:#f4f4f4;animation:veilFazer1 .2s linear infinite}
.veil-runner>span>span:nth-child(2){top:3px;animation:veilFazer2 .4s linear infinite}
.veil-runner>span>span:nth-child(3){top:1px;animation:veilFazer3 .4s linear -1s infinite}
.veil-runner>span>span:nth-child(4){top:4px;animation:veilFazer4 1s linear -1s infinite}
@keyframes veilFazer1{to{left:-80px;opacity:0}}
@keyframes veilFazer2{to{left:-100px;opacity:0}}
@keyframes veilFazer3{to{left:-50px;opacity:0}}
@keyframes veilFazer4{to{left:-150px;opacity:0}}
@keyframes veilSpeeder{
  0%{transform:translate(2px,1px) rotate(0)}10%{transform:translate(-1px,-3px) rotate(-1deg)}
  20%{transform:translate(-2px,0) rotate(1deg)}30%{transform:translate(1px,2px) rotate(0)}
  40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,3px) rotate(-1deg)}
  60%{transform:translate(-1px,1px) rotate(0)}70%{transform:translate(3px,1px) rotate(-1deg)}
  80%{transform:translate(-2px,-1px) rotate(1deg)}90%{transform:translate(2px,1px) rotate(0)}
  100%{transform:translate(1px,-2px) rotate(-1deg)}
}
@keyframes veilRunnerExit{to{transform:translate(calc(-50% + 80vw),-50%) scale(.72) rotate(-4deg);opacity:0}}

/* No caption at first. Only if the check is still running after 2.5s does this fade in.
   "#veil" in the selector so it beats any page's own "#veil p" rule. */
#veil .veil-still{position:absolute;z-index:1;top:calc(50% + 46px);left:0;right:0;margin:0;text-align:center;
  font-size:13.5px;letter-spacing:.04em;text-transform:none;color:var(--muted,#8b8883);
  opacity:0;animation:veilStill .5s ease 2.5s forwards}
@keyframes veilStill{to{opacity:1}}
#veil.hide .veil-still{animation:none;opacity:0}

@media (prefers-reduced-motion:reduce){
  #veil.hide{transition-delay:0s}
  .veil-air{display:none}
  .veil-runner,.veil-runner>span>span,#veil.hide .veil-runner-scene{animation:none}
}
