/**
 * SYNTORALIS - Feuille de style principale
 * Thème : Éco-conception, Accessible (RGAA AAA), Minimaliste
 * Version : 2.0 (Header Minimaliste)
 */

/* ==========================================================================
   1. VARIABLES & THÈMES (Contraste Élevé)
   ========================================================================== */
:root {
  /* Palette Mode Clair */
  --bg-color: #ffffff;
  --text-color: #1a1a1a; /* Noir légèrement adouci pour la lecture */
  --card-bg: #f5f5f5;
  --border-color: #cccccc;
  --shadow: rgba(0, 0, 0, 0.08);
  
  /* Vert Institutionnel (Contraste > 7:1 sur blanc) */
  --accent-color: #1B5E20;
  --accent-hover: #2E7D32;
  
  --focus-outline: 3px solid #1B5E20;
  --error-color: #4d0e0e; 
  --success-color: #1B5E20; 
  --error-bg-field: rgba(248, 30, 30, 0.1);
  --transition-speed: 0.3s;
}

[data-theme="dark"] {
  /* Palette Mode Sombre */
  --bg-color: #121212;
  --text-color: #e0e0e0; /* Blanc cassé pour réduire la fatigue oculaire */
  --card-bg: #1e1e1e;
  --border-color: #444444;
  --shadow: rgba(0, 0, 0, 0.4);
  
  /* Vert Néon Doux (Contraste > 7:1 sur noir) */
  --accent-color: #69F0AE;
  --accent-hover: #B9F6CA;
  
  --focus-outline: 3px solid #69F0AE;
  --error-color: #ff8a80; /* Rouge clair pour contraste sur noir */
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color var(--transition-speed), color var(--transition-speed);
  max-width: 100%;
  overflow-x: hidden;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* ==========================================================================
   3. TYPOGRAPHIE & LIENS
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.2rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
  cursor: pointer;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

/* ==========================================================================
   4. LAYOUT & GRILLE
   ========================================================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -1rem;
}

.col {
  flex: 1 1 100%;
  padding: 0 1rem;
}

/* ==========================================================================
   5. COMPOSANTS (Header Minimaliste, Hero, Cards, Buttons)
   ========================================================================== */

/* --- HEADER MINIMALISTE (Fond Transparent) --- */
header {
  background-color: transparent !important;
  border-bottom: none !important;
  box-shadow: none !important;
  padding: 1rem 0;
  position: absolute; /* Flotte au-dessus du Hero */
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent-color);
  text-decoration: none;
  display: flex;
  align-items: center;
}

/* Bouton Mode Sombre */
.theme-toggle {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 50px; /* Plus arrondi */
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 5px var(--shadow);
}

.theme-toggle:hover { 
  background: var(--border-color); 
  transform: translateY(-1px);
}

.theme-toggle svg { 
  width: 1.2rem; 
  height: 1.2rem; 
  fill: currentColor; 
}

/* --- HERO SECTION --- */
.hero {
  text-align: center;
  padding: 6rem 1.5rem 3rem; /* Padding top augmenté pour compenser le header */
  background: var(--card-bg);
  border-radius: 0 0 12px 12px; /* Arrondi seulement en bas */
  margin-bottom: 0rem;
  box-shadow: 0 4px 12px var(--shadow);
}

.hero h1 { 
  font-size: 2.5rem; 
  margin-bottom: 1rem; 
  color: var(--accent-color);
}

.hero p { 
  font-size: 1.2rem; 
  max-width: 800px; 
  margin: 0 auto 1.5rem; 
  color: var(--text-color);
}

/* --- BOUTONS CTA --- */
.cta-button {
  display: inline-block;
  background: transparent;
  padding: 0.8rem 1.8rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  background: transparent;
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
}

.cta-button:hover { 
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
  border-color: var(--accent-color);
}

.btn-inactive {
  cursor: not-allowed !important;
  pointer-events: auto !important;
}

