/* ============================================
   OPTIMISATIONS MOBILE - Score PageSpeed 95+
   ============================================ */

/* Fix viewport height iOS */
:root {
  --vh: 1vh;
}

@supports (-webkit-touch-callout: none) {
  :root {
    --vh: calc(var(--vh, 1vh) * 100);
  }
}

/* Optimiser images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.logo-image {
  width: auto;
  height: 60px;
  max-width: 100%;
  aspect-ratio: 3/1;
}

/* Menu hamburger amélioré */
@media (max-width: 768px) {
  /* Bouton hamburger - FORCER L'AFFICHAGE */
  .mobile-menu-toggle {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    position: relative;
    order: 2;
  }
  
  /* S'assurer que le header content est en flex */
  .header-content {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
  
  /* Logo à gauche */
  .logo {
    order: 1;
    flex-shrink: 0;
  }
  
  /* Menu à droite */
  .main-nav {
    order: 3;
    position: static;
  }
  
  /* CTA caché sur très petit écran ou sous menu */
  .header-cta {
    order: 4;
    display: none;
  }
  
  .mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background-color: var(--gray-700);
    transition: all 0.3s ease;
    display: block;
  }
  
  /* Animation hamburger quand actif */
  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
  
  /* Navigation mobile - CACHÉE PAR DÉFAUT */
  .main-nav .nav-list,
  .nav-list {
    display: none !important;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column !important;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    margin: 0;
  }
  
  /* Navigation active - MONTRER LE MENU */
  .main-nav.active .nav-list {
    display: flex !important;
    animation: slideDown 0.3s ease-out;
  }
  
  @keyframes slideDown {
    from {
      transform: translateY(-20px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  /* Items du menu mobile */
  .main-nav .nav-list li {
    margin: 0 !important;
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
    list-style: none;
  }
  
  .main-nav .nav-list li:last-child {
    border-bottom: none;
  }
  
  .main-nav .nav-list a {
    display: block;
    padding: 0.75rem;
    font-size: 1.125rem;
    color: #161616;
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
  }
  
  .main-nav .nav-list a:hover,
  .main-nav .nav-list a:focus {
    color: #000091;
    background-color: #f6f6f6;
    border-radius: 4px;
  }
  
  /* Cacher dropdown sur mobile */
  .nav-dropdown {
    display: none !important;
  }
  
  /* Overlay dark quand menu ouvert */
  body.menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease;
  }
  
  /* Empêcher scroll quand menu ouvert */
  body.menu-open {
    overflow: hidden;
  }
}

/* Animation fade in */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Optimisations performance mobile */
@media (max-width: 768px) {
  /* Performance optimisée sans casser les animations */
  
  /* Optimiser espacements */
  .container {
    padding: 0 var(--spacing-md);
  }
  
  /* Texte plus lisible */
  body {
    font-size: 16px;
    line-height: 1.6;
  }
  
  /* Boutons tactiles plus grands */
  button,
  .btn,
  a {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Forms optimisés */
  input,
  select,
  textarea {
    font-size: 16px; /* Évite zoom iOS */
    padding: var(--spacing-md);
  }
  
  /* Header sticky optimisé */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
}

/* Optimisations très petits écrans */
@media (max-width: 480px) {
  .logo-image {
    height: 50px;
  }
  
  h1 {
    font-size: var(--font-size-2xl);
  }
  
  h2 {
    font-size: var(--font-size-xl);
  }
  
  .hero-section {
    padding: var(--spacing-xl) 0;
  }
}

/* Performance: Réduire peinture */
.main-nav .nav-list {
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Smooth scroll pour iOS */
.main-nav .nav-list {
  -webkit-overflow-scrolling: touch;
}

/* Pas de sélection texte menu */
.mobile-menu-toggle,
.main-nav .nav-list {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}
