/* Ouverture (splash) de l'accueil : le mot KRONIX plein écran. Chaque lettre a deux tracés, son dessin dans
   Archivo puis ses pixels sur sept rangs, et saute de l'un à l'autre par coupes franches jusqu'à ce que le mot
   soit net ; le rideau s'efface alors par carreaux (ouverture.js). Durées dans tokens.css. Rien ne se joue en
   mouvement réduit, en couleurs forcées, à l'impression, ni venu d'une autre page (classe sans-ouverture). */

.ouverture {
  display: none;
}

@media screen and (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  /* Le mot a la largeur du cadre, comme les mots géants ; le SVG le centre dans l'écran. */
  :root:not(.sans-ouverture) .ouverture {
    position: fixed;
    inset: 0;
    z-index: 100; /* devant tout : la première touche écarte le rideau */
    display: block;
    width: 100%;
    height: 100%;
    padding: var(--marge) max(var(--marge), (100% - var(--cadre-max)) / 2);
    background: var(--brume);
    fill: var(--encre);
    animation: ouverture-sortie var(--ouverture-sortie) step-end calc(var(--ouverture-jeu) + var(--ouverture-pose)) forwards;
  }

  /* Tracé net rempli par fill, pixels par currentColor : l'animation de la lettre échange ces deux couleurs. */
  .ouverture__lettre {
    color: transparent;
    animation: var(--ouverture-jeu) step-end;
  }

  .ouverture__lettre :last-child {
    fill: currentColor;
    shape-rendering: crispEdges;
  }

  .ouverture__lettre:nth-child(1) { animation-name: ouverture-k; }
  .ouverture__lettre:nth-child(2) { animation-name: ouverture-r; }
  .ouverture__lettre:nth-child(3) { animation-name: ouverture-o; }
  .ouverture__lettre:nth-child(4) { animation-name: ouverture-n; }
  .ouverture__lettre:nth-child(5) { animation-name: ouverture-i; }
  .ouverture__lettre:nth-child(6) { animation-name: ouverture-x; }
}

/* Le jeu : six temps, puis le mot net. Première ligne : la lettre passe en pixels ; seconde : au net. */
@keyframes ouverture-k {
  0%, 36% { fill: transparent; color: var(--encre); }
  20%, 52% { fill: var(--encre); color: transparent; }
}

@keyframes ouverture-r {
  0%, 64% { fill: transparent; color: var(--encre); }
  36%, 82% { fill: var(--encre); color: transparent; }
}

@keyframes ouverture-o {
  0%, 36% { fill: transparent; color: var(--encre); }
  20%, 64% { fill: var(--encre); color: transparent; }
}

@keyframes ouverture-n {
  0%, 52%, 82% { fill: transparent; color: var(--encre); }
  36%, 64% { fill: var(--encre); color: transparent; }
}

@keyframes ouverture-i {
  0%, 64% { fill: transparent; color: var(--encre); }
  52%, 82% { fill: var(--encre); color: transparent; }
}

@keyframes ouverture-x {
  0%, 36%, 82% { fill: transparent; color: var(--encre); }
  20%, 64% { fill: var(--encre); color: transparent; }
}

/* La sortie : sans script, le rideau disparaît d'un coup ; ouverture.js y découpe ses carreaux. */
@keyframes ouverture-sortie {
  to { visibility: hidden; }
}
