/* =========================================================
   🌍 STYLE GLOBAL
========================================================= */
body {
  font-family: Arial, sans-serif;
  text-align: justify;
  margin: 0;
  padding: 0;
  background-color: #fafafa;
  color: #623802; /* couleur principale du texte */
  overflow-x: hidden !important; /* 🔒 Empêche tout défilement horizontal */
  width: 100%;
  max-width: 100%;
}

/* =========================================================
   🧭 EN-TÊTE
========================================================= */
header {
  background-image: url("images/image-haut-ensam.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: white;
  padding: 2rem;
  text-align: center;

  width: 100vw; /* ✅ largeur égale à la largeur de la fenêtre */
  max-width: 100vw; /* ✅ empêche tout dépassement */
  margin: 0;
  left: 0;
  right: 0;
  position: relative;
  box-sizing: border-box;
  overflow-x: hidden; /* ✅ supprime les débordements horizontaux */
}


header h1 {
  font-size: 3rem;
  margin: 0;
  font-weight: bold;
}

header h2 {
  font-size: 1.5rem;
  margin-top: 0.5rem;
  font-weight: normal;
}

header h3 {
  font-size: 1rem;
  margin-top: 0.5rem;
  font-weight: normal;
}

/* =========================================================
   🔗 NAVIGATION
========================================================= */
nav ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
}

nav ul li {
  display: inline-block;
  margin: 0 10px;
}

nav ul li a {
  color: white;
  text-decoration: none;
  font-weight: bold;
}

nav ul li a:hover {
  text-decoration: underline;
}

/* =========================================================
   📄 SECTIONS
========================================================= */
section {
  padding: 2rem;
  max-width: 900px;
  margin: auto;
}

/* =========================================================
   🧱 PROJETS (grille à 3 colonnes)
========================================================= */
.projets-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
  overflow: hidden;
}

.projets-container-CI {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 20px;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
  overflow: hidden;
}

.projet {
  background-color: #f9f9f9;
  border-radius: 20px;
  text-align: center;
  padding: 15px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  transform-origin: center center;
  will-change: transform;
}

.projet:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.projet img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* =========================================================
   🚗 PAGE TOYOTA
========================================================= */
.contenu {
  margin: 40px auto;
  max-width: 1000px;
}

.bloc-gauche,
.bloc-droit,
.bloc-milieu,
.bloc-ligne,
.bloc-multi {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
  box-sizing: border-box;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

.bloc-droit {
  flex-direction: row-reverse;
}

.bloc-milieu {
  flex-direction: column;
  text-align: center;
}

.bloc-milieu img {
  max-width: 80%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  display: block;
  margin: 0 auto;
}

.bloc-ligne img {
  width: 30%;
  min-width: 250px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  object-fit: cover;
  display: block;
  margin: 0 auto;
}

.images {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  align-items: center;
}

.photo,
.photo-multi {
  width: 90%;
  max-width: 400px;
  border-radius: 10px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.texte {
  flex: 1;
  text-align: justify;
  line-height: 1.6;
  width: 100%;
}

/* =========================================================
   📱 RESPONSIVE DESIGN
========================================================= */
@media (max-width: 900px) {
  .projets-container {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 🔧 Images et textes en colonne */
  .bloc-gauche,
  .bloc-droit,
  .bloc-multi {
    flex-direction: column !important;
    align-items: center;
    text-align: center;
  }

  .texte {
    width: 100%;
    text-align: justify;
    padding: 0 10px;
  }

  .photo,
  .photo-multi {
    width: 90%;
    max-width: 400px;
  }

  .images {
    align-items: center;
  }

  img {
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .projets-container {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   ⚫ PIED DE PAGE
========================================================= */
footer {
  text-align: center;
  background-color: #2d2d2d;
  color: white;
  padding: 1rem;
}

/* =========================================================
   📱 LISIBILITÉ MOBILE AMÉLIORÉE
========================================================= */
@media (max-width: 700px) {
  body {
    font-size: 16px;
    line-height: 1.8;
    padding: 0 15px;
    text-align: justify;
    hyphens: auto;
  }

  section {
    padding: 1.5rem 1rem;
  }

  p, li {
    margin-bottom: 1.2em;
  }

  h2, h3 {
    text-align: center;
  }

  a {
    word-break: break-word;
  }
}

/* =========================================================
   📱 CENTRAGE DES IMAGES DE LA SECTION ÉTUDE SUR MOBILE
========================================================= */
@media (max-width: 900px) {
  .projets-container {
    grid-template-columns: repeat(2, 1fr);
    justify-items: center; /* ✅ centre chaque projet dans la grille */
  }
}

@media (max-width: 600px) {
  .projets-container {
    grid-template-columns: 1fr; /* une seule colonne */
    justify-items: center; /* ✅ centre le contenu dans la colonne */
  }

  .projet {
    width: 90%; /* ✅ garde un peu d’espace sur les côtés */
    margin: 0 auto;
  }

  .projet img {
    display: block;
    margin-left: auto;
    margin-right: auto;
  }
}
