/* ============================================================
   DOMAINE DES VIGNES — Feuille de style principale
   Architecture : variables CSS → reset → composants → pages → responsive
   Palette : vert profond (terroir), crème (paille), brun chaud (bois)
   Typographie : Cormorant Garamond (titres élégants) + Inter (lecture)
   ============================================================ */

/* --- 1. VARIABLES GLOBALES --------------------------------- */
:root {
    /* Couleurs principales inspirées du vignoble */
    --vert-vigne:    #1E3A2F; /* Vert sombre, feuille de vigne */
    --vert-moyen:    #2D5A3D; /* Vert intermédiaire pour survols */
    --or-raisin:     #C4922A; /* Doré chaud, raisin mûr / accent */
    --creme:         #F5F0E8; /* Fond crème, paille séchée */
    --blanc-pur:     #FFFFFF;
    --brun-texte:    #2C2218; /* Brun foncé pour le texte principal */
    --gris-doux:     #8A8078; /* Texte secondaire, légendes */
    --bordure:       #D9D0C0; /* Lignes de séparation discrètes */

    /* Typographie */
    --police-titre:  'Cormorant Garamond', Georgia, serif;
    --police-texte:  'Inter', system-ui, sans-serif;

    /* Espacements (unités cohérentes) */
    --espace-xs:  8px;
    --espace-s:   16px;
    --espace-m:   32px;
    --espace-l:   64px;
    --espace-xl:  100px;

    /* Rayon de bordure (très faible, sobriété) */
    --rayon:      4px;
}

/* --- 2. RESET GLOBAL --------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Calcul de taille incluant padding et bordure */
}

/* --- 3. BODY & TEXTE --------------------------------------- */
body {
    font-family: var(--police-texte);
    font-size: 17px;
    line-height: 1.7;
    color: var(--brun-texte);
    background-color: var(--blanc-pur);
    -webkit-font-smoothing: antialiased; /* Rendu plus net sur Mac */
}

/* --- 4. TYPOGRAPHIE GÉNÉRALE ------------------------------- */
h1, h2, h3 {
    font-family: var(--police-titre);
    font-weight: 600;
    line-height: 1.2;
    color: var(--vert-vigne);
}

h1 { font-size: clamp(38px, 6vw, 72px); }  /* clamp = responsive automatique */
h2 { font-size: clamp(28px, 4vw, 48px); }
h3 { font-size: clamp(20px, 2.5vw, 28px); }

p { margin-bottom: 1.2em; }
p:last-child { margin-bottom: 0; }

ul { list-style: none; } /* On stylise les listes nous-mêmes */

a { color: inherit; }


/* ============================================================
   5. NAVIGATION
   ============================================================ */
header {
    position: sticky;       /* Reste en haut lors du défilement */
    top: 0;
    z-index: 200;           /* Au-dessus de tout le reste */
    background-color: var(--blanc-pur);
    border-bottom: 1px solid var(--bordure);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px;
}

/* Logo : nom du domaine en typographie de titre */
.logo {
    font-family: var(--police-titre);
    font-size: 22px;
    font-weight: 700;
    color: var(--vert-vigne);
    text-decoration: none;
    letter-spacing: 0.5px;
}

/* Liens de navigation */
.nav-links {
    display: flex;
    gap: var(--espace-m);
    align-items: center;
}

.nav-links a {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;       /* Espacement large = élégance */
    text-transform: uppercase;
    color: var(--brun-texte);
    text-decoration: none;
    transition: color 0.25s ease;
    padding-bottom: 2px;
}

/* Lien actif et survol : soulignement doré */
.nav-links a:hover,
.nav-links a.active {
    color: var(--or-raisin);
    border-bottom: 2px solid var(--or-raisin);
}


/* ============================================================
   6. SECTION HÉRO (bannière haute de page)
   ============================================================ */
.hero {
    position: relative;
    min-height: 55vh;               /* Hauteur minimale */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    background-color: var(--vert-vigne); /* Couleur de secours si image absente */
}

/* Image de fond du héro */
.hero-bg {
    position: absolute;
    inset: 0;                       /* Équivalent de top/right/bottom/left: 0 */
    background-size: cover;
    background-position: center;
    opacity: 0.35;                  /* On assombrit pour que le texte ressorte */
}

/* Contenu du héro (texte) au-dessus de l'image */
.hero-content {
    position: relative;             /* Pour passer au-dessus du .hero-bg absolu */
    z-index: 1;
    padding: var(--espace-l) var(--espace-s);
    max-width: 780px;
}

.hero-content h1 {
    color: var(--blanc-pur);
    margin-bottom: var(--espace-s);
    text-shadow: 0 2px 20px rgba(0,0,0,0.3); /* Légère ombre pour la lisibilité */
}

