/* Presentation section */
#presentation {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  background-color: var(--black-);
  padding: 1rem 0 4rem;
}

.contactsContainer {
  width: fit-content;
  height: auto;
  position: relative;
  margin-right: 3.54vw;
}

.titleContact {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  height: fit-content;
  gap: 1rem;
  margin-bottom: 3rem;
}
.titleContact h1 {
  font-size: clamp(24px, 2.2vw, 50px);
  line-height: 100%;
  color: var(--greenContrast-);
  margin: 0;
}
.titleContact img {
  width: clamp(25px, 2vw, 40px);
}

.contact p {
  font-size: clamp(
    14px,
    1.4vw,
    32px
  ); /* Correspond à 14px, 2vw, 32px pour un écran de 2540px */
  font-weight: 500;
  line-height: 150%; /* Correspond à 60px pour un écran de 2540px */
  color: var(--greenContrast-);
}

/* Slideshow */
.slideshow {
  position: relative;
  width: fit-content;
  height: fit-content;
  margin-bottom: 50px;
  margin-top: 3rem;
}

.slideshow img {
  width: clamp(300px, 45vw, 1470px);
  height: clamp(150px, 22.5vw, 735px);
  border-radius: 2px;
}

/* Slideshow animation */
@keyframes slideshow__fade {
  0% {
    opacity: 0;
    z-index: 2;
  }
  6.67% {
    opacity: 1;
  }
  13.34% {
    opacity: 1;
  }
  14.34% {
    opacity: 0;
    z-index: 1;
  }
  99.99% {
    opacity: 0; /* Dernière image disparaît en douceur */
  }
  100% {
    opacity: 0; /* Evite le retour brutal à la première image */
  }
}

.slideshow img:not(:first-child) {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0 auto;
  animation-duration: 75s; /* 15 images x 5s par image */
  animation-fill-mode: both;
  animation-iteration-count: infinite;
  animation-name: slideshow__fade;
  animation-timing-function: ease-in;
  transition: opacity 2s ease-in;
}

/* Définir les délais pour chaque image */
.slideshow img:nth-child(1) {
  animation-delay: 0s;
}
.slideshow img:nth-child(2) {
  animation-delay: 5s;
}
.slideshow img:nth-child(3) {
  animation-delay: 10s;
}
.slideshow img:nth-child(4) {
  animation-delay: 15s;
}
.slideshow img:nth-child(5) {
  animation-delay: 20s;
}
.slideshow img:nth-child(6) {
  animation-delay: 25s;
}
.slideshow img:nth-child(7) {
  animation-delay: 30s;
}
.slideshow img:nth-child(8) {
  animation-delay: 35s;
}
.slideshow img:nth-child(9) {
  animation-delay: 40s;
}
.slideshow img:nth-child(10) {
  animation-delay: 45s;
}
.slideshow img:nth-child(11) {
  animation-delay: 50s;
}
.slideshow img:nth-child(12) {
  animation-delay: 55s;
}
.slideshow img:nth-child(13) {
  animation-delay: 60s;
}
.slideshow img:nth-child(14) {
  animation-delay: 65s;
}
.slideshow img:nth-child(15) {
  animation-delay: 70s;
}

/* News section */
.news {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 3rem 2rem;
  margin: 5rem 0; /* Correspond à 5rem */
}

.titleArticle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px; /* Correspond à 10px 25px */
  width: fit-content;
  height: fit-content;
  color: var(--green-);
  background-color: var(--black-);
  border-radius: 3px;
  margin-bottom: 2rem;
}

.titleArticle h2 {
  font-size: clamp(24px, 2vw, 50px);
  line-height: 100%;
  margin-right: 1rem;
  text-transform: uppercase;
}

/* Container for articles */
.container-article {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  width: 100%;
  height: auto;
  gap: 3rem;
}
/* Style for each article card */
.container-article figure {
  background-color: white;
  border: none;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  width: clamp(300px, 100%, 700px);
  height: clamp(400px, 40vh, 600px);
  min-width: 300px !important;
}

/* Image styles */
.card-img-top {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain; /* Ensures image covers the container */
  display: block; /* Prevents extra space below the image */
}