/* --- CARTES --- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover { 
  transform: translateY(-4px); 
  box-shadow: 0 6px 16px var(--shadow);
}

.card ul { 
  margin-left: 1.5rem; 
  margin-bottom: 1rem; 
}

.card ul li { 
  margin-bottom: 0.5rem; 
}

/* --- SECTIONS & CONTACT --- */
.section { 
  padding: 0rem 1.5rem; 
  background: var(--bg-color); 
}

.section-title { 
  text-align: center; 
  margin-bottom: 1rem; 
  color: var(--accent-color);
}

.contact-section {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 2rem;
  margin-top: 2rem;
  text-align: left;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--border-color);
}

.contact-section h3 {
  text-align: center;
}

/* Styles de formulaire accessibles */
form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-color);
}

form input, 
form select, 
form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-color);
  color: var(--text-color);
  margin-bottom: 0.5rem;
  transition: border-color 0.2s;
}

form input:focus, 
form select:focus, 
form textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--shadow);
}

[data-theme="dark"] form input:focus,
[data-theme="dark"] form select:focus,
[data-theme="dark"] form textarea:focus {
  box-shadow: 0 0 0 3px var(--shadow);
}

/* Messages d'erreur RGAA */
.error-message {
  color: var(--error-color);
  font-weight: bold;
  font-size: 0.9rem;
  display: block;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

/* Messages de succes RGAA */
.success-message {
  color: var(--success-color);
  font-weight: bold;
  font-size: 0.9rem;
  display: block;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

/* --- STYLES DES CHAMPS EN ERREUR --- */

/* Contour rouge sur le champ en erreur */
.input-error {
  border-color: var(--error-color) !important;
}

/* Le petit message d'erreur sous le champ */
.field-error-message {
  display: block;
  color: var(--error-color);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.3s ease-in-out;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error-color);
  background-color: var(--error-color);
}

/* Footer */
footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 3rem 1.5rem;
  margin-top: 0rem;
  text-align: center;
  font-size: 0.9rem;
}

footer p { margin: 0.5rem 0; }
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }

footer a img {
  outline: 2px solid transparent;
}

footer a:focus img {
  outline: var(--focus-outline) !important;
  outline-offset: 2px;
  
}

div[id^="hcaptcha"], .h-captcha, .hcaptcha-container {
    max-width: 100% !important;
    overflow: hidden !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.visually-hidden:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ==========================================================================
   6. ACCESSIBILITÉ & LOGO
   ========================================================================== */

/* Focus visible pour navigation clavier */
:focus {
  outline: var(--focus-outline) !important;
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: var(--focus-outline) !important;
  outline-offset: 2px;
}

/* Lien d'évitement (Skip Link) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
}

.skip-link:focus {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  overflow: visible;
  background: var(--accent-color);
  color: #ffffff;
  padding: 1rem 2rem;
  text-decoration: none;
  font-weight: bold;
  border-radius: 4px;
  box-shadow: 0 4px 12px var(--shadow);
}

/* Logo SVG */
.logo-svg { 
  width: 90px; 
  height: auto; 
  transition: width var(--transition-speed); 
}
.logo-svg g { 
  fill: var(--accent-color); 
  transition: fill var(--transition-speed); 
}


/* ==========================================================================
   7. MENTIONS LÉGALES & ANCRAGE
   ========================================================================== */

/* Correction du masquage par le header (Anchor Offset) */
#cgv-b2b, #cgv-b2c, #mentions-legales, .section, .hero {
  scroll-margin-top: 150px;
}

#cgv-b2b, #cgv-b2c, #mentions-legales {
  background: var(--card-bg);
  border-radius: 8px;
  margin: 2rem auto;
  max-width: 900px;
  box-shadow: 0 4px 12px var(--shadow);
  padding: 2.5rem 2rem;
  border: 1px solid var(--border-color);
  display: none; /* Caché par défaut, géré par JS */
}

#cgv-b2b h2, #cgv-b2c h2, #mentions-legales h2 {
  font-size: 1.8rem;
  margin-bottom: 0rem;
  text-align: center;
  color: var(--accent-color);
}

