:root {
    --primary-color: #1e88e5;
    --secondary-color: #0d47a1;
    --background-color: #f5f7fa;
    --text-color: #333;
    --card-shadow: 2px 2px 4px 6px rgba(0, 0, 0, 0.1);
}

/* Global safety: avoid horizontal overflow and scale media responsively */
* , *::before, *::after {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

img, svg, video, canvas, iframe {
    max-width: 100%;
    height: auto;
}

/* Prevent long words/URLs from causing overflow */
p, li, td, th, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

#scrollToTopBtn {
    display: none; /* Masqué par défaut */
    position: fixed; /* Position fixe */
    bottom: 20px; /* Distance depuis le bas */
    right: 20px; /* Distance depuis la droite */
    z-index: 99; /* Assure que le bouton est au-dessus des autres éléments */
    border: none;
    outline: none;
    background-color: #555;
    color: white;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    font-size: 18px;
    width: 50px;
    height: 50px;
  }


  
  #scrollToTopBtn:hover {
    background-color: #333;
  }
  
nav {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    
}

nav>ul>li>a {
    text-decoration: none;
    color: white;
    border-bottom: 2px solid white;
    padding-bottom: 0.5rem;
    transition: border-bottom 0.3s ease;
}

nav>ul>li>a:hover {
    border-bottom: 2px solid var(--primary-color);
    font-weight: bold;
    
}
nav > ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    gap: 1rem;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    text-align: justify;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    margin-bottom: 3rem;
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
}

.section#results {
    max-width: 100%;
    margin: 0 auto;
}

.section h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.timeline {
    position: relative;
    padding-left: 30px;
}

/*Pour avoir la ligne verticale de la timeline*/
.timeline::before {
    content: '';
    position: absolute;
    left: -1.5px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -36px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
}

.timeline-item h3 {
    margin-top: 0;
    color: var(--secondary-color);
}

.stats-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.stat-card {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    min-width: 150px;
    max-width: 200px;
    margin: 10px;
}

.stat-card h3 {
    margin-top: 0;
    font-size: 2rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    filter: invert(1);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

/* Make results table horizontally scrollable without shrinking the section */
/* Scroll wrapper for the results table: keeps section height equal to table height */
#tab-results {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#tab-results .results-table {
    width: max-content;
    min-width: 600px;
    white-space: nowrap;
}

.results-table th, .results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.results-table th {
    background-color: var(--primary-color);
    color: white;
}

.results-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.section#timeline {
    max-width: 50%;
    margin: 0 auto;
}

.section#photo {
    max-width: 100%;
    margin: 0 auto;
}

.columns-section {
    display: flex;
    align-items: flex-start;
    flex-direction: row;
    gap: 1rem;
    padding-left: 2vw;
    padding-right: 2vw;

}

.columns-section > .section#results {
    flex: 1 1 0;
    /* Prend tout l'espace restant */
}

.columns-section > .section#photo {
    flex: 0 0 auto;
    /* Ne prend que la place nécessaire à la photo */
    max-width: 350px;
    /* Ajustez cette valeur selon la taille max souhaitée pour la photo */
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.gallery img {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

article {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

article h3 {
    color: var(--primary-color);
    margin-top: 0;
}

article p {
    line-height: 1.6;
}

article img {
    max-width: 50%;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: block;
    margin: 1rem auto;
}


footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--secondary-color);
    color: white;
    margin-top: 2rem;
}

.contact ul{
    list-style: none;
    padding-left: 0;  
}

.contact>ul>li>a{
    text-decoration: none;
    color : white;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
  }
  
  .overlay-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    max-width: 80%;
    max-height: 80%;
    overflow: auto;
    position: relative;
  }
  
  .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
  }



@media (max-width: 768px) {
    nav>ul>li>a {
    text-decoration: none;
    color: white;
    border-bottom: 2px solid white;
    padding-bottom: 0.1rem;
    transition: border-bottom 0.3s ease;
    
    }


    #tab-results{
        overflow-x: auto;
    }
    .stats-container {
        flex-direction: column;
        align-items: center;
        max-width : 75%
    }
    .columns-section{
        flex-direction : column;
    }
    .stat-card {
        min-width: 100%;
    }
    

    /* Hide timeline photo on mobile */
    #time {
        display: none;
    }
    
}

@media (max-width: 820px) {
    /* Move photo section below results table on medium screens */
    .columns-section {
        flex-direction: column;
    }
    
    .columns-section > div {
        width: 100%;
        max-width: 100%;
    }
    
    .columns-section > div:first-child {
        order: 1;
    }
    
    .columns-section > div:last-child {
        order: 2;
        margin-top: 2rem;
    }
    
    /* Ensure proper spacing between sections */
    .section#photo {
        margin-top: 2rem;
        width: 100%;
        max-width: 100%;
        min-height: auto;
    }
    
    /* Make photo responsive within its container */
    .section#photo .gallery {
        width: 100%;
        max-width: 100%;
    }
    
    .section#photo .gallery img {
        width: 100%;
        max-width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .section#results{
        max-width: 100%;
        width: 100%;
    }
}

/* Fix iframe map display */
.section#map {
  height: 650px;
  overflow: hidden;
}

.section#map iframe {
  width: 100%;
  height: 600px;
  border: none;
  border-radius: 8px;
  padding-bottom:20px;
}

/* Make habitable table take full width on large screens */
.section#result {
  overflow-x: auto;
  max-width: 100%;
}

.section#result .results-table {
  width: 100%;
  min-width: 600px;
  margin: 0;
}

/* Ensure table content doesn't wrap */
.section#result .results-table th,
.section#result .results-table td {
  white-space: nowrap;
  padding: 12px;
}