/* ==========================================================================
   Loading screen: scissors snip along a dashed line under the wordmark.
   When the page is ready the black screen is "cut" open: two halves slide
   apart (top up, bottom down) and the page appears. Driven by
   js/preloader.js, which adds .pl-out (open) and .pl-done (remove).
   ========================================================================== */

#preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;                     /* above the navbar and lightbox */
  background: transparent;
  pointer-events: auto;
}
#preloader.pl-done { display: none; }

/* the two halves of the curtain */
#preloader .pl-half {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.2%;                       /* tiny overlap: no hairline gap between the halves */
  background: #0b0b0c;
  transition: transform 1s cubic-bezier(.76, 0, .24, 1);
  will-change: transform;
}
#preloader .pl-top { top: 0; }
#preloader .pl-bottom { bottom: 0; }
#preloader.pl-out .pl-top { transform: translateY(-101%); }
#preloader.pl-out .pl-bottom { transform: translateY(101%); }

/* centre: wordmark, then the cutting line */
#preloader .pl-center {
  position: absolute;
  left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  text-align: center;
  transition: opacity .35s ease, transform .5s cubic-bezier(.4, 0, 1, 1);
}
#preloader.pl-out .pl-center { opacity: 0; transform: translateY(-50%) scale(.97); }

#preloader .pl-mask { display: inline-block; overflow: hidden; padding-bottom: 4px; }
#preloader .pl-logo {
  display: block;
  height: clamp(44px, 9vw, 60px);
  width: auto;
  animation: pl-rise 1.1s cubic-bezier(.2, .8, .2, 1) .15s both;
}

#preloader .pl-line {
  position: relative;
  width: min(250px, 64vw);
  height: 1px;
  margin: 38px auto 0;
  /* the dashed "cut here" line */
  background-image: repeating-linear-gradient(to right, rgba(255, 255, 255, .42) 0 5px, transparent 5px 11px);
  animation: pl-fade .8s ease .6s both;
}
/* cut away: hides the dashes behind the scissors */
#preloader .pl-gone {
  position: absolute;
  left: 0; top: -2px;
  height: 5px;
  width: 0;
  background: #0b0b0c;
  animation: pl-gone 2.1s cubic-bezier(.45, 0, .25, 1) 1s infinite;
}
#preloader .pl-scissors {
  position: absolute;
  left: 0; top: 50%;
  width: 58px; height: 25px;
  margin: -12.5px 0 0 -46px;           /* blade tips lead the cut */
  animation: pl-travel 2.1s cubic-bezier(.45, 0, .25, 1) 1s infinite;
}
#preloader .pl-scissors svg { display: block; width: 100%; height: 100%; overflow: visible; }

@keyframes pl-rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes pl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pl-travel { 0% { left: 0; opacity: 0; } 8% { opacity: 1; } 88% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes pl-gone { 0% { width: 0; } 100% { width: 100%; } }

/* the page behind waits for the curtain before it starts */
html.pl-lock, html.pl-lock body { overflow: hidden; }
body:not(.loaded) #hero .wr-line > span,
body:not(.loaded) #hero .wr-line > h1 { animation-play-state: paused; }

@media (max-width: 575px) {
  #preloader .pl-line { margin-top: 30px; }
}
