/* charles-v2. Igloo personnel. Sombre. Un mot, puis une phrase. */

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: 0.4rem;
  z-index: 40;
  transform: translateY(-140%);
}

.skip:focus {
  transform: none;
}

/* HUD. Trois mots. Toujours la. */

.tete {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  height: var(--header-h);
  max-height: var(--header-h);
  background: linear-gradient(180deg, var(--veil) 0%, transparent 100%);
  border-bottom: 0;
  color: var(--fg);
}

.tete__marque {
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: max(14px, var(--fs-sm));
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
  flex-wrap: nowrap;
}

.hud a {
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: max(14px, var(--fs-sm));
  letter-spacing: 0.06em;
  text-transform: none;
  min-height: var(--tap-min);
  padding-inline: 0.55rem;
}

.hud a[aria-current="page"] {
  color: var(--accent);
}

@media (max-width: 600px) {
  .nom-long {
    display: none;
  }

  .hud a {
    padding-inline: 0.4rem;
  }
}

/* Le document ne pousse pas le hero sous la barre : le pin prend tout. */

main.page {
  padding-top: 0;
  padding-right: 0;
  padding-left: 0;
}

.hero-nom {
  position: absolute;
  top: calc(var(--header-h) + 0.85rem);
  left: max(var(--gutter), var(--safe-left));
  z-index: 4;
  margin: 0;
  font-family: var(--font-mono);
  font-size: max(14px, var(--fs-sm));
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-mute);
  pointer-events: none;
}

/* Chapitre 3D. Defilement lent : beaucoup de course, huit puis onze beats. */

.chapitre-3d {
  position: relative;
  height: auto;
}

html.socle-defilement:not(.socle-reduit) .chapitre-3d--huit {
  height: 880vh;
}

html.socle-defilement:not(.socle-reduit) .chapitre-3d--onze {
  height: 1100vh;
}

.chapitre-pin {
  position: sticky;
  top: 0;
  height: 100svh;
  height: 100vh;
  overflow: hidden;
}

.scene,
#scene-host,
.scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#scene-host {
  pointer-events: none;
}

.scene__poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  padding: calc(var(--header-h) + 1.5rem) var(--gutter) 2.5rem;
  background: var(--bg);
}

.scene__poster[hidden] {
  display: none;
}

.beats {
  position: relative;
  z-index: 2;
  height: 100%;
}

[data-beat] {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: calc(var(--header-h) + 2.5rem) max(var(--gutter), var(--safe-left)) 3rem;
  opacity: 0;
  pointer-events: none;
}

[data-beat].is-on {
  opacity: 1;
  pointer-events: auto;
}

/* Un mot, puis une phrase. */

.beat-copy .verbes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.9rem 0 0;
}

.beat-copy.sur-decor,
.sur-decor.beat-copy {
  max-width: min(22ch, 92vw);
  padding: 0.4rem 0.2rem 0.8rem;
  background-color: transparent;
  background-image: linear-gradient(
    180deg,
    transparent 0%,
    var(--veil) 28%,
    var(--veil) 100%
  );
}

.beat-copy.sur-decor::before {
  background: transparent;
}

.beat__mot {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 11vw, 7.25rem);
  font-weight: var(--fw-bold);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--fg);
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 500ms var(--ease-appear),
    transform 500ms var(--ease-appear);
}

.beat__phrase {
  margin: 0;
  max-width: 22ch;
  font-family: var(--font-body);
  font-size: clamp(1.15rem, 2.4vw, 1.65rem);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
  color: var(--fg);
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity 280ms var(--ease-ui),
    transform 280ms var(--ease-ui);
}

[data-beat].is-on .beat__mot {
  opacity: 1;
  transform: none;
}

[data-beat].is-on .beat__phrase {
  opacity: 1;
  transform: none;
  transition-delay: 480ms;
  transition-duration: 700ms;
  transition-timing-function: var(--ease-appear);
}

.barre-p {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  height: 2px;
  background: var(--line);
  pointer-events: none;
}

.barre-p::after {
  content: "";
  display: block;
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  background: var(--accent);
}

/* Palier final. Voir le travail. Ecrire. */