/* Trait décoratif doré sous le titre principal */
.hero-content h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--or-raisin);
    margin: 20px auto 0;
}

.hero-content p {
    color: rgba(255,255,255,0.88);
    font-size: clamp(16px, 2vw, 20px);
    margin-bottom: var(--espace-m);
    font-weight: 300;
}

/* Héro agrandi pour la page d'accueil uniquement */
.hero.hero--accueil { min-height: 80vh; }


/* ============================================================
   7. BOUTONS
   ============================================================ */

/* Bouton principal : fond vert foncé */
.btn {
    display: inline-block;
    padding: 14px 32px;
    background-color: var(--vert-vigne);
    color: var(--blanc-pur);
    font-family: var(--police-texte);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none;
    border: 2px solid var(--vert-vigne);
    border-radius: var(--rayon);
    cursor: pointer;
    transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}

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

/* Bouton inversé : contour (utilisé sur fond sombre) */
.btn--inverse {
    background-color: transparent;
    color: var(--blanc-pur);
    border-color: var(--blanc-pur);
}

.btn--inverse:hover {
    background-color: var(--or-raisin);
    border-color: var(--or-raisin);
}

/* Bouton pleine largeur (formulaires) */
.btn--plein {
    width: 100%;
    text-align: center;
}


/* ============================================================
   8. CONTENEUR GÉNÉRAL (centrage du contenu)
   ============================================================ */
.contenu {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--espace-l) 24px;
}

/* Variante texte seul, plus étroite pour la lisibilité */
.contenu--etroit {
    max-width: 780px;
}


/* ============================================================
   9. SECTION SAISON (bandeau informatif avec dates)
   ============================================================ */
.saison-bandeau {
    background-color: var(--creme);
    border-top: 3px solid var(--or-raisin);
    padding: var(--espace-m) 24px;
    text-align: center;
}

.saison-bandeau p {
    font-size: 15px;
    color: var(--gris-doux);
    margin-bottom: 0;
}

/* La date/info modifiable par l'admin s'affiche en doré */
.saison-bandeau strong {
    color: var(--or-raisin);
    font-weight: 700;
}


/* ============================================================
   10. CARTES DE SERVICES (page d'accueil)
   ============================================================ */
.grille-services {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--espace-m);
    margin-top: var(--espace-m);
}

.carte {
    background-color: var(--creme);
    border: 1px solid var(--bordure);
    border-top: 4px solid var(--vert-vigne);
    border-radius: var(--rayon);
    padding: var(--espace-m) var(--espace-m);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.carte:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(30,58,47,0.12);
}

.carte h2 {
    font-size: 28px;
    margin-bottom: var(--espace-s);
    color: var(--vert-vigne);
}

.carte p {
    color: var(--gris-doux);
    font-size: 15px;
    margin-bottom: var(--espace-m);
}

/* Icône décorative en chiffre romain (astuce CSS élégante) */
.carte::before {
    content: attr(data-num);     /* Récupère l'attribut data-num du HTML */
    display: block;
    font-family: var(--police-titre);
    font-size: 56px;
    color: var(--or-raisin);
    opacity: 0.3;
    line-height: 1;
    margin-bottom: 8px;
}


/* ============================================================
   11. SECTION LISTE DE POSTES (vendanges, palissage)
   ============================================================ */
.liste-postes {
    margin: var(--espace-m) 0;
}

/* Chaque poste est une ligne avec un bord gauche doré */
.poste {
    border-left: 3px solid var(--or-raisin);
    padding: var(--espace-s) var(--espace-m);
    margin-bottom: var(--espace-s);
    background-color: var(--creme);
}

.poste h3 {
    font-size: 20px;
    color: var(--vert-vigne);
    margin-bottom: 6px;
}

.poste p {
    color: var(--gris-doux);
    font-size: 15px;
    margin-bottom: 0;
}


/* ============================================================
   12. SECTION "EN CHIFFRES" (stats visuelles)
   ============================================================ */
.stats {
    background-color: var(--vert-vigne);
    padding: var(--espace-l) 24px;
    text-align: center;
}

.stats-grille {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--espace-m);
    max-width: 900px;
    margin: 0 auto;
}

.stat-item strong {
    display: block;
    font-family: var(--police-titre);
    font-size: 60px;
    color: var(--or-raisin);
    line-height: 1;
}

.stat-item span {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    letter-spacing: 1px;
    text-transform: uppercase;
}


/* ============================================================
   13. FORMULAIRE DE CONTACT
   ============================================================ */
.formulaire-wrapper {
    max-width: 620px;
    margin: 0 auto;
}