/* Figcaption styles */
figcaption {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--gray-);
  color: var(--greenContrast-);
  opacity: 0; /* Hide by default */
  transition: opacity 0.3s ease; /* Fade effect */
  padding: 1rem;
}
figcaption a{
  font-size: clamp(12px, 1vw, 20px) !important;
  color: aquamarine;
  font-weight: bold;
  line-height: 150%;
}

/* Show figcaption on hover */
.container-article figure:hover figcaption {
  opacity: 1; /* Show on hover */
}

/* Title styles */
figure figcaption .article-title {
  font-size: clamp(16px, 1.6vw, 28px) !important;
  margin: 0.5rem 0;
  font-weight: bold;
  line-height: 150%;
}

/* Text styles */
figure figcaption .article-text {
  font-size: clamp(12px, 1vw, 20px) !important;
  margin: 0.5rem 0;
  line-height: 150%;
}

/* Button styles */
.btn-article {
  padding: 0.5rem 1rem;
  margin-top: 2rem;
  background-color: var(--green-);
  color: var(--black-);
  font-weight: bold;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

/* Button hover effect */
.btn-article:hover {
  background-color: var(--greenContrast-); /* Change color on hover */
}

/* Modal window */
.modalAccueil {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 20.5vh; /* Start just below the fixed navbar */
  width: 100%;
  height: calc(100vh - 20.5vh); /* Adjust to stay within the viewport */
  overflow: auto;
  background-color: rgba(205, 243, 182, 0.8);
  backdrop-filter: blur(8px);
}

.modalAccueil-content {
  margin: 5% auto;
  background-color: aliceblue;
  padding: 20px; /* Correspond à 20px */
  border: 1px solid #888;
  width: 90%;
  box-shadow: 0 4px 8px 0 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); /* Correspond à 0 4px 8px 0, 0 6px 20px 0 */
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  padding: 50px; /* Added padding */
}
.modalAccueil-body {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
}
.modalAccueil-image {
  flex: 1;
  max-width: 40%;
  margin-right: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modalAccueilImage {
  width: 100%;
  height: auto;
}
#modalAccueilContent {
  flex: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
}
#modalAccueilTitle {
  margin: 50px 0 30px; /* Correspond à 50px 0 30px */
  font-size: clamp(24px, 2.2vw, 50px);
  line-height: 100%;
  text-align: center;
  color: var(--black-);
}
#modalAccueilText {
  font-size: clamp(14px, 1.6vw, 32px);
  margin-bottom: 20px;
  line-height: 150%;
  padding-left: 2rem;
  color: var(--gray-);
}

.close {
  position: absolute;
  top: 15px; /* Correspond à 15px */
  right: 15px; /* Correspond à 15px */
  color: var(--black-);
  font-size: 25px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* Adaptation mobile */

@media screen and (max-width: 1200px) {
  .container-article {
    flex-wrap: wrap;
  }
}

@media screen and (max-width: 1025px) {
  .container-article figure {
    max-width: 500px;
  }
}

@media screen and (max-width: 769px) {
  #presentation {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .contactsContainer {
    flex-direction: column;
    align-items: center;
  }

  .contactsContainer,
  .slideshow {
    display: flex;
    width: auto;
    margin: auto;
  }

  .titleContact {
    margin-bottom: 1rem;
  }

  .contact {
    margin-bottom: 2rem;
  }
  .modalAccueil {
    width: 100%;
    padding: 0;
  }
  .modalAccueil-body {
    flex-direction: column;
    width: 100%;
  }
  .modalAccueil-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; /* Ensures the image takes up full width */
    height: auto;
    margin: 0 auto; /* Removes any margin */
  }
  .modalAccueil-content {
    width: 100%;
  }
  #modalAccueilTitle {
    margin: 50px 0 10px; /* Correspond à 50px 0 30px */
    font-size: clamp(24px, 2.2vw, 50px);
    line-height: 150%;
    text-align: center;
  }
  #modalAccueilImage {
    width: 250px;
    height: auto;
  }
  #modalAccueilContent {
    width: 100%; /* Ensures text container takes up full width */
    padding: 0;
    gap: 15px;
  }
  #modalAccueilText {
    width: 100%;
    height: auto;
    padding: 0;
  }
}

@media screen and (max-width: 600px) {
  .container-article {
    width: 300px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
}

@media screen and (max-width: 380px) {
  .card {
    width: 300px !important;
  }
}
