html {
  overflow-x: hidden;
}
h1 {
  margin-block-start: 0em;
  margin-block-end: 0em;
}
.box {
  height: 13vw;
  width: 13vw;
  background-color: dodgerblue;
  font-size: 40pt;
  z-index: 1;
  margin: 0;
  animation: appear linear;
  animation-timeline: view();
  animation-range: entry 0% cover 40%;
}
.popup img,
.rotatebox img,
.close-popup {
  user-select: none;
}
.rotatebox img {
  pointer-events: none;
}
body {
  /* overflow-x: hidden; */
  max-width: 100vw;
  margin: 0;
  display: flex;
  justify-content: space-around;
  gap: 80px;
  flex-wrap: wrap;
  /* overflow-x: hidden; */
  /* overflow-x: hidden; */
}

.bigbox {
  width: 400px;
  height: 400px;
  z-index: 5;
}

/* Ajoutez ce bloc à votre CSS existant */

/* Style pour faire tourner la bigbox en scrollant */
.rotatebox {
  position: relative;
  width: 70%;
  top: 50vh; /* Positionne au milieu de la fenêtre */
  /* left: 0; */
  transform: translateY(-50%);
  animation: rotate linear;
  animation-timeline: scroll();
  animation-range: 0 100%;
  z-index: 15;
}

#tourne1 {
  top: 380%;
  left: 5%;
  position: absolute;
}

#tourne2 {
  top: 70%;
}

#tourne3 {
  top: 60%;
}

#tourne4 {
  top: 20%;
}

#tourne5 {
  top: 50%;
}

/* L'animation de rotation */
@keyframes rotate {
  from {
    transform: translateY(-50%) rotate(0deg);
  }
  to {
    transform: translateY(-50%) rotate(4000deg);
  }
}

/* Pour positionner la div videos en arrière-plan */
.videos {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  z-index: -1; /* Place la vidéo derrière tous les autres éléments */
  overflow: hidden;
}

/* Pour que la vidéo remplisse tout l'écran */
.videos video {
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: cover; /* Couvre toute la surface sans déformer */
}

/* Conteneur principal qui couvre tout l'écran */
.video-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  z-index: -1;
  display: flex; /* Permet d'aligner les vidéos horizontalement */
  overflow: hidden;
}

/* Style commun pour les conteneurs de vidéos */
.videos {
  flex: 1; /* Chaque vidéo prend 1/3 de l'espace disponible */
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Style pour que les vidéos conservent leur ratio 9:16 */
.videos video {
  height: 100%; /* Hauteur à 100% du conteneur */
  width: auto; /* Largeur automatique pour conserver le ratio */
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%); /* Centre horizontalement la vidéo */
  object-fit: cover; /* Garde le ratio original sans cropper */
}

/* Si vous préférez que les vidéos remplissent leur partie et coupent les bords */
/* Remplacez ce style par celui ci-dessus si vous préférez */
/*.videos video {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center;
  }*/

/* Pour positionner la div videos en arrière-plan */
.fond video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2; /* Place la vidéo derrière tous les autres éléments */
  overflow: hidden;
}

/* Pour que la vidéo remplisse tout l'écran */
.fond video {
  min-width: 100%;
  min-height: 100%;
  position: fixed;
  object-fit: cover; /* Couvre toute la surface sans déformer */
}

/* Styles pour le popup - à ajouter à votre CSS */

/* Styles CSS améliorés pour les popups */

/* Style du popup principal et des popups aléatoires */
.popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 99vw;
  max-width: 99vw;
  height: 100svh;
  /* background-color: rgba(0, 0, 0, 0.7); */
  z-index: 100000000;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Style spécifique au popup principal */
.main-popup {
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
  background-color: transparent;
  display: none;
}

/* Style spécifique aux popups aléatoires */
.random-popup {
  background-color: transparent;
  overflow: hidden;
}

/* Animation d'apparition en fondu */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Conteneur du contenu du popup */
.popup-content {
  position: relative;
  background-color: transparent;
  max-height: 60vh;
  /* max-width: 15%; */
  border-radius: 5px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
  cursor: move; /* Indique que l'élément est déplaçable */
}

/* Style spécifique pour le contenu du popup principal */
.main-popup .popup-content {
  width: 60%;
  /* max-width: 15%; */
  animation: scaleIn 0.3s ease;
  /* display: none; */
}

/* Animation de zoom pour le popup principal */
@keyframes scaleIn {
  from {
    transform: scale(0.8);
  }
  to {
    transform: scale(1);
  }
}

/* Bouton de fermeture */
.close-popup {
  position: absolute;
  top: 0;
  right: 0;
  width: 35px;
  height: 35px;
  font-size: 35px;
  line-height: 30px;
  background-color: blue;
  /* border: 3px solid blue; */
  border-radius: 3px;
  text-align: center;
  color: white;
  cursor: pointer;
  z-index: 12;
  transition: color 0.2s;
  transition: transform 0.2s, background-color 0.2s; /* Animation au survol */
}

