/* ======================================================================
   LOADER — écran de chargement, puis passage au hero
   Balisage : index.html, <div class="loader" id="loader">
   Script   : sections/01-loader/loader.js
   ====================================================================== */

.loader { display: none; }

/* the page does not scroll under it */
html.is-loading { overflow: hidden; }

html.is-loading .loader {
  /* side of the logo's 48-unit grid; the whole loader is sized from it */
  --m: clamp(72px, 7.4vw, 112px);
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--loader-sky-top, #cee8fb);
  touch-action: none;
}

/* The hero's sky, rebuilt with the rules of .hero-art / .hero-portrait: same gradient strip,
   same geometry, same settle into navy at the foot. The script copies the strips the page
   recomputes from the film, so both backgrounds overlap exactly when the loader fades. */
.loader-sky {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--loader-hero-h, 100%);
}

.loader-sky-main { display: none; }

.loader-sky-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
}

.loader-sky-portrait {
  position: absolute;
  right: 0;
  bottom: -1%;
  width: min(63cqh, max(35.7cqw, 57cqh), 52cqw);
  aspect-ratio: 9 / 16;
}

.loader-sky-portrait::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 100cqw;
  height: 100%;
  background: var(--loader-sky-base, url('../../assets/hero/hero-sky-base.png')) center / 100% 100% no-repeat;
}

.loader-sky-art::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 13%;
  z-index: 2;
  background: var(--hero-sky-bottom, #002565);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgb(0 0 0 / .14) 30%, rgb(0 0 0 / .52) 62%, rgb(0 0 0 / .86) 86%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0, rgb(0 0 0 / .14) 30%, rgb(0 0 0 / .52) 62%, rgb(0 0 0 / .86) 86%, #000 100%);
}

.loader-lockup {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
}

.loader-logo {
  display: flex;
  align-items: center;
}

/* The mark's grid keeps 6 units of margin out of 48: the negative margins bring the
   visible edge of the squares back onto the edge of the block. */
.loader-mark {
  display: block;
  flex: none;
  width: var(--m);
  height: var(--m);
  margin: calc(var(--m) * -0.125);
  margin-right: calc(var(--m) * 0.2);
}

.loader-word {
  display: flex;
  font: 600 calc(var(--m) * 0.8) / 1.15 var(--font-sans);
  letter-spacing: -0.02em;
  color: var(--ink-dark);
  white-space: nowrap;
}

/* each letter rises behind a mask that only cuts at the bottom */
.loader-word span {
  display: inline-block;
  clip-path: inset(-0.3em -0.2em 0 -0.2em);
}

.loader-word i {
  display: inline-block;
  font-style: normal;
  transform: translateY(108%);
  will-change: transform;
}

.loader-bar {
  position: relative;
  height: clamp(3px, calc(var(--m) * 0.045), 5px);
  margin-top: calc(var(--m) * 0.4);
  border-radius: 99px;
  background: rgb(6 13 34 / .13);
  clip-path: inset(0 round 99px);
  opacity: 0;
}

.loader-bar i {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--peach);
  transform: translateX(-100.5%);
  will-change: transform;
}

/* On mobile the hero stacks its text (a flat sky) above the film: same split here, the
   film being replaced by the gradient of its own sky, which grows out of the flat tone. */
@media (max-width: 720px) {
  .loader-sky {
    display: flex;
    flex-direction: column;
    background: var(--loader-sky-row, url('../../assets/hero/hero-sky-row.png')) center / 100% 100% no-repeat;
  }

  .loader-sky-main {
    display: block;
    flex: 1;
  }

  .loader-sky-art {
    position: relative;
    inset: auto;
    flex: none;
    width: 100%;
    aspect-ratio: 9 / 12;
  }

  .loader-sky-portrait {
    width: 100%;
    bottom: 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent 25%, #000 70%);
    mask-image: linear-gradient(to bottom, transparent 25%, #000 70%);
  }

  .loader-sky-portrait::before { width: 100%; }
  .loader-sky-art::after { height: 17%; }
}
