html {
    scroll-behavior: smooth;
    width: 100%;
    overflow-x: hidden; /* COUPE tout ce qui dépasse, sans pitié */
    margin: 0;
}

:root {
    --fond_blanc: #F9FAFB;
    --fond_gris: #d1d1d1;
    --font_style: #0B1C2D;
    --fond_hover: #3e4555;
    --democrats: #0044C9;
    --republicans: #D71E28;
    --accent_gold: #C9A44C; 
    --font-family: "Public Sans", sans-serif;
    --font-parkison: "Parkinsans", sans-serif;
    --shadow: 0px 0px 3px 0px var(--font_style);
}

body {
    background: radial-gradient(circle at top left, rgba(0, 68, 201, 0.1), transparent),
                radial-gradient(circle at bottom right, rgba(215, 30, 40, 0.1), #ffffff);
    background-attachment: fixed;
    margin: 0;
    font-family: var(--font-parkison);
    color: var(--font_style);
    max-width: 100vw;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
    color: var(--fond_blanc);
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--fond_gris);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--fond_hover);
    border-radius: 3px;
}

h1 {
    font-family: var(--font-parkison);
    font-size: 2.5rem;
}

hr {
    margin: 20px;
    color: var(--font_style);
}

.presentation_election, .map_donnes {
    scroll-margin-top: 80px;
}

/**** animation inital ******/

.usa_container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--font_style);
    z-index: 9999;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

.usa_container svg {
    width: 100%;
    object-fit: fill;
}


/********** Header **********/

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    min-height: 60px;
    padding: 10px 20px;
    box-sizing: border-box;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--font_style);
    color: var(--fond_blanc);
    z-index: 20;
    font-size: 16px;
}

header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 1px;
  width: 100%;
  background-color: var(--accent_gold);
}

header img {
    width: 100px;
    height: auto;
}

.choix_annee_election {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    margin-right: 50px;
}

.select_year {
   position: relative;
}

.select_year .svg_select {
    position: absolute;
    display: flex;
    justify-content: center;
    left: 45%;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s ease;
}

.select_year .svg_select:first-child {
    top: 0;
    transform: rotate(-90deg);
}

.select_year .svg_select:last-child {
    bottom: 0px;
    transform: rotate(90deg);
}

select {
    margin: 20px;
    min-width: 100px;
    padding: 10px;
    border-radius: 4px;
    background: var(--fond_blanc);
    border: none;
    outline: none;
    box-shadow: var(--shadow);
    transition: 0.2s ease;
    color: var(--font_style);
    font-family: var(--font-parkison);
}

option {
    font-size: 14px;
    color: var(--font_style);
}

option:hover, option:focus {
    background: var(--fond_hover);
}

select:hover {
    background: var(--fond_gris);
}

#select_annee {
    cursor:s-resize;
}

.souris_svg {
    opacity: 0;
    transition: 0.2s ease;
}

.souris_svg>circle {
    animation: souris 1s ease infinite;
}

@keyframes souris {
    0% {
        opacity: 0;
        transform: translateY(0);
    }
    10% {
        opacity: 1;
        transform: translateY(0);
    }
    90% {
        opacity: 1;
        transform: translateY(30px);
    }
    100% {
        opacity: 0;
        transform: translateY(30px);
    }
}

/**************************** Section Hero ****************************/

.hero_section {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 160px;
    height: 500px;
    animation: hero_image 5s ease infinite;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    text-align: center;
    overflow: hidden;
}

.hero_section_right {
    z-index: 3;
    box-sizing: border-box; 
}

.hero_section_right p{
    margin: 20px 0;
    font-size: 20px;
}