.close-popup:hover {
  background-color: darkblue; /* Couleur au survol */
  transform: scale(1.1); /* Agrandir légèrement au survol */
}

/* Conteneur de l'image dans le popup */
.popup-image-container {
  width: 100%;
  height: 100%;
}

/* Image du popup */
.popup-image {
  width: 200px;
  height: auto;
  display: block;
  border: 5px solid blue;
  border-radius: 2px;
  box-sizing: border-box;
}

.title-container {
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  /* padding: 0vh 0.5vh; */
}

.title {
  font-size: 26vh;
  font-weight: bold;
  writing-mode: horizontal-tb;
  padding-top: 0.8vh;
  text-orientation: upright;
  transform: scale(2, 5);
  letter-spacing: -0.11em;
  text-transform: uppercase;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  animation: title 3s infinite;
  line-height: 100vh;
}

@keyframes title {
  0% {
    color: blue;
  }
  10% {
    color: fuchsia;
  }
  20% {
    color: fuchsia;
  }
  40% {
    color: aqua;
  }
  60% {
    color: magenta;
  }
  80% {
    color: lime;
  }
  100% {
    color: blue;
  }
}

/* .facts {
  position: sticky;
  top: 0px;
  background-color: white;
  border-radius: 5px;
  border-color: blue;
  border-width: 2px;
  font-family: "Courier New", Courier, monospace;
  z-index: 10;
} */
@font-face {
  font-family: "Funnel Display";
  src: url(FunnelDisplay-VariableFont_wght.ttf);
}
.facts {
  position: sticky;
  top: 0px;
  width: 100vw; /* Prend toute la largeur de l'écran */
  background-color: white;
  border: 4px solid blue; /* Contour bleu de 2px */
  border-radius: 4px;
  /* font-family: "Courier New", Courier, monospace; */
  font-family: "Funnel Display";
  /* padding: 10px; */
  z-index: 10;
  min-height: calc(100vh / 7);
}

.container {
  clip-path: inset(0 0 0 0);
}

/* .statistic1-container { top: 0; }
        .statistic2-container { top: 60px; }
        .statistic3-container { top: 120px; }
        .statistic4-container { top: 180px; } */

.facts p {
  font-size: 28px;
  color: blue;
  line-height: 1.4;
  word-wrap: break-word; /* Pour que le texte ne déborde pas sur petits écrans */
  max-width: 100%;
  /* padding-left: 5vw; */
  padding: 10px 0 10px 5vw;
}

#fact2 {
  position: sticky;
  top: 80px;
}

#fact3 {
  position: sticky;
  top: 160px;
}

#fact4 {
  position: sticky;
  top: 240px;
}

#fact5 {
  position: sticky;
  top: 320px;
}

#fact6 {
  position: sticky;
  top: 400px;
}

#fact7 {
  position: sticky;
  top: 480px;
}

#fact8 {
  position: sticky;
  top: 560px;
}

#fact9 {
  position: sticky;
  top: 640px;
}

#fact10 {
  position: sticky;
  top: 720px;
}

#fact11 {
  position: sticky;
  top: 800px;
}

#fact2 {
  position: sticky;
  top: calc(100vh / 7 * 1);
}
#fact3 {
  position: sticky;
  top: calc(100vh / 7 * 2);
}
#fact4 {
  position: sticky;
  top: calc(100vh / 7 * 3);
}
#fact5 {
  position: sticky;
  top: calc(100vh / 7 * 4);
}
#fact6 {
  position: sticky;
  top: calc(100vh / 7 * 5);
}
#fact7 {
  position: sticky;
  top: calc(100vh / 7 * 6);
  margin-bottom: 0vh;
}
/* #fact8 {
  position: sticky;
  top: calc(100vh / 8 * 7);
} */

.gallery-container {
  display: grid;
  grid-template-columns: repeat(5, 16vw);
  row-gap: 5vh;
  column-gap: 3vw;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100vw;
  margin: 0;
  padding: 2rem 0;
  box-sizing: border-box;
}

.box {
  height: 16vw; /* Doit correspondre exactement à grid-template-columns */
  width: 16vw; /* Doit correspondre exactement à grid-template-columns */
  margin: 0;
  padding: 0;
}

.endtitle-container {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 99vh;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  background-color: white;
  border: solid blue 5px;
}

.endtitle {
  font-size: 10vw;
  font-weight: bold;
  writing-mode: horizontal-tb;
  text-orientation: upright;
  transform: scale(2, 5); /* Étirement vertical */
  letter-spacing: -0.1em;
  text-transform: uppercase;
  color: blue;
  font-family: Arial, Helvetica, sans-serif;
}

