/* ============================= */
/*        GRILLE PRINCIPALE      */
/* ============================= */

.grille-encart {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 20px;
  box-sizing: border-box;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 10px;
}

/* --- ENCARDS --- */

.encart1 { grid-column: 1 / span 8; grid-row: 1; } /* --- affiche --- */
.encart2 { grid-column: 1 / span 3; grid-row: 2 / span 2; } /* --- resume --- */
.encart3 { grid-column: 4 / span 5; grid-row: 2; } /* --- infos --- */
.encart4 { grid-column: 4 / span 5; grid-row: 3; } /* --- photos --- */

/* --- STYLE GENERAL DES ENCARDS --- */
.encart {
  background-color: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  box-sizing: border-box;
}

.encart h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: #7dc8e5;
  text-align: left;
}

h3 {
  font-size: clamp(0.8rem, 1.2vw, 0.9rem);
}

.encart img {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================= */
/*          CAROUSELS            */
/* ============================= */

.carousel-container {
  position: relative;
  margin-top: 20px;
  overflow: hidden;
}

.carousel {
  display: flex;
  gap: 20px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.carousel-track {
  display: flex;
  gap: 20px;
}

.carousel-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.carousel-item img {
  display: block;
  height: 200px; /* Hauteur standard des miniatures */
  width: auto;
}

/* Boutons du carousel */
.carousel-btn { 
    position: absolute; 
    background: none; 
    border: none; 
    color: #7dc8e5; 
    font-size: 2rem; 
    font-weight: bold; 
    cursor: pointer; 
    z-index: 10; 
    top: 0; bottom: 0; 
    margin: auto; 
    height: 200px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

/* Flèches standard */
.carousel-btn.left { left: 10px; }
.carousel-btn.right { right: 10px; }

/* ============================= */
/*          LIGHTBOX             */
/* ============================= */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.lightbox img {
  max-width: 80vw;
  max-height: 80vh;
  border-radius: 8px;
}

.lightbox button {
  position: absolute;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

.close-btn { top: 20px; right: 20px; }
.prev-btn { left: 20px; top: 50%; transform: translateY(-50%); }
.next-btn { right: 20px; top: 50%; transform: translateY(-50%); }

/* ============================= */
/*      TABLETTE ET MOBILE       */
/* ============================= */

@media (max-width: 992px) {
  .grille-encart {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 10px;
  }

  /* Ordre tablette */
  .encart1 { order: 1; }
  .encart2 { order: 2; }
  .encart3 { order: 3; }
  .encart4 { order: 4; }

  /* Scroll tactile carousel et suppression flèches */
  .carousel { overflow-x: auto; }
  .carousel::-webkit-scrollbar { display: none; }
  .carousel-btn { display: none !important; }

  /* Eviter débordement */
  .carousel-track, .carousel-item {
    min-width: auto;
    flex: 0 0 auto;
  }
}

@media (max-width: 600px) {
  .grille-encart {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 10px;
  }

  /* Ordre mobile identique à tablette */
  .encart1 { order: 1; }
  .encart2 { order: 2; }
  .encart3 { order: 3; }
  .encart4 { order: 4; }

  /* Scroll tactile carousel et suppression flèches */
  .carousel { overflow-x: auto; }
  .carousel::-webkit-scrollbar { display: none; }
  .carousel-btn { display: none !important; }

  .carousel-track, .carousel-item {
    min-width: auto;
    flex: 0 0 auto;
  }
}

/* ============================= */
/*       DESKTOP (scroll caché)  */
/* ============================= */
@media (min-width: 1025px) {
  .carousel { overflow-x: hidden; }
}
