/* ============================================================
   HEADER
   css/components/header.css
   ============================================================ */


/* ── BARRE SUPÉRIEURE ──────────────────────────────────────── */

.header-top {
  background: var(--palette-gray-50);
  border-bottom: 1px solid var(--clr-border-default);
}

.header-top .container {
  min-height: 36px;
}

.header-top .region-header-top {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Réseaux sociaux – côté gauche */

.social-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;

}

.social-links__item {
  display: flex;
}

.social-links__item:not(:last-child) {
  border-right: 1px solid var(--palette-white);
}

.social-links__link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  color: var(--palette-gray-600);
  font-size: var(--fs-base);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition-base);

}

.social-links__link:hover {
  color: var(--palette-gray-950);
}



/* Zone droite : header-link + langue – poussé à droite */
.header-top__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
}

/* Recherche */
.header-link  {
  list-style: none;
  margin: 0;
  padding: var(--space-3);
  display: flex;
  align-items: center;
  border-right: 1px solid var(--palette-white);
}

.header-link__item {
  display: flex;
}

.header-link__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--palette-gray-600);
  font-size: var(--fs-sm);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color var(--transition-base);
}

.header-link__link:hover {
  color: var(--palette-gray-950);
}

.header-link__link i {
  font-size: var(--fs-sm);
  padding-right: var(--space-2)
}

/* ── SÉLECTEUR DE LANGUE (dropdown moderne) ─────────────────── */

.lang-switcher {
  position: relative;
}

/* Bouton toggle */
.lang-switcher__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  padding: var(--space-1) var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--palette-gray-900);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-base);
}

.lang-switcher__toggle:hover {
  color: var(--palette-gray-500);
}

.lang-switcher__arrow {
  font-size: var(--fs-xs);
  color: var(--palette-gray-500);
  transition: transform var(--transition-base);
}

/* Dropdown fermé par défaut */
.lang-switcher__dropdown {
  display: none;
  opacity:0;
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  min-width: 130px;
  background: var(--palette-white);
  border: 1px solid var(--clr-border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 100;
  overflow: hidden;
  transition: opacity var(--transition-base);
}

/* Ouvert via JS (classe .is-open) */
.lang-switcher.is-open .lang-switcher__dropdown {
  display: block;
  opacity:1;
}

.lang-switcher.is-open .lang-switcher__arrow {
  transform: rotate(180deg);
}

.lang-switcher.is-open .lang-switcher__toggle {
  background: var(--palette-gray-100);
}

/* Liste de langues Drupal */
.lang-switcher__dropdown .links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lang-switcher__dropdown .links li a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  color: var(--palette-gray-700);
  text-decoration: none;
  transition: background var(--transition-base), color var(--transition-base);
}

.lang-switcher__dropdown .links li a:hover {
  background: var(--palette-gray-50);
  color: var(--clr-primary);
}

.lang-switcher__dropdown .links li a.is-active {
  font-weight: var(--fw-semibold);
  color: var(--clr-primary);
}


/* ── HEADER PRINCIPAL ──────────────────────────────────────── */

.site-header {
  background: var(--palette-white);
}

/* Zone branding (logo) */
.site-header__branding {
  padding: var(--space-4) 0;
    display: flex;
  align-items: center;
}


/* Logo */
.site-logo img {
  display: block;
  height: auto;
}

/* Nom du site (fallback si pas de logo SVG) */
.site-name {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
}

.site-name a {
  color: var(--clr-primary);
  text-decoration: none;
}

/* Slogan */
.site-slogan {
  font-size: var(--fs-sm);
  color: var(--palette-gray-600);
  margin-top: var(--space-1);
}


/* ── NAVIGATION PRINCIPALE ─────────────────────────────────── */


.site-header__nav .container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Bloc nav Drupal */
.site-header__nav nav {
  display: flex;
  align-items: center;
}

/* Liste de menu */
.site-header__nav .menu {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Éléments */
.site-header__nav .menu__item {
  position: relative;
  display: flex;
  gap: var(--space-5);

}

/* Liens */
.site-header__nav .menu__link {
  display: block;
  padding: var(--space-1) 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--palette-gray-600);
  text-decoration: none;
  transition: border-color var(--transition-base);
  white-space: nowrap;
  border-bottom: 4px solid var(--palette-white);

}


.site-header__nav .menu__link:hover,
.site-header__nav .menu__link--active-trail {
  border-bottom: 4px solid var(--clr-accent);
}

/* Lien actif */
.site-header__nav .menu__item--active-trail > .menu__link {
  border-bottom: 4px solid var(--clr-accent);
}

/* ── H2 du bloc nav (masqué visuellement) ─────────────────── */
.site-header__nav h2.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* ── HAMBURGER BUTTON ──────────────────────────────────────── */

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-base);
}

.nav-hamburger:hover {
  background: none;
}

.nav-hamburger__bar {
  display: block;
  width: 26px;
  height: 3px;
  background: var(--palette-gray-900);
  border-radius: 2px;
  transition: transform var(--transition-base), opacity var(--transition-base);
  transform-origin: center;
}

/* État ouvert – croix */
.nav-hamburger[aria-expanded="true"] .nav-hamburger__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] .nav-hamburger__bar:nth-child(2) {
  opacity: 0;
}
.nav-hamburger[aria-expanded="true"] .nav-hamburger__bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}


/* ── PANEL MOBILE ──────────────────────────────────────────── */

/* Desktop : panel toujours visible, pas de style particulier */
.nav-mobile-panel {
  display: contents;
}


/* ── RESPONSIVE ────────────────────────────────────────────── */

@media (max-width: 767px) {
  .header-top__social {
    display: none;
  }

  /* Affiche le bouton hamburger */
  .nav-hamburger {
    display: flex;
  }

  /* Cache le menu par défaut sur mobile */
  .nav-mobile-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    border-top: none;
    box-shadow: var(--shadow-md);
    z-index: 200;
    padding: 0;
  }

  /* Menu ouvert */
  .nav-mobile-panel.is-open {
    display: block;
  }

  /* Liens en colonne */
  .site-header__nav .menu {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
  }

  .site-header__nav .menu__item {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .site-header__nav .menu__item:last-child {
    border-bottom: none;
  }

  .site-header__nav .menu__link {
    width: 100%;
    padding: var(--space-3) var(--space-6);
    font-size: var(--fs-sm);
    white-space: normal;
    text-align: left;
    border-bottom: none;
    color: var(--palette-white);
  }

  .site-header__nav .menu__link:hover,
  .site-header__nav .menu__link--active-trail {
    border-bottom: none;
    background: var(--nav-link-hover);
    color: var(--palette-white);
  }

  .site-header__nav .menu__item--active-trail > .menu__link {
    border-bottom: none;
    background: var(--nav-link-hover);
    color: var(--palette-white);
  }

  /* Contextual-region sur <nav> ajoute position:relative (Drupal core).
     On étire la chaîne container → region → nav à 100% pour que
     left:0/right:0 du panel couvre toute la largeur. */
  .site-header__nav .container,
  .site-header__nav .region-primary-menu,
  .site-header__nav nav {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
}