#cgv-b2b h3, #cgv-b2c h3, #mentions-legales h3,
#cgv-b2b h4, #cgv-b2c h4, #mentions-legales h4,
#cgv-b2b p, #cgv-b2c p, #mentions-legales p,
#cgv-b2b ul, #cgv-b2c ul, #mentions-legales ul {
  text-align: left;
  margin-bottom: 1rem;
}

#cgv-b2b h3, #cgv-b2c h3, #mentions-legales h3 {
  margin-top: 1.5rem;
  color: var(--accent-color);
}

#cgv-b2b ul, #cgv-b2c ul, #mentions-legales ul {
  list-style-type: disc;
  padding-left: 2rem;
  display: block;
}

#cgv-b2b li, #cgv-b2c li, #mentions-legales li {
  margin-bottom: 0.5rem;
}

/* Bouton fermer mentions légales */
#close-cgv-b2b, #close-cgv-b2c, #close-legal {
  margin-top: 2rem;
  width: auto;
  display: inline-block;
}

/* ==========================================================================
   AJOUT : MENU BURGER (Aligné à droite sous le bouton, Max 300px)
   ========================================================================== */

/* 1. Conteneur des actions (Burger + Thème) à droite */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Espace très réduit entre burger et thème */
  z-index: 1002; /* Au-dessus du menu */
  flex-shrink: 0;
  margin-left: auto; /* Pousse le groupe tout à droite */
  position: relative; /* Contexte pour le mobile si besoin */
}

/* 2. Bouton Burger */
.nav-toggle {
  display: flex;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.nav-toggle .bar {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--text-color);
  border-radius: 2px;
  transition: all 0.3s ease-in-out;
}

/* Animation Burger */
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
  background-color: var(--accent-color);
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
  background-color: var(--accent-color);
}

/* 3. Menu Déroulant (Positionné à droite) */
.main-nav {
  position: absolute;
  top: 100%; /* Juste en dessous de la ligne du header */
  right: 1.5rem; /* ALIGNÉ À DROITE (ajustez selon le padding du header) */
  left: auto; /* Annule le left:0 précédent */
  
  width: 300px; /* Largeur fixe demandée */
  max-width: calc(100vw - 3rem); /* Sécurité pour ne pas dépasser sur petits écrans */
  
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-top: none;
  box-shadow: 0 4px 12px var(--shadow);
  border-radius: 0 0 8px 8px;
  
  display: none; /* Caché par défaut */
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.main-nav.active {
  display: flex;
  animation: slideDownRight 0.3s ease-out;
}

.main-nav ul {
  display: flex;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  gap: 0.25rem;
  width: 100%;
}

/* Liens du menu */
.main-nav a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  font-size: 1rem;
  padding: 0.8rem 1.5rem; /* Marges internes pour la lisibilité */
  display: block;
  text-align: left; /* Texte aligné à gauche dans le menu */
  transition: background-color 0.2s, color 0.2s;
  border-left: 3px solid transparent; /* Indicateur de sélection */
}

.main-nav a:hover,
.main-nav a:focus {
  color: var(--accent-color);
  background-color: var(--card-bg);
  border-left-color: var(--accent-color);
  outline: none;
}

/* Conteneur principal */
.lang-toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--card-bg); /* Utilise le fond des cartes pour la cohérence */
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2px 8px;
  margin: 0 8px;
  gap: 6px;
  height: 34px; /* Hauteur suffisante pour le texte */
  transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

/* Éléments individuels (Drapeau + Texte) */
.flag-item {
  display: flex;
  align-items: center;
  gap: 5px; /* Espace entre drapeau et texte */
  text-decoration: none;
  color: var(--text-color); /* Texte lisible dans les 2 modes */
  font-weight: 700;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 2px 6px;
  border-radius: 12px;
  transition: background-color var(--transition-speed) ease, transform 0.2s;
  line-height: 1;
}

/* Accessibilité : Focus visible au clavier (Critère 7.1) */
.flag-item:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Hover uniquement sur le lien cliquable */
.flag-item:not(.active):hover {
  background-color: var(--border-color); /* Fond subtil au survol */
  transform: scale(1.05);
  text-decoration: none;
  color: var(--text-color);
}