/* Chaque groupe : label + champ */
.champ-groupe {
    margin-bottom: var(--espace-s);
}

.champ-groupe label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--vert-vigne);
    margin-bottom: 8px;
}

/* Styles unifiés pour tous les champs de saisie */
.champ-groupe input,
.champ-groupe select,
.champ-groupe textarea {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--police-texte);
    font-size: 16px;
    color: var(--brun-texte);
    background-color: var(--blanc-pur);
    border: 1.5px solid var(--bordure);
    border-radius: var(--rayon);
    transition: border-color 0.2s;
    appearance: none; /* Supprime le style navigateur sur les selects */
}

/* Bordure verte au focus (accessibilité + esthétique) */
.champ-groupe input:focus,
.champ-groupe select:focus,
.champ-groupe textarea:focus {
    outline: none;
    border-color: var(--vert-vigne);
    box-shadow: 0 0 0 3px rgba(30,58,47,0.12);
}

.champ-groupe textarea {
    resize: vertical;   /* L'utilisateur peut agrandir verticalement */
    min-height: 140px;
}

/* Message de confirmation après envoi */
.message-confirmation {
    background-color: #EAF5EE;
    border: 1px solid #5BA370;
    border-left: 4px solid #2D5A3D;
    color: #1E3A2F;
    padding: var(--espace-s);
    border-radius: var(--rayon);
    margin-bottom: var(--espace-m);
    display: none; /* Caché par défaut, affiché par PHP si envoi réussi */
}

/* Message d'erreur */
.message-erreur {
    background-color: #FDF0ED;
    border: 1px solid #E07A5F;
    border-left: 4px solid #B85C3C;
    color: #7A2E14;
    padding: var(--espace-s);
    border-radius: var(--rayon);
    margin-bottom: var(--espace-m);
    display: none;
}


/* ============================================================
   14. PIED DE PAGE (footer)
   ============================================================ */
footer {
    background-color: var(--vert-vigne);
    color: rgba(255,255,255,0.75);
    padding: var(--espace-l) 24px var(--espace-m);
    margin-top: var(--espace-xl);
}

.footer-grille {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--espace-m);
    max-width: 1200px;
    margin: 0 auto var(--espace-m);
}

.footer-col h4 {
    font-family: var(--police-titre);
    font-size: 18px;
    color: var(--blanc-pur);
    margin-bottom: var(--espace-s);
}

.footer-col p,
.footer-col a {
    font-size: 14px;
    line-height: 2;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    display: block;
}

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

/* Trait de séparation et copyright */
.footer-bas {
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-top: var(--espace-s);
    text-align: center;
    font-size: 13px;
    max-width: 1200px;
    margin: 0 auto;
}


/* ============================================================
   15. INTERFACE D'ADMINISTRATION (page admin.php)
   Visuellement distincte : fond crème, encadré vert foncé
   ============================================================ */
.admin-entete {
    background-color: var(--vert-vigne);
    color: var(--blanc-pur);
    padding: var(--espace-s) 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-entete span {
    font-size: 14px;
    opacity: 0.8;
}

.admin-corps {
    max-width: 860px;
    margin: var(--espace-l) auto;
    padding: 0 24px;
}

.admin-titre {
    font-family: var(--police-titre);
    font-size: 36px;
    color: var(--vert-vigne);
    margin-bottom: 6px;
}

.admin-sous-titre {
    color: var(--gris-doux);
    font-size: 15px;
    margin-bottom: var(--espace-m);
}

/* Chaque bloc modifiable est une carte distincte */
.admin-bloc {
    background-color: var(--creme);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: var(--espace-m);
    margin-bottom: var(--espace-m);
}

.admin-bloc h3 {
    font-size: 18px;
    color: var(--vert-vigne);
    margin-bottom: var(--espace-s);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bordure);
}

/* Champs de l'admin similaires au formulaire public */
.admin-bloc input[type="text"],
.admin-bloc input[type="date"],
.admin-bloc textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--police-texte);
    font-size: 15px;
    color: var(--brun-texte);
    background-color: var(--blanc-pur);
    border: 1.5px solid var(--bordure);
    border-radius: var(--rayon);
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.admin-bloc input:focus,
.admin-bloc textarea:focus {
    outline: none;
    border-color: var(--vert-vigne);
    box-shadow: 0 0 0 3px rgba(30,58,47,0.1);
}

.admin-bloc textarea { min-height: 100px; resize: vertical; }

.admin-bloc label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--gris-doux);
    margin-bottom: 6px;
}

/* Bouton spécifique admin (plein, vert) */
.btn-admin {
    background-color: var(--vert-vigne);
    color: var(--blanc-pur);
    border: none;
    padding: 12px 28px;
    font-family: var(--police-texte);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--rayon);
    cursor: pointer;
    transition: background-color 0.2s;
}

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


