/* ==========================================================================
   JlP Elec - Feuille de style
   Projet de formation Développeur Web Front-End
   --------------------------------------------------------------------------
   Sommaire :
     1. Variables (couleurs, polices)
     2. Réinitialisation (reset) et styles de base
     3. Barre de défilement (scrollbar) personnalisée
     4. En-tête (header) et navigation + menu burger
     5. Bandeau cookies
     6. Sections communes (titres, boutons)
     7. Bannière avec effet parallaxe
     8. Grilles de services (cartes)
     9. Page Rendez-vous (formulaire)
     10. Modale (mot de passe oublié)
     11. Pied de page (footer)
     12. Animations
     13. Responsive (point de rupture mobile / desktop)
   ========================================================================== */


/* ==========================================================================
   1. VARIABLES
   ========================================================================== */
:root {
    /* Couleurs */
    --noir:        #0d0d0d;   /* fond principal */
    --noir-clair:  #1a1a1a;   /* fond des cartes */
    --or:          #c9a24b;   /* couleur dorée principale */
    --or-clair:    #e6c878;   /* or plus clair pour les survols (hover) */
    --blanc:       #f5f5f5;   /* texte clair */
    --gris:        #9a9a9a;   /* texte secondaire */
    --bordure:     #2a2a2a;   /* bordure discrète des blocs */
    --rouge:       #e06666;   /* champ invalide */
    --vert:        #6aa84f;   /* champ valide */

    /* Polices : une pour les titres et une pour le texte */
    --police-titre: 'Playfair Display', Georgia, serif;
    --police-texte: 'Poppins', Arial, sans-serif;
}


/* ==========================================================================
   2. RÉINITIALISATION ET STYLES DE BASE
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth; /* défilement doux quand on clique sur une ancre */
}

body {
    font-family: var(--police-texte);
    background-color: var(--noir);
    color: var(--blanc);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none; 
}

img {
    max-width: 100%;
    display: block;
}

/* Contour visible quand on navigue au clavier (touche Tab) */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--or-clair);
    outline-offset: 3px;
}

/* Classe utilitaire pour cacher un élément (cookies, modale, messages).
   !important : la classe doit gagner sur le "display: flex" des composants. */
.cache {
    display: none !important;
}


/* ==========================================================================
   3. BARRE DE DÉFILEMENT
   ========================================================================== */

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

::-webkit-scrollbar-track {
    background: var(--noir-clair); /* le "rail" de la scrollbar */
}

::-webkit-scrollbar-thumb {
    background: var(--or);          /* la partie que l'on déplace */
    border-radius: 10px;
    border: 3px solid var(--noir-clair);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--or-clair);
}

@supports not selector(::-webkit-scrollbar) {
    html {
        scrollbar-color: var(--or) var(--noir-clair);
        scrollbar-width: thin;
    }
}


/* ==========================================================================
   4. EN-TÊTE (HEADER) ET NAVIGATION
   ========================================================================== */
.header {
    position: sticky; 
    top: 0;
    z-index: 1000; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: rgba(13, 13, 13, 0.95);
    border-bottom: 1px solid var(--or);
}

/* Le logo */
.logo {
    font-family: var(--police-titre);
    font-size: 1.8rem;
    color: var(--or);
    letter-spacing: 2px;
}

.logo span {
    color: var(--blanc);
}

/* La liste des liens de navigation */
.nav-liens {
    display: flex;
    gap: 30px;
}

.nav-liens a {
    font-weight: 500;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s;
}

.nav-liens a:hover {
    color: var(--or);
}

/* Petit trait doré qui apparaît sous le lien au survol */
.nav-liens a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 0;
    height: 2px;
    background-color: var(--or);
    transition: width 0.3s;
}

.nav-liens a:hover::after,
.nav-liens a.actif::after {
    width: 100%; 
}

.nav-liens a.actif {
    color: var(--or); 
}

/* Le bouton burger : caché sur desktop, affiché sur mobile */
.burger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 22px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1100;
}

/* Les 3 barres du burger */
.burger span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--or);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animation du burger en croix (X) quand le menu est ouvert */
.burger.ouvert span:nth-child(1) {
    transform: translateY(9.5px) rotate(45deg);
}
.burger.ouvert span:nth-child(2) {
    opacity: 0; 
}
.burger.ouvert span:nth-child(3) {
    transform: translateY(-9.5px) rotate(-45deg);
}


/* ==========================================================================
   5. BANDEAU COOKIES
   ========================================================================== */
.cookies {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    padding: 18px 40px;
    background-color: var(--noir-clair);
    border-top: 2px solid var(--or);
}

