/* Rune Nissen – the front page loading: the NP logo in chrome turns on the closed curtain, over the embroidered
   SHOWREEL, until the showreel can play (js/hero.js, js/np-logo.js); then it comes to rest facing front and goes as the
   curtain opens. Until then the page cannot be scrolled (html.rn-lock, set in index.html's head, lifted by js/hero.js). */

/* Over SHOWREEL, small, like light thrown on the cloth by a projector: let through by the velour (screen), a little
   faint, flickering now and then. SHOWREEL's picture starts .605 of its size over the middle (one line, css/hero.css)
   or 1.04 (stacked); the logo's canvas has room round it to turn, so it is set by the bottom of the logo itself
   (86 % down the canvas). Too low a screen (a phone on its side) has no room for it under the name. */
.np-load {
  --f: clamp(64px, min(16vw, 36vh), 280px);
  position: absolute; left: 50%; top: calc(50% - var(--f) * .605 - 2vh); z-index: 6;
  width: min(14vw, 200px, 22vh); aspect-ratio: 2 / 1.1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .82;
  transform: translate(-50%, -86%);
  animation: np-flicker 4.2s steps(1, end) infinite;
  transition: opacity .35s ease, transform .45s cubic-bezier(.4,0,.2,1);
}
@media (max-aspect-ratio: 4/5) {
  .np-load { --f: min(34vw, 19vh); top: calc(50% - var(--f) * 1.04 - 2vh); width: min(36vw, 200px); }
}
@media (max-height: 480px) { .np-load { display: none; } }
@keyframes np-flicker { 0%, 100% { opacity: .82; } 31% { opacity: .7; } 33% { opacity: .86; } 64% { opacity: .76; } 66% { opacity: .82; } 88% { opacity: .66; } 89% { opacity: .84; } }
.np-load canvas, .np-flat { position: absolute; inset: 0; width: 100%; height: 100%; }
.np-load canvas { opacity: 0; }
/* The flat logo in the faces' chrome, the size the 3D one shows facing front (71 % of the canvas's height, 81 % of its
   width, a little tipped back) */
.np-flat {
  inset: 14.5% 9.5%;
  width: auto; height: auto;
  background: repeating-linear-gradient(180deg, rgba(10,30,40,0) 0 7px, rgba(10,30,40,.16) 7px 9px),
    linear-gradient(180deg, #f4fbff 0%, #bfe0f2 18%, #6fa6c4 42%, #eef7fb 53.5%, #fff 55%, #3a4a52 56.5%, #5d6f78 70%, #aebcc3 88%, #e3ebef 100%);
  -webkit-mask: url(../img/logo/np.svg) center / contain no-repeat;
  mask: url(../img/logo/np.svg) center / contain no-repeat;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}
.np-load.is-3d canvas { opacity: 1; }
.np-load.is-3d .np-flat { opacity: 0; transition: opacity .2s ease; }

/* Loaded: the projector goes off – it sinks back a little and is gone before the curtain moves */
.np-load.is-done { animation: none; opacity: 0; transform: translate(-50%, -86%) scale(.86); }
.is-open .np-load { visibility: hidden; transition: opacity .35s ease, transform .45s cubic-bezier(.4,0,.2,1), visibility 0s .45s; }

/* No scrolling while the curtain is shut (the page's own scroll; js/hero.js also holds back a swipe, the wheel and the
   scrolling keys, but not in the menu if it is opened) */
html.rn-lock, html.rn-lock body { overflow: hidden; overscroll-behavior: none; }
html.rn-lock { scrollbar-gutter: stable; } /* the scrollbar's room kept, so nothing moves sideways as it comes back */

@media (prefers-reduced-motion: reduce) {
  .np-load { animation: none; transition: none; }
}