/* ============================================================
   16. PAGE DE CONNEXION ADMIN
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--vert-vigne);
}

.login-boite {
    background-color: var(--blanc-pur);
    border-radius: 8px;
    padding: var(--espace-l);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-boite h1 {
    font-size: 28px;
    margin-bottom: 6px;
}

.login-boite p {
    color: var(--gris-doux);
    font-size: 14px;
    margin-bottom: var(--espace-m);
}

.login-boite input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1.5px solid var(--bordure);
    border-radius: var(--rayon);
    margin-bottom: 14px;
    font-family: var(--police-texte);
}

.login-boite input:focus {
    outline: none;
    border-color: var(--vert-vigne);
    box-shadow: 0 0 0 3px rgba(30,58,47,0.1);
}

.login-erreur {
    background: #FDF0ED;
    color: #7A2E14;
    border: 1px solid #E07A5F;
    padding: 10px 14px;
    border-radius: var(--rayon);
    font-size: 14px;
    margin-bottom: 14px;
    text-align: left;
}


/* ============================================================
   17. RESPONSIVE — Adaptation mobile (< 768px)
   ============================================================ */
@media (max-width: 768px) {

    /* Navigation : empilée verticalement */
    nav {
        flex-direction: column;
        gap: 14px;
        padding: 14px 20px;
    }

    .nav-links {
        gap: var(--espace-s);
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Cartes en colonne unique sur mobile */
    .grille-services,
    .stats-grille,
    .footer-grille {
        grid-template-columns: 1fr;
    }

    .stat-item strong { font-size: 44px; }

    /* Espacements réduits */
    .contenu { padding: var(--espace-m) 16px; }
    footer { margin-top: var(--espace-m); }
}


/* ============================================================
   18. ICÔNE PROFIL (navigation)
   ============================================================ */

/* Bouton rond avec l'icône silhouette */
.btn-profil {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid var(--bordure);
    background: transparent;
    color: var(--brun-texte);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;   /* Pour le point vert absolu */
    margin-left: 8px;
}

.btn-profil:hover { border-color: var(--vert-vigne); background: var(--creme); }

/* Variante connectée : bord vert */
.btn-profil--connecte {
    border-color: var(--vert-moyen);
    color: var(--vert-vigne);
}

/* Point vert "connecté" (en haut à droite de l'icône profil) */
.profil-point-vert {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #27ae60;
    border-radius: 50%;
    border: 2px solid #fff;
}


/* ============================================================
   19. MODALE DE CONNEXION
   ============================================================ */

/* Fond semi-transparent qui couvre toute la page */
.modale-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 500;
    display: flex;            /* Centrage de la boîte */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* La boîte blanche au centre */
.modale-boite {
    background: var(--blanc-pur);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Bouton × pour fermer la modale */
.modale-fermer {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gris-doux);
    cursor: pointer;
    line-height: 1;
}

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


/* ============================================================
   20. BARRE D'ÉDITION (flottante, mode admin connecté)
   ============================================================ */

/* Barre fixe en bas de l'écran */
#barre-edition {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 400;
    background: var(--vert-vigne);
    color: var(--blanc-pur);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    font-size: 14px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}

/* Point clignotant indiquant le mode édition */
.point-edition {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
    margin-right: 10px;
    animation: clignoter 1.5s infinite;
}

@keyframes clignoter {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.2; }
}

/* Bouton Enregistrer dans la barre */
.btn-sauvegarder {
    background: var(--or-raisin);
    color: var(--blanc-pur);
    border: none;
    padding: 10px 22px;
    font-family: var(--police-texte);
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-sauvegarder:hover { background: #a87820; }


/* ============================================================
   21. TEXTES ÉDITABLES (mode admin)
   Quand [data-cle] est affiché et que l'admin est connecté,
   on applique ces styles pour indiquer que c'est modifiable.
   ============================================================ */

/* La classe .editable est ajoutée par JavaScript si admin connecté */
.editable {
    outline: 2px dashed rgba(196, 146, 42, 0.4);
    outline-offset: 3px;
    border-radius: 2px;
    cursor: text;
    transition: outline-color 0.2s;
}

.editable:hover,
.editable:focus {
    outline-color: var(--or-raisin);
    background: rgba(196, 146, 42, 0.05);
}

/* Ajoute un badge "Modifier" au survol */
.editable:hover::after {
    content: ' ✏️';
    font-size: 0.75em;
    opacity: 0.6;
}

/* Marge supplémentaire en bas de page quand la barre est visible */
body.mode-edition {
    padding-bottom: 70px;
}
