/* =========================
   COMPETENCE REFLEXE – CSS
   Fix Safari iOS menu + logos
   ========================= */

:root{
  --primary-color:#2c3e50;
  --secondary-color:#3498db;
  --bg-color:#ecf0f1;
  --text-color:#fff;
  --font-family: Arial, sans-serif;
  --header-h: 96px; /* fallback (JS will update) */
}

*{margin:0;padding:0;box-sizing:border-box;}

html, body{height:100%;}

body{
  font-family: var(--font-family);
  color: var(--primary-color);
  background: var(--bg-color);
  line-height: 1.6;
  /* Push content below fixed header (JS updates --header-h) */
  padding-top: calc(var(--header-h) + env(safe-area-inset-top));
}

/* ===== Header / Nav ===== */
.main-header{
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  z-index: 99999;
  background: #fff;
  border-bottom: 2px solid rgba(0,0,0,.08);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  isolation: isolate; /* reliable stacking on Safari */
}

.logo img{
  height: 56px;
  width: auto;
  max-width: 46vw;
  object-fit: contain;
  display:block;
}

/* Qualiopi logo right */
#qplogo{
  height: 48px;
  width: auto;
  max-width: 42vw;
  object-fit: contain;
  margin-left: 8px;
  pointer-events: none; /* avoid blocking taps on iOS */
}

nav{
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

/* Desktop nav */
.nav-links{
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.nav-links a{
  color: #000;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 10px;
  display: block;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-links a:hover{
  background: var(--secondary-color);
  color: #fff;
}

/* Hamburger */
.hamburger-menu{
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hamburger-menu span{
  height: 3px;
  width: 26px;
  border-radius: 2px;
  background: var(--secondary-color);
}

/* Mobile overlay menu (Safari iOS friendly) */
@media (max-width: 768px){
  .hamburger-menu{display:flex;}

  /* Hide desktop list until opened */
  .nav-links{
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: calc(var(--header-h) + env(safe-area-inset-top));
    background: #fff;
    box-shadow: 0 14px 40px rgba(0,0,0,.22);
    border-top: 1px solid rgba(0,0,0,.06);
    padding: 10px 12px;
    flex-direction: column;
    gap: 4px;

    z-index: 100000;

    /* iOS scrolling */
    max-height: calc(100vh - (var(--header-h) + env(safe-area-inset-top)));
    max-height: calc(100dvh - (var(--header-h) + env(safe-area-inset-top)));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    transform: translate3d(0,0,0);
  }

  .nav-links.active{display:flex;}

  html.menu-open, body.menu-open{overflow:hidden;}

  /* Ensure hero never visually sits above */
  #hero{position: relative !important; z-index: 0 !important;}
}

/* Smaller phones */
@media (max-width: 420px){
  .logo img{height: 48px;}
  #qplogo{height: 40px;}
}

/* Super small */
@media (max-width: 360px){
  #qplogo{display:none;}
}


/* Section Héros */

#hero {
    background: url('images/FondAccueil.JPG') no-repeat center center/cover;
    height: 60vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    text-align: center;
}

.hero-overlay {
    background: rgba(0, 0, 0, 0.5); /* Fond semi-transparent pour lisibilité */
    padding: 2rem;
    border-radius: 8px;
}

.hero-overlay h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-overlay p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.btn-primary {
    background: var(--secondary-color);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.3s;
}

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

/* Section Mosaïque de logos */
#logos {
    padding: 3rem 1rem; /* Réduction modérée du padding supérieur */
    text-align: center;
    background: var(--bg-color);
    margin-top: -0.5rem; /* Réduction subtile de l’espace entre la photo et les logos */
}

.logo-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly; /* Même espace entre les logos et aux bords */
    align-items: center;
    row-gap: 2rem; /* espace vertical entre les lignes si ça revient à la ligne */
    max-width: 100%;
    margin: 0 auto;
}

.logo-grid img {
    width: min(18vw, 140px); /* s'adapte à la largeur d'écran mais reste limité sur grand écran */
    height: auto;
    object-fit: contain;
    background: transparent;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

/* Adaptation spécifique pour les petits écrans */
@media (max-width: 600px) {
    .logo-grid img {
        width: 22vw;   /* un peu plus petit pour tenir confortablement sur mobile */
        max-width: 90px;
    }
}

/* Section résultats */
#results {
    padding: 4rem 1rem;
    text-align: center;
    background: var(--bg-color);
}

/* Titre de la page de résultats en orange */
.results-content h1 {
    color: #e67e22; /* Orange */
    font-size: 3rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Texte lisible */
.results-content p {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 2rem;
    line-height: 1.8;
}

/* Conteneur de la barre de progression */
.progress-bar-container {
    width: 100%;
    max-width: 600px;
    height: 30px;
    background: #ddd;
    border-radius: 15px;
    margin: 0 auto 2rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Barre de progression */
.progress-bar {
    width: 0;
    height: 100%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    border-radius: 15px;
    transition: width 0.1s ease-in-out; /* Transition fluide */
}

/* Grille de photos avec 3 colonnes */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 colonnes fixes */
    gap: 1rem;
    padding: 1rem;
}

/* Conteneur des images avec taille automatique */
.photo-grid img {
    width: 100%;
    height: auto; /* Ajustement automatique de la hauteur */
    object-fit: contain; /* Ajuste l'image sans découpe ni déformation */
    background-color: #f8f8f8; /* Fond neutre autour des images */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 5px;
    transition: transform 0.3s;
}

.photo-grid img:hover {
    transform: scale(1.05); /* Effet de zoom au survol */
}

/* Modale en pleine page */
.modal {
    display: none; /* Masquée par défaut */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Fond noir semi-transparent */
    justify-content: center;
    align-items: center;
}

.modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* Bouton de fermeture */
.modal .close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    font-weight: bold;
}

.modal .close:hover {
    color: #bbb;
}

/* Section À propos */
#about {
    text-align: center;
    background: var(--bg-color);
    color: var(--primary-color);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.about-content p {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Image de la carte */
.about-image {
    width: 100%;
    max-width: 800px; /* Limite la taille maximale de la carte */
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}

/* Section Contact */
#contact {
    padding: 4rem 1rem;
    text-align: center;
    background: var(--bg-color);
    color: var(--primary-color);
}

.contact-content {
    max-width: 900px;
    margin: 0 auto;
}

.contact-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.contact-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    line-height: 1.8;
}

