/* ===== IMPORT GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* ===== VARIABLES CSS ===== */
:root {
  /* Couleurs principales */
  --primary-color: #6f64db;
  --primary-hover: #5a52c7;
  --text-primary: #000000;
  --text-secondary: #333333;
  --background: #ffffff;
  --surface: #f9fafb;
  --border: #e5e7eb;
  --shadow: rgba(0, 0, 0, 0.1);
  --active-bg: #f3e8ff;
  
  /* Espacements */
  --header-height: 80px;
  --header-height-mobile: 64px;
  --container-padding: 1.5rem;
  --nav-gap: 32px;
  --nav-cta-gap: 28px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-smooth: 200ms ease;
  
  /* Bordures */
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --border-radius-cta: 10px;
}

/* ===== SKIP LINK ===== */
/* Invisible hors focus, sans liseré, et impossible à cliquer à la souris */
.skip-link {
  position: absolute;
  left: -9999px;   /* met le lien hors de l'écran */
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;   /* évite tout clic souris quand il est caché */
  z-index: 9999;
}

/* S'affiche uniquement quand on navigue au clavier (Tab) */
.skip-link:focus {
  left: 6px;
  top: 6px;
  width: auto;
  height: auto;
  overflow: visible;
  pointer-events: auto;   /* cliquable uniquement quand visible au focus */
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  transition: none;       /* évite l'animation qui pouvait créer un liseré */
}

/* ===== HEADER PRINCIPAL ===== */
.header,
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--background);
  border-bottom: 1px solid rgba(229, 231, 235, 0.7);
  z-index: 1000;
  transition: box-shadow var(--transition-smooth), backdrop-filter var(--transition-smooth);
}

.header.is-scrolled {
  box-shadow: 0 4px 20px var(--shadow), 0 1px 3px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

/* Désactiver le backdrop-filter sur mobile pour éviter l'effet de flou */
@media (max-width: 768px) {
  .header.is-scrolled {
    backdrop-filter: none;
    background: rgba(255, 255, 255, 1);
  }
}

.header__container,
.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
  width: 100%;
  gap: 2rem;
}

/* Layout pour desktop: logo - navigation centrée - CTA */
@media (min-width: 769px) {
  .header__container,
  .header-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    gap: 2rem;
  }
  
  .header__logo,
  .logo {
    justify-self: start;
  }
  
  .header__nav,
  .nav-menu {
    justify-self: center;
  }
  
  .header__cta,
  .header-cta {
    justify-self: end;
  }
}

/* Mobile header height */
@media (max-width: 768px) {
  .header {
    height: var(--header-height-mobile);
  }
}

/* ===== LOGO ===== */
.header__logo,
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header__logo-link,
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-fast);
}

.header__logo-img,
.logo-img,
.independent-header__logo-img {
  display: block;
  height: 60px;
  width: auto;
  transition: transform var(--transition-fast);
  /* Éliminer tous les contours et effets indésirables */
  border: none;
  outline: none;
  box-shadow: none;
  filter: none;
  -webkit-filter: none;
  background: transparent;
  /* Propriétés de rendu précis pour Safari */
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
  image-rendering: -webkit-optimize-contrast;
  /* Assurer un rendu propre sur tous les navigateurs */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  pointer-events: none;
}

.header__logo-link:hover {
  transform: translateY(-1px);
}

.header__logo-link:hover .header__logo-img {
  transform: scale(1.05);
}

/* Taille du logo sur mobile */
@media (max-width: 768px) {
    .header__logo-img,
    .independent-header__logo-img {
        height: 80px !important;
        width: auto !important;
        max-width: none !important;
        margin-left: -8px;
        border: 2px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border-radius: 10px;
        filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Styles supplémentaires pour mobile très petit */
@media (max-width: 480px) {
    .header__logo-img,
    .independent-header__logo-img {
        height: 80px !important;
        width: auto !important;
        max-width: none !important;
        margin-left: -8px;
        border: 2px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border-radius: 10px;
        filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== NAVIGATION CENTRÉE ===== */
.header__nav,
.nav-menu {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--nav-gap);
  margin-left: -40px; /* Décale la navigation vers la gauche */
}

.nav-menu a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  padding: 8px 6px;
  position: relative;
  transition: all var(--transition-fast);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  border-radius: 6px;
}

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width var(--transition-fast);
}

.nav-menu a:hover {
  color: var(--primary-color);
  transition: color var(--transition-fast);
}

.nav-menu a:hover::after {
  width: calc(100% - 12px);
}

/* ===== NAVIGATION ET CTA GROUPÉS (pour mobile) ===== */
.header__nav-cta-group {
  display: none;
}

.header__nav-mobile {
  display: flex;
  align-items: center;
  width: 100%;
}

.header__cta-mobile {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
}
.header__nav-list {
  display: flex;
  align-items: center;
  gap: var(--nav-gap);
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__nav-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  padding: 8px 6px;
  position: relative;
  transition: all var(--transition-fast);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  border-radius: 6px;
}

.header__nav-link::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width var(--transition-fast);
}