/* @font-face {
  font-family: "NomDeMaPolice";
  src: url("https://fonts.googleapis.com/css2?family=Funnel+Display:wght@300..800&display=swap")
      format("woff2"),
    url("chemin/vers/mapolice.woff") format("woff");
  font-weight: normal;
  font-style: normal;
} */

@media (orientation: portrait) {
  .title-container {
    height: 20dvh; /* svh lvh */
  }
  .title-container:first-child {
    margin-top: 20vh;
  }
  .gallery-container {
    /* column-gap: 26vh;
    column-gap: initial; */
    grid-template-columns: 15% 15% 15%;
    grid-gap: 2.3% 19%;
  }
  .title {
    font-size: 13vw;
  }
}

.box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes appear {
  from {
    opacity: 0;
    scale: 0.5;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}

.box:hover {
  scale: 105%;
  z-index: 3;
  transition-duration: 0.3s;
}

@media screen and (max-width: 768px) {
  .facts p {
    font-size: 20px; /* Réduit la taille de la police pour les petits écrans */
  }
}

/* Ajuster pour mobile */
@media (orientation: portrait) {
  .gallery-container {
    grid-template-columns: repeat(3, 28vw);
    row-gap: 2vh;
    column-gap: 4vw;
  }

  .box {
    height: 26vw; /* Ajusté pour correspondre à la nouvelle taille des colonnes */
    width: 26vw;
  }

  /* Assurer que les images remplissent bien leur container */
  .box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* Media query pour mobile reste inchangé */
@media (orientation: portrait) {
  .gallery-container {
    grid-template-columns: repeat(3, 28vw);
    row-gap: 2vh;
    column-gap: 5vw;
  }

  .box {
    height: 28vw; /* Doit correspondre exactement à grid-template-columns */
    width: 28vw; /* Doit correspondre exactement à grid-template-columns */
  }
}

@media (orientation: portrait) {
  .title-container {
    position: static;
    height: 25dvh; /* Réduit de 33.33vh à 25vh */
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
  }

  .title-container:first-child {
    margin-top: 0;
  }

  .titles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: -5dvh; /* Ajoute un espacement négatif entre les titres */
  }

  .title {
    font-size: 13vw;
    transform: scale(2, 7);
    line-height: 0.8; /* Réduit l'interlignage */
    margin: -5dvh 0; /* Espacement négatif supplémentaire */
  }
}

@media (orientation: portrait) {
  /* Style des popups pour mobile */
  .popup-content {
    position: fixed;
    width: 40vw !important; /* Force une largeur fixe */
    max-width: 79vw !important;
    max-height: 80vh !important;
    transform: none !important;
  }

  /* Ajuste la taille des images dans les popups */
  .popup-image {
    width: 100% !important;
    height: auto !important;
    max-height: 70vh !important;
    object-fit: contain;
  }

  /* Rend le bouton de fermeture plus grand et plus facile à toucher */
  .close-popup {
    width: 44px;
    height: 44px;
    font-size: 40px;
    line-height: 40px;
    top: 0px;
    right: 0px;
    border-radius: 2px;
    background-color: blue;
    color: white;
    touch-action: manipulation;
  }

  /* Empêche le défilement du fond quand un popup est ouvert */
  body.popup-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
}

@media (orientation: portrait) {
  /* Ajustement des rotatebox pour mobile */
  .rotatebox {
    width: 40%; /* Réduit la largeur */
    height: auto;
    overflow: hidden;
  }

  .rotatebox img {
    width: 100%;
    height: auto;
    max-width: 100%;
  }

  /* Ajustement des positions spécifiques */
  #tourne1 {
    top: 380%;
    left: 2%; /* Réduit la marge à gauche */
  }

  #tourne2 {
    top: 70%;
    left: 3%;
  }

  #tourne3 {
    top: 60%;
    left: 0;
  }

  #tourne4 {
    top: 20%;
    left: 0;
  }

  #tourne5 {
    top: 50%;
    left: 0;
  }

  #tourne6 {
    top: 50%;
    left: 0;
  }

  #tourne7 {
    top: 50%;
    left: 0;
  }

  #tourne12 {
    top: 50%;
    left: 0;
  }

  #tourne13 {
    top: 50%;
    left: 0;
  }

  #tourne14 {
    top: 50%;
    left: 0;
  }

  #tourne15 {
    top: 50%;
    left: 0;
  }

  #tourne18 {
    top: 50%;
    left: 0;
  }

  #tourne19 {
    top: 50%;
    left: 0;
  }

  #tourne20 {
    top: 50%;
    left: 0;
  }

  #tourne24 {
    top: 50%;
    left: 0;
    width: 20%;
  }

  #tourne25 {
    top: 50%;
    left: 0;
    width: 20%;
  }

  #tourne26 {
    top: 50%;
    left: 0;
  }

  #tourne27 {
    top: 50%;
    left: 0;
  }
}