/* Formulaire moderne */
.contact-form {
    display: grid;
    gap: 2rem;
    text-align: left;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    max-width: 700px;
    margin: 0 auto;
}

/* Champs de formulaire */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea {
    padding: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1.1rem;
    width: 100%;
    background: #f9f9f9;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--secondary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

/* Bouton stylisé */
.contact-form button {
    padding: 1rem 2rem;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.contact-form button:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

/* Pied de page */
.main-footer {
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}


/* === Ajouts pour corriger l'affichage mobile === */

@media (max-width: 768px) {
    /* Corrige le bouton sur mobile */
    .btn-primary {
        display: inline-block;
        width: 90%;
        text-align: center;
        padding: 1rem;
        font-size: 1rem;
        margin-top: 1rem;
    }

    /* Empêche les logos de déborder */
    .logo-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly; /* Même espace entre les logos et aux bords */
    align-items: center;
    row-gap: 2rem; /* espace vertical entre les lignes si ça revient à la ligne */
    max-width: 100%;
    margin: 0 auto;
}

    .logo-grid img {
    width: min(18vw, 140px); /* s'adapte à la largeur d'écran mais reste limité sur grand écran */
    height: auto;
    object-fit: contain;
    background: transparent;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

/* Adaptation spécifique pour les petits écrans */
@media (max-width: 600px) {
    .logo-grid img {
        width: 22vw;   /* un peu plus petit pour tenir confortablement sur mobile */
        max-width: 90px;
    }
}
}



/* Corrige l'affichage des sous-menus sur mobile */
@media (max-width: 768px) {
    .nav-links li {
        position: relative;
    }

    .nav-links li ul {
        display: none;
        position: relative;
        background: rgba(255, 255, 255, 0.95);
        padding-left: 1rem;
        box-shadow: none;
        border-radius: 0;
    }

    .nav-links li.show-submenu ul {
        display: block;
    }

    .nav-links li ul li a {
        color: #000;
    }
}



/* Ajoute une couleur de fond aux liens du menu sur mobile */
@media (max-width: 768px) {
    .nav-links li a {
        background-color: #ffffff;
        color: #000000;
        border-bottom: 1px solid #ddd;
        padding: 1rem;
    }

    .nav-links li a:hover {
        background-color: #f0f0f0;
    }
}



/* Style amélioré du menu déroulant sur mobile */
@media (max-width: 768px) {
    .nav-links li a {
        background-color: #ffffff;
        color: #2c3e50;
        border-bottom: 1px solid #e0e0e0;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        font-weight: 600;
        transition: background-color 0.3s ease, color 0.3s ease;
    }

    .nav-links li a:hover {
        background-color: #3498db;
        color: #ffffff;
    }

    .nav-links {
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 10px 10px;
    }

    .hamburger-menu span {
        background: #3498db;
    }
}


/* Liens du bas de page */
.legal-links {
    margin-top: 1rem;
}

.legal-links a {
    color: #000;
    text-decoration: none;
    margin: 0 0.5rem;
}

.legal-links a:hover {
    text-decoration: underline;
}

/* === site-core (externalized) === */
:root{ --container-max: 1200px; --pad: clamp(12px,3vw,24px); }
/* Header 110px site-wide */
header, .site-header, .main-header, header.navbar, .navbar, .navbar-default{
  height:110px !important; min-height:110px !important;
}
header .inner, header .container, header .container-fluid,
.site-header .container, .navbar .container, .main-header .container{
  display:flex !important; align-items:center !important;
}
/* Home: logos pyramid — centered with wider spacing */
#logos .logo-pyramid{ display:grid; grid-template-rows:auto auto; row-gap:18px; width:fit-content; margin:0 auto; }
#logos .logo-pyramid .row{ display:grid; grid-auto-flow:column; grid-auto-columns:max-content;
  justify-content:center; align-items:center; column-gap: clamp(36px,5.5vw,96px); }
#logos .logo-pyramid img{ width:120px; height:120px; object-fit:contain; border-radius:50%; }
@media (max-width:1024px){ #logos .logo-pyramid img{ width:100px; height:100px; } }
@media (max-width:768px){
  #logos .logo-pyramid .row{ column-gap:18px; }
  #logos .logo-pyramid img{ width:88px; height:88px; }
}
/* About: container, title, and map use the same width and centering */
#about-clean{ display:block !important; margin:0 auto; padding:clamp(16px,2.5vh,28px) var(--pad); max-width:var(--container-max); }
#about-title{
  color:#2563eb !important; text-align:center !important; font-weight:800 !important;
  font-size: clamp(40px,4.2vw,64px) !important; line-height:1.15 !important; margin:0 0 clamp(14px,2vh,20px) 0 !important;
}
#clients-map{
  width:100% !important; max-width:var(--container-max) !important; margin:0 auto !important;
  height: min(60vh, 560px) !important; min-height:360px !important; border-radius:14px;
}
@media (max-width:1024px){ :root{ --container-max: 92vw; } }
@media (max-width:768px){ #clients-map{ height:min(58vh,420px) !important; } }
/* === /site-core === */


/* === fix: strong centering for home logos === */
section#logos, #logos{ display:block; }
#logos .logo-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly; /* Même espace entre les logos et aux bords */
    align-items: center;
    row-gap: 2rem; /* espace vertical entre les lignes si ça revient à la ligne */
    max-width: 100%;
    margin: 0 auto;
}
#logos .logo-pyramid{ width:fit-content !important; margin-left:auto !important; margin-right:auto !important; }
#logos .logo-pyramid .row{
  display:grid !important;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  justify-content: center !important;
  align-items: center !important;
}
/* === /fix === */