.cookies p {
    color: var(--gris);
    font-size: 0.9rem;
    max-width: 70%;
}

.cookies-boutons {
    display: flex;
    gap: 10px;
}


/* ==========================================================================
   6. SECTIONS COMMUNES (titres, boutons)
   ========================================================================== */
.section {
    padding: 80px 40px;
    max-width: 1200px;
    margin: 0 auto; 
}

/* Variante : section sans espace en bas (bloc urgence collé à la suite) */
.section.section--collee {
    padding-bottom: 0;
}

.titre-section {
    font-family: var(--police-titre);
    font-size: 2.4rem;
    text-align: center;
    margin-bottom: 15px;
    color: var(--or);
}

.titre-section span {
    color: var(--blanc);
}

.sous-titre {
    text-align: center;
    color: var(--gris);
    margin-bottom: 50px;
}

/* Bouton principal */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--or);
    color: var(--noir);
    font-weight: 600;
    border: 2px solid var(--or);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    font-family: var(--police-texte);
    font-size: 1rem;
}

.btn:hover {
    background-color: transparent;
    color: var(--or);
}

/* Bouton secondaire */
.btn-secondaire {
    background-color: transparent;
    color: var(--or);
}

.btn-secondaire:hover {
    background-color: var(--or);
    color: var(--noir);
}

.btn-large {
    width: 100%;
}

.zone-bouton {
    text-align: center;
    margin-top: 50px;
}


/* ==========================================================================
   7. BANNIÈRE AVEC EFFET PARALLAXE
   ========================================================================== */
.banniere {
    min-height: 80vh; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    background-image: linear-gradient(rgba(13, 13, 13, 0.6), rgba(13, 13, 13, 0.8)), url('../images/04_travaux-tableau.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed; 
}

/* Variante : bannière plus basse pour les pages intérieures */
.banniere--page {
    min-height: 50vh;
}

/* Variantes : une image de fond par page */
.banniere--travaux {
    background-image: linear-gradient(rgba(13, 13, 13, 0.6), rgba(13, 13, 13, 0.85)), url('../images/01_travaux-installation.jpg');
}

.banniere--depannage {
    background-image: linear-gradient(rgba(13, 13, 13, 0.6), rgba(13, 13, 13, 0.85)), url('../images/02_depannage-panne.jpg');
}

.banniere h1 {
    font-family: var(--police-titre);
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--or);
}

.banniere h1 span {
    color: var(--blanc);
}

.banniere p {
    font-size: 1.2rem;
    color: var(--gris);
    max-width: 600px;
    margin-bottom: 30px;
}


/* ==========================================================================
   8. GRILLES DE SERVICES
   ========================================================================== */
.grille-services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

/* Une carte */
.carte {
    background-color: var(--noir-clair);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, border-color 0.3s;
}

.carte:hover {
    transform: translateY(-8px); /* la carte se soulève au survol */
    border-color: var(--or);
}

/* Conteneur de l'image */
.carte-image {
    overflow: hidden; 
    height: 220px;
}

.carte-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s; 
}

/* Zoom sur l'image quand on survole la carte */
.carte:hover .carte-image img {
    transform: scale(1.1);
}

.carte-contenu {
    padding: 25px;
}

.carte-contenu h3 {
    font-family: var(--police-titre);
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--or);
}

.carte-contenu p {
    color: var(--gris);
    margin-bottom: 15px;
    font-size: 0.95rem;
}

/* Le prix de la prestation */
.prix {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--blanc);
}


/* ==========================================================================
   9. PAGE RENDEZ-VOUS
   ========================================================================== */
.formulaire-bloc {
    max-width: 550px;
    margin: 0 auto;
    background-color: var(--noir-clair);
    padding: 40px;
    border-radius: 8px;
    border: 1px solid var(--bordure);
}

/* Variante : bloc "urgence" de la page Dépannage */
.bloc-urgence {
    max-width: 700px;
    text-align: center;
}

.titre-urgence {
    color: var(--or);
    font-family: var(--police-titre);
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.bloc-urgence p {
    color: var(--gris);
    margin-bottom: 15px;
}

.champ {
    margin-bottom: 22px;
}

.champ label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--blanc);
}

.champ input {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--noir);
    border: 1px solid #333;
    border-radius: 4px;
    color: var(--blanc);
    font-family: var(--police-texte);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.champ input:focus {
    outline: none;
    border-color: var(--or);
}

.message-erreur {
    display: block;
    color: var(--rouge);
    font-size: 0.85rem;
    margin-top: 6px;
    min-height: 18px; 
}

