/**
 * @file
 * Header component.
 *
 * Logo left, nav center, CTA right.
 * Figma: Header Desktop (516:267).
 */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  border-radius: 0 0 40px 40px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.header.is-scrolled {
  background: var(--color-blue-light);
  border: 1px solid var(--color-blue);
  border-top: none;
}

/* Articles/podcasts/témoignages : fond immédiat sans transition, bordure au scroll */
.header.is-article {
  background: var(--color-blue-light);
  border: none;
  transition: border-color 0.3s ease;
}

.header.is-article.is-scrolled {
  border: 1px solid var(--color-blue);
  border-top: none;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 86px;
  max-width: 1440px;
  margin-inline: auto;
  padding: 16px clamp(16px, 5.5vw, 80px);
  gap: clamp(8px, 1.5vw, 32px);
}

@media (max-width: 768px) {
  .header__inner {
    height: 71px;
    padding: 16px var(--container-padding-mobile);
  }
}

/* Logo */
.header__logo {
  flex-shrink: 0;
  width: 137px;
  height: 39px;
}

.header__logo a {
  display: block;
  text-decoration: none;
}

.header__logo img {
  display: block;
  width: 137px;
  height: 39px;
}

/* Navigation */
.header__nav {
  display: none;
}

@media (min-width: 1024px) {
  .header__nav {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 32px);
  }
}

/* Drupal menu rendered as ul > li > a */
.header__nav ul {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 32px);
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__nav li {
  margin: 0;
  text-align: center;
}

.header__nav a {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.36px;
  line-height: 1.2;
  color: var(--color-blue);
  text-decoration: none;
  text-align: center;
  padding-block: var(--space-xs);
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition-base), color var(--transition-base);
}

.header__nav a:hover,
.header__nav a.is-active,
.header__nav a[aria-current="page"] {
  color: var(--color-blue);
  border-bottom-color: var(--color-blue);
  text-decoration: none;
}

/* CTA button */
.header__cta {
  flex-shrink: 0;
}

.header__cta a {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--color-blue);
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.7px;
  text-align: center;
  padding: 8px 24px 8px 8px;
  border-radius: var(--radius-full);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-base);
}

@media (min-width: 1024px) and (max-width: 1439px) {
  .header__cta a {
    font-size: 12px;
    gap: 10px;
    padding: 6px 16px 6px 6px;
  }
}

.header__cta a:hover {
  background: var(--color-orange);
  text-decoration: none;
}

.header__cta-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Mobile menu toggle */
.header__menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  color: var(--color-blue);
}

.header__menu-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.36px;
  line-height: 1;
  color: var(--color-blue);
  margin-bottom: 2px;
}

@media (min-width: 1024px) {
  .header__menu-toggle {
    display: none;
  }
}

/* Hide CTA on mobile */
@media (max-width: 1023px) {
  .header__cta {
    display: none;
  }
}

/* Mobile nav overlay */
.header__mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  background: var(--color-white);
  padding: 24px 20px 40px;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}

/* Close button top-right of mobile nav */
.header__mobile-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-blue);
}

.header__mobile-nav.is-open {
  display: flex;
}

.header__mobile-nav nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__mobile-nav nav li {
  margin: 0;
}

.header__mobile-nav nav a {
  display: block;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  color: var(--color-black);
  text-decoration: none;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-blue-light);
}

.header__mobile-nav nav a:hover,
.header__mobile-nav nav a.is-active,
.header__mobile-nav nav a[aria-current="page"] {
  color: var(--color-blue);
}

.header__mobile-cta {
  display: block;
  text-align: center;
  margin-top: 32px;
}

@media (max-width: 768px) {
  .header__logo {
    width: 137px;
    height: 39px;
  }
  .header__logo a {
    width: 137px;
    height: 39px;
  }
  .header__logo img {
    width: 137px;
    height: 39px;
  }
}

/* Toggle below overlay — close button is inside overlay now */
.header__menu-toggle {
  position: relative;
  z-index: 100;
}

/* Drupal admin toolbar offset for sticky header */
body.toolbar-fixed .header {
  top: 39px;
}

body.toolbar-fixed.toolbar-tray-open.toolbar-horizontal .header {
  top: 79px;
}