.palier,
.suite,
.livre {
  position: relative;
  z-index: 3;
  background: var(--bg);
}

.palier {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(var(--header-h) + 2rem) max(var(--gutter), var(--safe-left)) 4rem;
  max-width: 40rem;
}

.palier .t-headline {
  max-width: 14ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.suite {
  padding: 4rem max(var(--gutter), var(--safe-left)) 6rem;
  max-width: 44rem;
}

.preuves-rail {
  display: grid;
  gap: 3rem;
  margin-top: 2.5rem;
}

.preuve {
  max-width: 32rem;
}

.cas__photo {
  min-height: 5.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.75rem;
  background: var(--bg-mute);
  color: var(--fg-mute);
  text-align: center;
  padding: 1rem;
  font-size: max(14px, var(--fs-sm));
}

.formulaire {
  margin-top: 1.5rem;
  max-width: 28rem;
}

.champ {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.champ__ctrl {
  min-height: var(--tap-min);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
}

.pied {
  padding: 2rem max(var(--gutter), var(--safe-left));
  border-top: 1px solid var(--line);
  color: var(--fg-mute);
  background: var(--bg);
}

.pied__liens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0.75rem 0;
}

.pied a {
  color: var(--fg);
  text-decoration: none;
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
}

.pied__note {
  max-width: 52ch;
  font-size: max(14px, var(--fs-sm));
}

/* Travail : 11 fiches, une par ecran, rares. */

.livre {
  padding: 0 max(var(--gutter), var(--safe-left)) 4rem;
}

.livre .projet,
.livre .carte.projet {
  min-height: 88svh;
  display: grid;
  align-content: end;
  gap: 1rem;
  padding: 5rem 0 3rem;
  max-width: 36rem;
  border-top: 1px solid var(--line);
}

.livre .projet .carte__media {
  max-width: 22rem;
}

.livre .projet .carte__media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg-mute);
}

.livre .carte__verbe {
  position: static;
  opacity: 1;
  pointer-events: auto;
  margin: 0.4rem 0 0;
  width: fit-content;
}

.page--404 {
  min-height: 100svh;
}

.palier--404 {
  min-height: 100svh;
}

/* Sans JS, ou mouvement reduit : les beats se lisent en pile. */

html:not(.socle-defilement) .chapitre-3d,
html.socle-reduit .chapitre-3d {
  height: auto;
}

html:not(.socle-defilement) .chapitre-pin,
html.socle-reduit .chapitre-pin {
  position: relative;
  height: auto;
  min-height: 100svh;
  overflow: visible;
}

html:not(.socle-defilement) .beats,
html.socle-reduit .beats {
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
  padding: calc(var(--header-h) + 3rem) max(var(--gutter), var(--safe-left)) 4rem;
}

html:not(.socle-defilement) [data-beat],
html.socle-reduit [data-beat] {
  position: relative;
  inset: auto;
  display: block;
  padding: 0;
  opacity: 1;
  pointer-events: auto;
}

html:not(.socle-defilement) .beat__mot,
html:not(.socle-defilement) .beat__phrase,
html.socle-reduit .beat__mot,
html.socle-reduit .beat__phrase,
html.socle-reduit [data-beat].is-on .beat__mot,
html.socle-reduit [data-beat].is-on .beat__phrase {
  opacity: 1;
  transform: none;
  transition: none;
}

html:not(.socle-defilement) .scene__poster .sur-decor,
html.socle-reduit .scene__poster .sur-decor {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-beat] {
    opacity: 0;
  }

  [data-beat].is-on,
  html.socle-reduit [data-beat],
  html:not(.socle-defilement) [data-beat] {
    opacity: 1;
  }

  .beat__mot,
  .beat__phrase,
  [data-beat].is-on .beat__mot,
  [data-beat].is-on .beat__phrase {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .chapitre-3d {
    height: auto;
  }

  .chapitre-pin {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .beats {
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    padding: calc(var(--header-h) + 3rem) max(var(--gutter), var(--safe-left)) 4rem;
  }

  [data-beat] {
    position: relative;
    inset: auto;
    display: block;
    padding: 0;
    pointer-events: auto;
  }
}