/* Bordure rouge quand le champ est invalide */
.champ input.invalide {
    border-color: var(--rouge);
}

/* Bordure verte quand un champ est valide */
.champ input.valide {
    border-color: var(--vert);
}

/* Bouton "mot de passe oublié"*/
.lien-oubli {
    display: inline-block;
    margin-top: 8px;
    padding: 0;
    background: none;
    border: none;
    color: var(--or);
    font-family: var(--police-texte);
    font-size: 0.9rem;
    cursor: pointer;
}

.lien-oubli:hover {
    text-decoration: underline;
}

/* Message de confirmation après envoi réussi du formulaire */
.message-succes {
    text-align: center;
    padding: 15px;
    margin-top: 20px;
    background-color: rgba(106, 168, 79, 0.15);
    border: 1px solid var(--vert);
    border-radius: 4px;
    color: #b6d7a8;
}


/* ==========================================================================
   10. MODALE (fenêtre "mot de passe oublié")
   ========================================================================== */
.modale {
    position: fixed;
    inset: 0; 
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.8); 
    padding: 20px;
    animation: fondu 0.3s ease;
}

.modale-boite {
    background-color: var(--noir-clair);
    border: 1px solid var(--or);
    border-radius: 8px;
    padding: 35px;
    max-width: 420px;
    width: 100%;
    position: relative;
    animation: monte 0.4s ease;
}

.modale-boite h2 {
    font-family: var(--police-titre);
    font-size: 1.3rem;
    color: var(--or);
    margin-bottom: 10px;
}

.modale-boite p {
    color: var(--gris);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* La croix pour fermer la modale */
.fermer-modale {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.6rem;
    color: var(--gris);
    cursor: pointer;
    background: none;
    border: none;
    transition: color 0.3s;
}

.fermer-modale:hover {
    color: var(--or);
}


/* ==========================================================================
   11. PIED DE PAGE
   ========================================================================== */
.footer {
    background-color: var(--noir-clair);
    border-top: 1px solid var(--or);
    padding: 50px 40px 20px;
}

.footer-contenu {
    max-width: 1200px;
    margin: 0 auto 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
}

.footer-colonne h2 {
    font-family: var(--police-titre);
    color: var(--or);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.footer-colonne p,
.footer-colonne li {
    color: var(--gris);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.footer-colonne a:hover {
    color: var(--or);
}

/* Les icônes de réseaux sociaux */
.reseaux {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.reseaux a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--or);
    border-radius: 50%;
    color: var(--or);
    font-size: 1.1rem;
    transition: background-color 0.3s, color 0.3s, transform 0.3s;
}

.reseaux a:hover {
    background-color: var(--or);
    color: var(--noir);
    transform: translateY(-4px);
}

/* Bas du footer : copyright */
.footer-bas {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--bordure);
    color: var(--gris);
    font-size: 0.85rem;
}


/* ==========================================================================
   12. ANIMATIONS
   ========================================================================== */


@keyframes fondu {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes monte {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.section,
.banniere h1,
.banniere p {
    animation: monte 0.8s ease;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }

    html {
        scroll-behavior: auto;
    }
}


/* ==========================================================================
   13. RESPONSIVE - POINT DE RUPTURE MOBILE (768px et moins)
   ========================================================================== */
@media (max-width: 768px) {

    .header {
        padding: 15px 20px;
    }

    .burger {
        display: flex;
    }

    .nav-liens {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 70%;
        max-width: 300px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 40px;
        background-color: var(--noir-clair);
        border-left: 1px solid var(--or);
        transform: translateX(100%);
        visibility: hidden; /* menu fermé : liens non atteignables au clavier */
        transition: transform 0.4s ease, visibility 0.4s;
    }

    .nav-liens.ouvert {
        transform: translateX(0);
        visibility: visible;
    }

    .nav-liens a {
        font-size: 1.3rem;
    }

    .banniere {
        min-height: 60vh;
        background-attachment: scroll;
    }

    .banniere--page {
        min-height: 40vh;
    }

    .banniere h1 {
        font-size: 2.3rem;
    }

    .banniere p {
        font-size: 1rem;
    }

    .titre-section {
        font-size: 1.8rem;
    }

    .section {
        padding: 50px 20px;
    }

    .formulaire-bloc {
        padding: 25px;
    }

    .cookies {
        flex-direction: column;
        text-align: center;
        padding: 18px 20px;
    }

    .cookies p {
        max-width: 100%;
    }

    .footer {
        padding: 40px 20px 20px;
    }
}