/* État Actif (Langue courante) */
.flag-item.active {
  opacity: 0.7; /* Légèrement diminué pour indiquer l'état */
  cursor: default;
  pointer-events: none; /* Non cliquable */
}

/* SVG des drapeaux */
.flag-item svg {
  width: 20px;
  height: 14px;
  display: block;
  border: 1px solid var(--border-color); /* Bordure harmonisée avec le thème */
  border-radius: 2px;
  flex-shrink: 0; /* Empêche le drapeau de s'écraser */
}

/* Séparateur */
.flag-separator {
  color: var(--text-color);
  font-weight: 700;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  opacity: 1;
  font-weight: bold;
  line-height: 1;
}

/* Mode Sombre : Ajustements spécifiques si nécessaire */
[data-theme="dark"] .lang-toggle-container {
  /* Le fond utilise déjà --card-bg (#1e1e1e), c'est parfait */
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

[data-theme="dark"] .flag-item svg {
  /* La bordure du drapeau suit --border-color (#444), très bien */
  opacity: 0.9;
}

/* Mobile */
@media (max-width: 768px) {
  .lang-toggle-container {
    margin: 0 4px;
    padding: 2px 6px;
    height: 30px;
  }
  .flag-item {
    font-size: 12px;
    gap: 4px;
    padding: 2px 4px;
  }
  .flag-item svg {
    width: 18px;
    height: 12px;
  }
  .flag-separator {
    font-size: 10px;
  }
}

/* Animation spécifique (haut vers bas) */
@keyframes slideDownRight {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Ajustement Responsive : Sur très petits écrans, on recule un peu le menu */
@media (max-width: 400px) {
  .main-nav {
    right: 0.5rem;
    width: calc(100vw - 1rem);
  }
}

/* ==========================================================================
   8. RESPONSIVE
   ========================================================================== */
@media (min-width: 768px) {
  .col { flex: 1 1 50%; }
  .hero h1 { font-size: 2.8rem; }
  .hero p { font-size: 1.3rem; }
  .logo-svg { width: 100px; }
}

@media (min-width: 992px) {
  .col { flex: 1 1 33.333%; }
  .hero { padding-top: 8rem; } /* Plus d'espace sur grand écran */
}

@media (max-width: 768px) {
  .col { flex: 1 1 100%; }
  .card { margin-bottom: 0.5rem; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1.1rem; }
  .header-content { padding: 0 1rem; }
  .theme-toggle span { display: none; } /* Cache le texte "Mode sombre" sur mobile, garde l'icône */
  .theme-toggle { padding: 0.5rem; border-radius: 50%; }
  #mentions-legales { padding: 1.5rem 1rem; margin: 1rem; }
  #mentions-legales h2 { font-size: 1.5rem; }
  #mentions-legales, .section, .hero { scroll-margin-top: 1.5rem; }
  .lang-toggle-container {
    margin: 0 4px;
    padding: 2px 6px;
    height: 30px;
  }
  .flag-item {
    font-size: 12px;
    gap: 4px;
    padding: 2px 4px;
  }
  .flag-item svg {
    width: 18px;
    height: 12px;
  }
  .flag-separator {
    font-size: 10px;
  }
}

@media (max-width: 470px) {
  .section { 
    padding: 0.1rem; 
  }
  .container {
    max-width: 100%;
    margin: 0;
    padding: 0.1rem;
  }
}

@media print {
  body { background: #fff !important; color: #000 !important; font-size: 12pt;}
  header, .theme-toggle, .skip-link, .cta-button { display: none !important; }
  a { text-decoration: underline; color: #000; }
  .card, .hero { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  /* Cache le bouton d'impression lors de l'impression */
  button[onclick="window.print()"] {
    display: none !important;
  }
   
  /* Affiche l'URL des liens importants si nécessaire, sinon garde le texte */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    font-style: italic;
  }
  
  /* Évite de couper les titres et les paragraphes en deux pages */
  h3, h4 {
    page-break-after: avoid;
  }
  p, ul, li {
    page-break-inside: avoid;
  }
  
  /* Retire les ombres ou bordures inutiles */
  div, table {
    border: none !important;
    box-shadow: none !important;
  }
}