/* === fix: precise centering for About title === */
#about-clean{ text-align: initial; } /* keep default for section */
#about-title{
  display: table !important;          /* shrink to text width */
  margin-left: auto !important;
  margin-right: auto !important;      /* centers precisely */
  padding-inline: 0 !important;
  text-align: center !important;
}
/* === /fix === */


/* === About vertical centering for title between header and map === */
:root{ --header-h: 110px; --map-h: clamp(360px, 60vh, 560px); }
#clients-map{ height: var(--map-h) !important; min-height: 360px !important; }
#about-clean{
  /* push the title down so it sits roughly midway between header and map */
  padding-top: max(12px, calc((100vh - var(--header-h) - var(--map-h) - 64px) / 2)) !important;
}
@media (max-width: 768px){
  :root{ --map-h: clamp(320px, 58vh, 420px); }
  #about-clean{ padding-top: max(8px, calc((100vh - var(--header-h) - var(--map-h) - 48px) / 2)) !important; }
}
/* === /About vertical centering === */


/* === About: equal vertical centering of title between header and map (grid spacers) === */
:root{ --header-h: 110px; --map-h: clamp(360px, 60vh, 560px); }
#clients-map{ height: var(--map-h) !important; min-height: 360px !important; }

#about-clean{
  display: grid !important;
  grid-template-rows: 1fr auto 1fr auto; /* spacer / title / spacer / map */
  padding-top: 40px !important;
  padding-bottom: clamp(8px, 1.5vh, 16px) !important;
}

