/* --- HEADER & NAV --- */
header {
  position: sticky;
  top: 0;
  z-index: 10000;
  background-color: var(--bg-glass-header); 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass-header);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 70px; /* Hauteur fixe pour caler le menu mobile */
}

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

.logo img {
  height: 40px;
  width: auto;
  display: block;
  filter: var(--logo-filter, none);
  transition: filter 0.3s ease;
}

[data-theme="dark"] .logo img {
  filter: invert(1) hue-rotate(180deg);
}

/* Navigation Desktop */
.header-nav {
  display: flex;
  gap: 32px;
}

.header-nav a {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s ease;
  text-decoration: none;
  padding: 8px 0;
}

.header-nav a:hover {
  color: var(--text-main);
}

/* Focus pour l'accessibilité */
.header-nav a:focus-visible,
.footer-links a:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

.header-mobile { display: none; }

/* Bouton Burger */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: var(--text-main);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* --- MOBILE MENU (Correction avec Variables) --- */
.mobile-nav {
    position: fixed;
    top: 70px; /* Doit être égal à la hauteur de .header-inner */
    left: 0;
    right: 0;
    bottom: 0;
    
    height: calc(100vh - 70px);
    width: 100%;
    
    /* Utilisation de la variable système pour le fond */
    background-color: var(--bg-card); 
    z-index: 9999; 
    
    display: flex;
    flex-direction: column;
    padding: 0;
    
    /* Utilisation de la variable système pour la bordure */
    border-top: 1px solid var(--border);
    
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-nav.active {
    transform: translateX(0);
    /* Utilisation de l'ombre système (un peu renforcée pour le menu) */
    box-shadow: -5px 0 15px rgba(var(--black-rgb), 0.1);
}

/* Liens du menu mobile */
.mobile-nav a {
  padding: 20px;
  /* Bordure système */
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 18px;
  /* Texte système */
  color: var(--text-main);
  text-decoration: none;
}

.mobile-nav a:active {
    /* Feedback visuel au toucher sur mobile */
    background-color: var(--gray-50);
}

/* --- SECTIONS & GRID --- */
section { padding: clamp(40px, 5vw, 72px) 0; }

.section-header { 
  text-align: center; 
  margin-bottom: clamp(32px, 5vw, 48px); 
  max-width: 800px; 
  margin-left: auto; 
  margin-right: auto; 
}

.section-title { 
  font-size: clamp(24px, 4vw, 36px); 
  line-height: 1.2; 
  font-weight: 700; 
  margin-bottom: 16px; 
  color: var(--text-main); 
}

.section-subtitle { 
  font-size: clamp(18px, 3vw, 20px); 
  font-weight: 600; 
  margin-bottom: 12px; 
  color: var(--text-main); 
}

.section-lead { 
  font-size: clamp(16px, 2vw, 18px); 
  color: var(--text-muted); 
  max-width: 680px; 
  margin: 0 auto; 
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 2rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1.5rem; }

/* --- FOOTER --- */
.footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: clamp(40px, 8vw, 80px);
  font-size: 13px;
  color: var(--text-muted);
}

.footer-content { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 20px; 
  text-align: center; 
}

.footer-links { 
  display: flex; 
  gap: 24px; 
  flex-wrap: wrap; 
  justify-content: center; 
}

.footer-links a { 
  font-size: 14px; 
  color: var(--text-muted); 
  transition: color 0.2s; 
  text-decoration: none; 
}

.footer-links a:hover { 
  color: var(--primary); 
  text-decoration: underline; 
}

.footer-copyright { 
  color: var(--text-muted); 
  font-size: 14px; 
}

/* --- MEDIA QUERIES --- */
@media (min-width: 769px) {
  .footer-content { flex-direction: row; justify-content: space-between; text-align: left; }
  .mobile-nav { display: none !important; }
}

@media (max-width: 768px) {
  .header-nav { display: none; }
  .header-mobile { display: block; }
  .menu-toggle { display: flex; }
  .header-inner { height: 70px; } /* On garde la même hauteur pour éviter les sauts */
  .mobile-nav { top: 70px; height: calc(100vh - 70px); }
}

/* --- PREMIUM LANGUAGE SWITCHER --- */
.lang-switcher-container {
    position: relative;
    user-select: none;
    z-index: 1001;
}

.lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md); /* Bords arrondis de 8px pour un rendu rectangulaire élégant */
    font-size: 13px;
    font-weight: 600;
    color: var(--primary); /* Couleur violette de la charte graphique */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.lang-trigger:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
    transform: translateY(-0.5px);
}

.lang-trigger .arrow {
    font-size: 9px;
    transition: transform 0.25s ease;
    color: var(--primary); /* Assorti au texte */
}

.lang-switcher-container.active .lang-trigger .arrow {
    transform: rotate(180deg);
}

/* Menu déroulant (dropdown) - Thème clair persistant (fond blanc cassé/blanc) */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 140px;
    background: #ffffff; /* Fond blanc persistant */
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--radius-md); /* Correspond à l'arrondi du bouton lang-trigger */
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08); /* Ombre portée très légère effet "carte flottante" */
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1002;
    
    /* Animation asynchrone cache/visible */
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Conserve le fond blanc du dropdown même dans le thème sombre général pour ce sélecteur spécifique */
[data-theme="dark"] .lang-dropdown {
    background: #ffffff; 
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.lang-switcher-container.active .lang-dropdown {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Options à l'intérieur du menu déroulant (alignement horizontal parfait) */
.lang-option {
    display: flex;
    align-items: center;
    gap: 8px; /* Espacement horizontal optimal de 8px */
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary); /* Couleur violette/indigo de la charte graphique */
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

/* Assure la lisibilité sur fond blanc constant */
[data-theme="dark"] .lang-option {
    color: var(--primary);
}

.lang-option:hover {
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary-hover);
}

.lang-option.selected {
    background: rgba(124, 58, 237, 0.05);
    color: var(--primary-hover);
    font-weight: 600;
}

/* Mobile selector styling */
.lang-selector-mobile {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lang-selector-mobile span {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-main);
}

.lang-mobile-buttons {
    display: flex;
    gap: 8px;
}

.lang-mobile-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.lang-mobile-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}