/* ============================= */
/*        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 5; grid-row: 1 / span 3; }
.encart2 { grid-column: 6 / span 3; grid-row: 1; }
.encart3 { grid-column: 6 / span 3; grid-row: 3; }
.encart4 { grid-column: 6 / span 3; grid-row: 2; }
.encart5 { grid-column: 4 / span 5; grid-row: 4; }
.encart6 { grid-column: 1 / span 8; grid-row: 7; }
.encart7 { grid-column: 1 / span 3; grid-row: 4; }
.encart8 { grid-column: 1 / span 2; grid-row: 6; }
.encart9 { grid-column: 3 / span 6; grid-row: 6; }
.encart10 { grid-column: 1 / span 4; grid-row: 8; }
.encart11 { grid-column: 5 / span 4; grid-row: 8; }

/* --- TABLEAU BOX-OFFICE --- */

.box-office {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.box-office th,
.box-office td {
  padding: 8px 10px;
  border-bottom: 1px solid #e0e0e0;
}

.box-office th {
  text-align: left;
  color: #000000;
  font-weight: 600;
}

.box-office td:nth-child(2),
.box-office td:nth-child(3) {
  text-align: right;
  white-space: nowrap;
}


/* --- 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;
}

.encart-video {
  width: 100%;
}

/* ===== ÉCRAN PRINCIPAL ===== */
.video-main-wrapper {
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* 16:9 */
  position: relative;
  background: black;
  overflow: hidden;
  margin-bottom: 10px;
}

.video-main-wrapper video {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===== MINIATURES ===== */
.video-thumbs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.thumb {
  display: flex;         /* vidéo + légende côte à côte */
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.thumb-video-wrapper {
  width: 130px;
  height: 80px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.thumb-video-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb .overlay {
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  color: rgba(255,255,255,0.8);
  font-weight: bold;
  pointer-events: none;
  z-index: 10;
  background: none; /* <- important */
}

.thumb.active .overlay {
  display: block;
}

.thumb {
  display: flex;
  flex-direction: row; /* toujours côte à côte, desktop et mobile */
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.thumb span {
  display: inline-block;
  font-size: clamp(0.8rem, 1.2vw, 0.9rem);
  text-align: left;
  line-height: 1.2;
}

/* ===== RESPONSIVE MOBILE & TABLETTE ===== */
@media (max-width: 992px) {
  .video-thumbs {
    flex-direction: column;
    gap: 12px;
  }

  .thumb {
    flex-direction: row;    /* reste côte à côte comme desktop */
    align-items: center;
    gap: 10px;
  }

  .thumb-video-wrapper {
    width: 130px;
    height: 80px;
  }

  .thumb-video-wrapper video, .thumb-video-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  #mainLegend {
    font-size: 14px;
  }
}

@media (max-width: 600px) {
  .thumb-video-wrapper {
    width: 130px;  /* même taille que desktop */
    height: 80px;
  }

  .thumb-video-wrapper video, .thumb-video-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  #mainLegend {
    font-size: 14px;
  }
}



/* ============================= */
/*          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; }
  .encart4 { order: 3; }
  .encart3 { order: 4; }
  .encart5 { order: 5; }
  .encart7 { order: 6; }
  .encart9 { order: 7; }
  .encart10 { order: 8; }
  .encart11 { order: 9; }
  .encart6 { order: 10; }
  .encart8 { order: 11; }

  /* 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; }
  .encart4 { order: 3; }
  .encart3 { order: 4; }
  .encart5 { order: 5; }
  .encart7 { order: 6; }
  .encart9 { order: 7; }
  .encart10 { order: 8; }
  .encart11 { order: 9; }
  .encart6 { order: 10; }
  .encart8 { order: 11; }

  /* 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; }
}