#about-clean::before, #about-clean::after{ content:""; }

#about-title{ 
  grid-row: 2;
  margin: 0 auto 0 auto !important; 
}

#clients-map{ grid-row: 4; }
/* On small screens, reduce min-height so the layout remains breathable */
@media (max-width: 768px){
  :root{ --map-h: clamp(320px, 58vh, 420px); }
  #about-clean{ min-height: calc(100vh - var(--header-h) - 10px); }
}
/* === /About grid centering === */

/* Carte clients — logos non déformés */
.client-logo-icon { background: transparent !important; border: 0 !important; }
.client-logo-icon img { display:block; height:65px; width:auto; object-fit:contain; }
@media (max-width:768px){ .client-logo-icon img { height:42px; } }


/* Fix clic menu mobile : toujours au-dessus */
.main-header{ position: fixed; top:0; left:0; right:0; z-index: 2000; }
.main-header nav{ position: relative; z-index: 2010; }
.main-header .hamburger-menu{ position: relative; z-index: 2020; }
.main-header .nav-links{ position: absolute; z-index: 2030; }

/* === FIX MENU MOBILE AU-DESSUS DU HERO (ACCUEIL) === */
@media (max-width: 768px){
  /* le header doit être au-dessus de tout */
  .main-header{ z-index: 99999 !important; }

  /* le menu déroulant doit se superposer au contenu (pas "dans" le header) */
  .main-header .nav-links{
    position: fixed !important;
    top: 96px !important; /* ~hauteur du header (logo + padding) */
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 99998 !important;
    max-height: calc(100vh - 96px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    /* Visibilité: éviter que l'image d'accueil ne "masque" visuellement le menu */
    background: #ffffff !important;
    background-color: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    border-top: 1px solid rgba(0,0,0,0.08);
    border-bottom: 1px solid rgba(0,0,0,0.08);
  }

  /* Contraste des liens dans le menu mobile */
  .main-header .nav-links a{
    color: #000 !important;
  }

  .main-header .nav-links li a:hover{
    background: rgba(0,0,0,0.06) !important;
    color: #000 !important;
  }

  /* Le hero reste derrière le menu */
  #hero{ position: relative !important; z-index: 0 !important; }
}
/* === /FIX MENU MOBILE AU-DESSUS DU HERO === */



/* === Footer Qualiopi (logo en bas de page) === */
.footer-qualiopi{
  display:flex;
  justify-content:center;
  align-items:center;
  margin-top: 12px;
}
.footer-qualiopi .qualiopi-logo{
  width: min(320px, 80vw);
  height: auto;
  max-height: 90px;
  object-fit: contain;
}

/* Numéro en haut de la page Évoluer */
.page-phone{
  margin: 0 0 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  background: rgba(255,255,255,.95);
}
.page-phone a{
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}


/* =====================================================
   MOBILE ACCESSIBILITÉ (sans impacter la version desktop)
   - Réduit la hauteur du header (bande blanche)
   - Typo lisible + boutons cliquables
   - Mise en colonne des layouts multi-colonnes
   - Empêche le scroll horizontal
   ===================================================== */

@media (max-width: 768px){
  /* Anti "scroll" horizontal */
  html, body{ overflow-x: hidden; }

  /* Header : on annule la hauteur fixe desktop */
  header, .site-header, .main-header, header.navbar, .navbar, .navbar-default{
    height: auto !important;
    min-height: 0 !important;
  }

  .main-header{
    padding: 6px 12px !important;
    padding-top: calc(6px + env(safe-area-inset-top)) !important;
  }

  .logo img{ height: 44px !important; max-width: 60vw; }
  #qplogo{ height: 36px !important; max-width: 45vw; }

  /* Menu mobile : s'aligne sur la vraie hauteur du header */
  .main-header .nav-links{
    top: calc(var(--header-h) + env(safe-area-inset-top)) !important;
    max-height: calc(100vh - (var(--header-h) + env(safe-area-inset-top))) !important;
    max-height: calc(100dvh - (var(--header-h) + env(safe-area-inset-top))) !important;
  }

  /* Grille / colonnes -> 1 colonne */
  .row, .flex, .grid{ flex-direction: column !important; }

  /* Typo confortable (sans toucher au desktop) */
  h1{ font-size: clamp(22px, 6vw, 32px) !important; line-height: 1.15; }
  h2{ font-size: clamp(20px, 5.2vw, 26px) !important; }
  h3{ font-size: clamp(18px, 4.8vw, 22px) !important; }
  p, li{ font-size: 16px !important; line-height: 1.55; }

  /* Héros : évite un bloc trop haut + padding plus doux */
  #hero{
    height: auto !important;
    min-height: 56vh;
    padding: 72px 0 36px 0;
  }
  .hero-overlay{ padding: 1.1rem !important; border-radius: 12px; }
  .hero-overlay h1{ font-size: clamp(22px, 6.2vw, 30px) !important; }
  .hero-overlay p{ font-size: 16px !important; }

  /* CTA / boutons : taille "pouce" */
  .btn-primary, .btn, button, input[type="submit"]{
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 12px 14px !important;
    font-size: 16px !important;
    border-radius: 14px;
  }

  /* Sections : padding adapté */
  section{ padding-left: 15px !important; padding-right: 15px !important; }

  /* Images : toujours dans l'écran */
  img{ max-width: 100%; height: auto; }

  /* Logos accueil : évite des logos trop gros */
  #logos{ padding: 2rem 0.5rem !important; }
  #logos .logo-grid img{ max-height: 84px; width: auto; }

  /* Footer : marge douce */
  .main-footer{ padding: 18px 14px !important; }
}

@media (max-width: 420px){
  .logo img{ height: 40px !important; }
  #qplogo{ height: 32px !important; }
  .nav-links a{ padding: 12px 12px !important; }
}