.lien_hero {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.lien_hero > a {
    padding: 12px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: 0.2s ease;
}

.lien_hero > a:first-child {
    background: var(--font_style);
    padding: 12px;
    border-radius: 12px;
}

.lien_hero > a:first-child:hover {
    background: var(--fond_gris);
    color: var(--font_style);

}

.lien_hero > a:last-child {
    border: solid 1px var(--font_style);
    padding: 12px;
    border-radius: 12px;
    color: var(--font_style);
    
}

.lien_hero > a:last-child:hover {
    background: var(--fond_hover);
    color: var(--fond_gris);
}

.white_house {
    display: block;
    margin: 0 auto;
    width: 600px;
}

.white_house path {
    stroke: var(--style, #3e4555);
    stroke-width: 3;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    fill-opacity: 0;
    fill: url(#degrade_1), url(#degrade_);
}

@keyframes dessiner_maison_blanche {
    0% {
        stroke-dashoffset: 100;
        fill-opacity: 0;
    }
    100% {
        stroke-dashoffset: 0;
        fill-opacity: 1;
    }
}

/**************************** présentation éléction ****************************/

.presentation_election {
    background-image: linear-gradient(to right, var(--democrats) 0% 10%, var(--republicans) 90% 100%);
    padding: clamp(40px, 10vh, 100px) 20px;
    position: relative;
    overflow: hidden;
    height: 700px;
    width: 100%;
    box-sizing: border-box;
}

.section_presentation {
    min-height: 300px; 
    max-height: none !important;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section_presentation h2 {
    color: var(--fond_blanc);
    text-align: center;
    font-size: clamp(1.2rem, 5vw, 2rem);
    margin-bottom: 20px;
    line-height: 1.3;
}

.presentation_map {
    display: flex;
    justify-content: center;
    color: white;
    font-size: 16px;
    text-align: center;
    overflow: hidden;
}

.presentation_election p {
    color: var(--fond_blanc);
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    display: flex;
    justify-content: center;
    transition: 1s ease;
    padding: 0px 10px;
    opacity: 0;
}

.boutton_animation {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.button_presentation, .boutton_continuer {
    min-width: 100px;
    display: flex;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    max-width: 100px;
    color: var(--fond_blanc);
    background: var(--font_style);
    padding: 20px;
    border-radius: 16px;
    cursor: pointer;
    transition: 0.2s ease;
    box-shadow: var(--shadow);
    transition: 0.2s ease;
}

.boutton_continuer {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.button_presentation:hover {
    background: var(--fond_hover);
    color: var(--fond_blanc);
}

/**************************************** Section carte avec données *****************************************/

.map_donnes {
    position: relative;
    display: grid;
    grid-template-columns: 30% auto;
}

/******** Affichage gauche ****************/

.affichage_gauche {
    position: relative;
    background: var(--fond_blanc);
    width: auto;
    height: auto;
    border-right: solid 5px var(--font_style);
    transition: 0.4s ease;
}

.button_affichage_gauche_responsiv {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    right: -53px;
    transition: 0.4s ease;
    opacity: 0;
    pointer-events: none;
    background: var(--fond_gris);
    border-radius: 50px;
}

.titre_etat {
    display: flex;
    justify-content: center;
    margin-top: 25px;
    font-size: 25px;
}

.panneau_info {
    margin: 0px 20px;
}

.liste_nbr_vote {
    margin-top: 20px;
}

.nbr_vote {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    gap: 10px;
}

.nbr_vote:nth-child(1) {
    color: var(--democrats);
    text-align: left;
}

.nbr_vote:nth-child(2) {
    color: var(--republicans);
    text-align: end;
}

.balance {
    display: flex;
    justify-content: center;
    overflow: visible;
    fill: var(--fond_blanc);
}

.balance svg{
    width: 70%;
    height: auto;
}

#Balance_animation {
    transition: 2s ease;
    transform-origin: 171.229px 82.2832px !important;
}

#Votes_dem, #Votes_rep {
    transition: 1s ease;
}

#value_dem, #value_rep {
    font-size: 14px;
    pointer-events: none;
}

.titre_balance {
    display: flex;
    justify-content: center;
    text-align: center;
}

@keyframes actualisation {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/***** Affichage droite *******/

.affichage_droite {
    margin: 50px;
    height: 100%;
}

/* Barre des resultats */

.resultats {
    position: relative;
    width: 85%;
    max-width: 800px;
    margin: 20px 0px !important;
}

.medaille {
    position: absolute;
    z-index: 5;
    top: -25px;
}

/* Si medaille a  left: 30%*/
.medaille[style*="left: 15%"] {
    transform: translateX(150%);
}

/* Si medaille a  right: 30%*/
.medaille[style*="right: 15%"] {
    transform: translateX(-150%);
}

.noms_parties {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 5px;
    position: relative;
    height: 50px;
    font-size: clamp(12px, 2.5vw, 16px); 
}

.noms_parties b:first-child { 
    color: var(--democrats); 
    margin-left: 50px;
}
.noms_parties b:last-child { 
    color: var(--republicans); 
    margin-right: 50px;
}

.nbr_electeur {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px clamp(10px, 2vw, 20px); 
    background: var(--font_style);
    border-radius: 16px;
    z-index: 6;
    top: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.nbr_electeur b {
    display: flex;
    justify-content: center;
    color: var(--fond_gris) !important;
    white-space: nowrap;
    font-size: clamp(12px, 3vw, 15px);
    text-align: center;
}

.nbr_electeur_ligne {
    position: absolute;
    z-index: 5;
    background: var(--font_style);
    height: 80px; 
    width: 2px;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
}

.barre_resultat {
    position: relative;
    width: 100%;
    height: 50px;
    background: var(--fond_gris);
    border-radius: 16px;
    overflow: hidden; 
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.barre_resultat::before {
    content: "";
    position: absolute;
    z-index: 3;
    inset: 0;
    background-image: linear-gradient(to right, rgb(46, 46, 46, 0.2) 0% 10%, transparent 40% 60%, rgb(46, 46, 46, 0.2) 90% 100%);
    pointer-events: none;
}

.barre_democrats, .barre_republicain {
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    height: 100%;
    transition: width 1s ease-in-out;
    width: 50%; 
}

.barre_democrats {
    left: 0;
    background: var(--democrats);
}

.barre_republicain {
    right: 0;
    background: var(--republicans);
}

/* --- Les Logos dans les barres --- */
.logo_parties {
    position: absolute;
    z-index: 5;
    top: 50%;
    transform: translateY(-50%); /* Centrage vertical parfait */
    
    /* Taille adaptative : ne dépasse jamais la hauteur de la barre */
    width: clamp(25px, 8vw, 35px);
    height: clamp(25px, 8vw, 35px);
}

.barre_democrats .logo_parties { left: 10px; }
.barre_republicain .logo_parties { right: 10px; }

/* Carte des Etats-Unis */

.USA_map {
    margin: 20px 20px;
    width: 60%;
    height: 20%;
    height: auto;
}

.USA_map path {
    cursor: pointer;
    opacity: 0;
    transition: 0.2s ease !important;
    pointer-events: none;
    stroke-width: 1.5px;
    stroke: var(--font_style);
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}

@keyframes apparition_etat {
    0% {
        opacity: 0;
        fill-opacity: 0;
        stroke-dashoffset: 1;
        stroke: var(--font_style);
    }
    50% {
        opacity: 1;
        fill-opacity: 0;
        stroke-dashoffset: 0;
        stroke: var(--font_style);
    }
    100% {
        opacity: 1;
        fill-opacity: 1;
        stroke-dashoffset: 0;
        pointer-events: auto;
        stroke: var(--fond_gris);
        
    }
}

.USA_map path:hover, .state_open {
    fill-opacity: 0.5 !important;
}

.flex_info {
    display: flex;
    align-items: center;
}

.nom_etat {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 30px;
    border-bottom: solid 2px #0F172A;
    min-width: 150px;
}

.annee_election {
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.annee_election b {
    display: flex;
    justify-content: center;
}

.choix_annee {
    width: 250px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.svg_choix_annee>svg {
    margin-top: 20px;
    cursor: pointer;
    transition: 0.2s ease;
}

.svg_choix_annee>svg:hover {
    opacity: 0.5;
}

.choix_annee_disabled {
    opacity: 0.5;
    pointer-events: none;
}

.annee {
    font-size: 50px;
}

/********************************** autres graphiques **********************************/

.donnees_graphiques {
    display: flex;
    width: 100%;
    justify-content: center;
    flex-direction: column;
    background: var(--font_style);
    gap: 30px;
    color: var(--fond_blanc);
    box-sizing: border-box;
    padding: 30px 10%;
}
.diagramme_titre {
    height: 40px;
    display: flex;
    justify-content: center;
    text-align: center;
}

/****** nuage de bulles ******/

.nuage_bulles {
    position: relative; /* Parent de référence */
}

.nuage_bulles_etat {
    position: relative;
    background: var(--fond_blanc);
    height: 600px;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
}

.nuage_bulles_etat_info {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Laisse passer les clics vers les bulles */
    z-index: 20; /* Au dessus de l'overflow hidden */
    overflow: visible;
}

.bulle_etat {
    position: absolute;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3); /* Un léger contour pour séparer les bulles */
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: var(--shadow);
    transform: scale(0);
    overflow: visible;
}

@keyframes apparition_bulle {
    0% {
        transform: translate(var(--decalageX, 0), var(--decalageY, 0)) scale(0);
    }
    100% {
        transform: translate(var(--decalageX, 0), var(--decalageY, 0)) scale(1);
    }
}

.bulle_etat:hover {
    transform: scale(1.4);
    z-index: 10;
}

.info_bulle {
    position: absolute;
    width: 200px;
    height: 60px;
    transform: translate(-50%, 35%); 
    stroke-width: 1.5;
    stroke: var(--fond_blanc);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    overflow: visible;
}

.info_bulle_text {
    display: flex;
    margin-top: 2px;
    align-items: center; 
    justify-content: center; 
    font-size: 16px;
    height: 100%; 
    font-family: var(--font-family); 
    text-align: center;
}

.bulle_etat:hover {
    transform: scale(1.2);
    z-index: 10;
}

.bulle_etat:hover > .info_bulle {
    opacity: 1;
}

/****** diagramme de points divergentes ******/

.diagramme_points_divergentes_flex {
    display: flex;
    background: var(--fond_blanc);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    height: 600px;
}

.etats_diagramme {
    width: 140px;
    min-width: 140px;
    padding: 15px 0;
    border-right: 1px solid var(--fond_gris);
    background: rgba(249, 250, 251, 0.8);
    position: sticky;
}

.titre_etat_diagramme {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    font-size: 0.9rem;
    color: var(--font_style);
    border-bottom: 0.5px solid var(--font_style);
    transition: all 0.2s ease;
    position: relative;
}

.affichage_points_etats {
    flex: 1;
    position: relative;
    min-width: 450px;
    padding: 0 20px;
}

.gradient_fond {
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    bottom: 0;
    background: linear-gradient(90deg,var(--democrats) 0% 25%,transparent 45% 55%, 75%,var(--republicans) 100%);
    opacity: 0.1;
    border-radius: 4px;
}

.ligne_centrale {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: var(--font_style);
    opacity: 0.15;
    z-index: 1;
}

.points_etats {
    margin-top: 15px;
    width: 100%;
    position: relative;
    overflow: visible;
}

.point_etat {
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3;
    transition: all 0.3s ease;
    border-bottom: solid 1px var(--font_style);
}

.point_etat svg {
    position: absolute;
    overflow: visible;
}

.span_rep, .span_dem {
    position: absolute;
    opacity: 0;
    transition: 0.2s ease;
}

.span_rep {
    color: var(--republicans);
    right: 5%;
    transform: translateX(50px);
}

.span_dem {
    color: var(--democrats);
    left: 5%;
    transform: translateX(-50px);
}

.point_etat:hover>.span_rep, .point_etat:hover>.span_dem {
     transform: translateX(0px);
     opacity: 1;
}

#etoiles_phrases {
    display: flex;
    justify-content: space-between;
    gap: 10%;
}


/*************** footer ***************/

footer {
    display: flex;
    padding: 20px;
   background: radial-gradient(circle at top left, rgba(0, 68, 201, 0.05), transparent),
                radial-gradient(circle at bottom right, rgba(215, 30, 40, 0.05), #ffffff);
    background-attachment: fixed;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.05em;
}


/*********************************************** Responsive ***********************************************/

@media (max-width: 820px) {

    .souris_svg, .select_year .svg_select {
        display: none;
    }

    .white_house {
        position: absolute;
        top: -0%;
        left: 50%;
        transform: translateX(-50%);
        width: 90% !important;
        max-width: 500px;
        z-index: -1;
        filter: blur(4px);
    }

    .map_donnes  {
        display: flex;
    }

    .affichage_gauche {
        font-size: 14px;
    }

    .balance svg {
        width: 190px;
    }

    .affichage_droite {
        margin: 100px 10px 0px 10px;
    }
    .USA_map {
        width: 420px !important;
    }

    .nom_etat {
        display: none;
    }

    .flex_info {
        justify-content: right;
    }
}

@media (max-width: 660px) {

    header {
        justify-content: left;
        font-size: 14px;
    }

    header b {
        display: noneFp;
    }

    .choix_annee_election {
        margin: 0;
    }

    .hero_section {
        padding: 120px 20px 40px 20px;
        height: 600px;
        min-height: 400px;
    }

    .hero_section_right {
        box-sizing: border-box; /* Important pour que le padding ne s'ajoute pas à la largeur */
    }

    .hero_section_right p{
        padding: 10px 50px;
        font-size: 14px;
    }

    .presentation_election {
        max-height: 650px;
    }

    .presentation_election p {
        text-align: center;
    }

    .map_donnes {
        position: relative;
        display: block;
    }

    .affichage_gauche {
        position: absolute;
        z-index: 10;
        top: -100px;
        width: 100%;
        min-height: 600px !important;
        transform: translateX(-100%);
    }

    .affichage_gauche_responsiv {
        transform: translateX(0px);
    }

    .arrow_affichage_gauche {
        transition: 0.2s ease;
    }

    .button_affichage_gauche_responsiv {
        opacity: 1;
        pointer-events: all;
    }

    .button_affichage_gauche_responsiv_gauche {
        transform: translateX(-100%);
        background: none;
    }

    .arrow_affichage_gauche_responsiv {
        transform: rotate(180deg);
        transform-origin: center;
    }

    hr, .titre_etat, .panneau_info {
        margin: 5px 15px;
    }

    .balance svg{  
        width: 300px;
    }

    .affichage_droite {
        display: block;
        min-height: 500px !important;
        height: auto;
    }

    .resultats {
        margin: 0px auto;
        max-width: none;
    }

    .medaille {
        top: -10px;
    }

    .USA_map {
        width: 300px !important;
    }
 }