.header__nav-link:hover {
  color: var(--primary-color);
  transition: color var(--transition-fast);
}

.header__nav-link:hover::after {
  width: calc(100% - 12px);
}

.header__nav-link:focus {
  outline: none !important;
}

.header__nav-link:active {
  outline: none !important;
}

.header__nav-link:focus-visible {
  outline: none !important;
}

/* Suppression complète de tous les outlines sur les liens de navigation */
.header__nav-link,
.header__nav-link:hover,
.header__nav-link:focus,
.header__nav-link:active,
.header__nav-link:visited {
  outline: none !important;
  box-shadow: none !important;
}

.header__nav-link[aria-current="page"] {
  color: var(--primary-color);
}

.header__nav-link[aria-current="page"]::after {
  width: calc(100% - 12px);
  background: var(--primary-color);
}

/* ===== CTA ===== */
.header__cta,
.header-cta {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header__cta-button {
  padding: 12px 20px;
  background: var(--brand-purple);       /* remplace le dégradé par le violet #7c6cd6 */
  background-image: none;                /* coupe toute image de fond/gradient résiduelle */
  color: #fff;
  text-decoration: none;
  border-radius: var(--border-radius-cta);
  font-weight: 600;
  font-size: 15px;
  transition: all var(--transition-smooth);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(111, 100, 219, 0.25), 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-left: var(--nav-cta-gap);
}

.header__cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s ease;
}

.header__cta-button:hover::before {
  left: 100%;
}

.header__cta-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, rgba(255, 255, 255, 0.1) 100%);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.header__cta-button:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 6px 20px rgba(111, 100, 219, 0.25), 0 2px 8px rgba(124, 58, 237, 0.2);
}

.header__cta-button:focus {
  outline: none !important;
}

.header__cta-button:active {
  outline: none !important;
}

.header__cta-button:focus-visible {
  outline: none !important;
}

/* Suppression complète de tous les outlines sur le bouton CTA */
.header__cta-button,
.header__cta-button:hover,
.header__cta-button:focus,
.header__cta-button:active,
.header__cta-button:visited {
  outline: none !important;
  /* suppression de la ligne suivante pour laisser l'ombre s'afficher au hover
     box-shadow: none !important; */
}

.header__cta-button:hover::after {
  opacity: 1;
}

/* ===== MENU BURGER ===== */
.header__burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.header__burger-line {
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition-fast);
  transform-origin: center;
}

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(2) {
  opacity: 0;
}

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .header__nav {
    display: none;
  }

  .header__cta {
    display: none;
  }

  .header__nav-cta-group {
    display: flex;
    position: fixed;
    top: var(--header-height-mobile);
    left: 0;
    right: 0;
    background: var(--background);
    border-top: 1px solid rgba(229, 231, 235, 0.7);
    padding: 2rem var(--container-padding);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    box-shadow: 0 4px 20px var(--shadow);
    flex-direction: column;
    gap: 2rem;
  }

  .header__nav-cta-group.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .header__nav-mobile {
    width: 100%;
  }

  .header__nav-list {
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
  }

  .header__nav-link {
    font-size: 1.1rem;
    padding: 8px 6px;
  }

  .header__cta-mobile {
    width: 100%;
  }

  .header__cta-mobile .header__cta-button {
    width: 100%;
    text-align: center;
    justify-content: center;
    margin-left: 0;
  }

  .header__burger {
    display: flex;
  }

  .header__container {
    padding: 0 1rem;
  }
}

@media (max-width: 768px) {
  .header__container {
    padding: 0 1rem;
  }
  
  .header__nav-cta-group {
    top: var(--header-height-mobile);
  }
}

@media (max-width: 480px) {
  .header__container {
    padding: 0 0.75rem;
  }
}

/* Règle spécifique pour améliorer le rendu du logo header.png sur Safari */
img[src*="header.png"] {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -webkit-transform: translateZ(0); /* Hack Safari pour réduire le flou */
}
