/*
 * Accueil, hero : plein écran sous la barre transparente, image d'attente puis vidéo en fondu, voile du
 * haut et du bas (--overlay-hero), titre en bas à gauche, compteurs sous un trait.
 */
@layer pages {
  .p-accueil-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100svh;
    overflow: hidden;
    padding-top: calc(var(--site-header-h) + var(--sp-10));
    padding-bottom: var(--sp-8);
    background: var(--c-ink);

    &::after {
      content: '';
      position: absolute;
      inset: 0;
      background: var(--overlay-hero);
    }
  }

  .p-accueil-hero__fond {
    position: absolute;
    inset: 0;
  }

  .p-accueil-hero__image,
  .p-accueil-hero__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .p-accueil-hero__video {
    opacity: 0;
    transition: opacity var(--t-reveal) var(--ease-reveal);
  }

  .p-accueil-hero[data-video-fond-lecture] .p-accueil-hero__video {
    opacity: 1;
  }

  .p-accueil-hero__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--sp-10);
  }

  .p-accueil-hero__texte {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-4);
    max-width: var(--prose);
  }

  /* Apparition en cascade, après le fondu entre les pages (--t-page), plus ample et plus lente que celle
     des sections : titre, accroche, bouton, puis chaque compteur */
  .p-accueil-hero [data-reveal] {
    --reveal-from: translateY(var(--sp-10));

    animation-duration: calc(2 * var(--t-reveal));
    animation-delay: calc(var(--t-page) + var(--reveal-index, 0) * 2 * var(--stagger));
  }

  .p-accueil-hero__texte > [data-reveal]:nth-child(2) { --reveal-index: 1; }
  .p-accueil-hero__texte > [data-reveal]:nth-child(3) { --reveal-index: 2; }
  .p-accueil-hero__compteurs > [data-reveal]:nth-child(1) { --reveal-index: 3; }
  .p-accueil-hero__compteurs > [data-reveal]:nth-child(2) { --reveal-index: 4; }
  .p-accueil-hero__compteurs > [data-reveal]:nth-child(3) { --reveal-index: 5; }
  .p-accueil-hero__compteurs > [data-reveal]:nth-child(n + 4) { --reveal-index: 6; }

  .p-accueil-hero__titre {
    color: var(--tone-heading);
    font-size: var(--fs-4xl);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-heading);
    text-wrap: balance;
  }

  .p-accueil-hero__accent {
    color: var(--c-sky);
  }

  .p-accueil-hero__accroche {
    color: var(--c-on-dark-strong);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
  }

  .p-accueil-hero__compteurs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-5);
    margin: 0;
    padding: var(--sp-6) 0 0;
    border-top: 1px solid var(--c-line-on-dark);
    list-style: none;
  }

  @media (min-width: 768px) {
    .p-accueil-hero {
      padding-bottom: var(--sp-10);
    }

    .p-accueil-hero__compteurs {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }
}
