/* L'intro de NightFall (intro.js), le « tudum » du site : sur fond noir, NIGHTFALL frappe
 * l'écran en néon rouge, puis « .QUEST » sort de derrière lui, et l'ombre descend. Calée sur
 * intro.mp3 (4,1 s) : coups de synthé à 0,08 et 0,32 s, cor à 1,16 s, traîne éteinte vers
 * 3,6 s. Version 10 choisie par Jean-Gab le 11/10 ; pas de tremblement ni de clignotement
 * rapide (moins de trois éclairs par seconde). */

.intro {
  position: fixed; inset: 0; z-index: 1000;
  overflow: hidden;
  background: #000;
  color-scheme: dark;
}
.intro-logo {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: "League Gothic", Impact, sans-serif;
  font-size: min(12.5vw, 30vh);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
/* Rien ne s'affiche avant le premier coup du son. */
.intro:not(.joue) .intro-logo { visibility: hidden; }
.intro-etire { display: inline-flex; transform: scaleY(1.12); }
.intro-ligne { position: relative; display: inline-flex; align-items: baseline; }
.intro-nf { position: relative; color: var(--rouge, #e50914); }
.intro-halo {
  position: absolute; inset: 0;
  color: var(--rouge, #e50914);
  filter: blur(0.09em);
  opacity: 0.55;
}
.intro-lettres { position: relative; text-shadow: 0 0 0.03em rgba(255, 90, 100, 0.85); }
.intro-lettres span { display: inline-block; }
/* La fenêtre de « .QUEST » commence au bord droit du dernier L : tant qu'il est « derrière »
 * NIGHTFALL, il est coupé, donc jamais visible entre les lettres rouges. */
.intro-cache {
  position: relative;
  display: inline-block;
  overflow: hidden;
  padding: 0.14em 0.3em 0.14em 0;
  margin: -0.14em -0.3em -0.14em 0;
}
.intro-q {
  display: inline-block;
  color: #fff;
  text-shadow: 0 0 0.14em rgba(255, 255, 255, 0.22);
}
.intro-eclat {
  position: absolute; left: 50%; top: 50%;
  width: 85vw; height: 75vh;
  translate: -50% -50%;
  background: radial-gradient(closest-side, rgba(229, 9, 20, 0.4), rgba(229, 9, 20, 0));
  opacity: 0;
  pointer-events: none;
}
.intro-voile {
  position: absolute; left: 0; right: 0; top: 0;
  height: 170%;
  background: linear-gradient(to bottom, #000 60%, rgba(0, 0, 0, 0));
  transform: translateY(-100%);
  pointer-events: none;
}
.intro-passer {
  position: absolute;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding: 0.5rem 0.9rem;
  font: 500 0.82rem/1 "Inter", system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.6);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  animation: intro-apparait 0.4s ease 0.7s forwards;
  transition: color 0.15s, border-color 0.15s;
}
.intro-passer:hover { color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.intro-passer:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.intro.joue .intro-ligne {
  animation:
    intro-frappe 0.38s cubic-bezier(0.12, 0.9, 0.2, 1) both,
    intro-coup 0.34s cubic-bezier(0.16, 1, 0.3, 1) 0.31s;
}
.intro.joue .intro-nf { animation: intro-allume 1s linear both; }
.intro.joue .intro-lettres span:nth-child(3) { animation: intro-capricieuse 0.5s linear 0.44s both; }
.intro.joue .intro-lettres span:nth-child(7) { animation: intro-capricieuse 0.5s linear 0.58s both; }
.intro.joue .intro-eclat { animation: intro-eclat 0.9s ease-out 0.31s forwards; }
.intro.joue .intro-halo { animation: intro-halo 2s ease-in-out 1.1s both; }
.intro.joue .intro-q { animation: intro-quest 0.7s cubic-bezier(0.16, 1, 0.3, 1) 1.1s both; }
.intro.joue .intro-voile { animation: intro-voile 0.8s cubic-bezier(0.65, 0, 0.35, 1) 3.15s forwards; }

/* Le nom arrive de loin, flou, et se pose ; le second coup du synthé le relance un peu. */
@keyframes intro-frappe {
  from { transform: scale(2.4); filter: blur(0.12em); opacity: 0; }
  25% { opacity: 1; }
  to { transform: none; filter: blur(0); opacity: 1; }
}
@keyframes intro-coup { from { transform: scale(1.045); } to { transform: none; } }
/* 0,085 s : le néon cligne une fois ; 0,32 s : il prend. */
@keyframes intro-allume {
  0%, 7% { opacity: 0; }
  8.5% { opacity: 0.75; }
  12% { opacity: 0.08; }
  30.5% { opacity: 0.08; }
  32%, 100% { opacity: 1; }
}
@keyframes intro-capricieuse {
  0% { opacity: 1; } 10% { opacity: 0.15; } 20% { opacity: 0.9; }
  32% { opacity: 0.25; } 44%, 100% { opacity: 1; }
}
@keyframes intro-eclat {
  from { opacity: 1; transform: scale(0.5); }
  to { opacity: 0; transform: scale(1.35); }
}
@keyframes intro-halo { 0% { opacity: 0.55; } 40% { opacity: 0.9; } 100% { opacity: 0.62; } }
@keyframes intro-quest { from { transform: translateX(-102%); } to { transform: none; } }
@keyframes intro-voile { from { transform: translateY(-100%); } to { transform: none; } }
@keyframes intro-apparait { to { opacity: 1; } }

/* Moins d'animations demandées par l'appareil : des fondus, dans le même ordre. */
@keyframes intro-fondu { from { opacity: 0; } to { opacity: 1; } }
@keyframes intro-efface { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .intro.joue * { animation: none !important; }
  .intro.joue .intro-nf { animation: intro-fondu 0.45s ease-out 0.06s both !important; }
  .intro.joue .intro-q { animation: intro-fondu 0.6s ease-out 1.1s both !important; }
  .intro.joue .intro-logo { animation: intro-efface 0.6s ease-in 3.3s forwards !important; }
  .intro .intro-passer { animation: none !important; opacity: 1; }
}
