/* ==========================================================================
   En-tête natif Astrak
   --------------------------------------------------------------------------
   Transposition du template Elementor « Header » (45649). Les valeurs sont
   reprises telles quelles de la CSS qu'Elementor générait, pour que le rendu
   reste identique une fois le plugin retiré.

   Rappel des points de rupture du site : mobile ≤ 767px, tablette ≤ 1024px,
   bureau ≥ 1025px. Le menu bascule en panneau déroulant dès la tablette,
   comme le faisait le widget Elementor.
   ========================================================================== */

.astk-header {
  position: relative;
  z-index: 100;
}

/* Barre externe : large de 1400px, centrée, avec le retrait horizontal. */
.astk-header__bar {
  box-sizing: border-box;
  width: 1400px;
  max-width: min(100%, 1400px);
  margin: 0 auto;
  padding-left: 10px;
  padding-right: 10px;
}

/* Piste interne : limitée à la largeur de contenu du site. */
.astk-header__inner {
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: min(100%, 1140px);
  margin: 0 auto;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Les trois blocs reprennent le modèle de répartition d'Elementor : chacun a une
   largeur de base (le menu prend 100 %, valeur par défaut d'un conteneur), et
   tous se rétractent proportionnellement à cette base. C'est ce qui donne au
   menu la place nécessaire pour tenir sur une seule ligne — un simple
   « flex: 1 1 auto » sur le menu lui en laisserait bien moins. */
.astk-header__brand,
.astk-header__nav,
.astk-header__cta {
  box-sizing: border-box;
  display: flex;
  flex: 0 1 auto;
  min-width: 0;
  padding: 10px;
}

/* --------------------------------------------------------------------------
   Logo
   -------------------------------------------------------------------------- */

.astk-header__brand {
  width: 15%;
}

.astk-header__logo-link {
  display: block;
  max-width: 100%;
}

.astk-header__logo {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.astk-header__sitename {
  font-family: var(--astrak-font-titre);
  font-weight: 700;
  color: var(--astrak-texte);
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.astk-header__nav {
  align-items: center;
  width: 100%;
  position: relative;
}

.astk-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.astk-menu > li {
  display: flex;
}

.astk-menu li {
  position: relative;
  margin: 0;
  list-style: none;
}

/* « white-space: nowrap » reproduit le comportement d'Elementor : un intitulé
   comme « Success Stories » ne se coupe jamais en deux lignes. */
.astk-menu a {
  display: flex;
  align-items: center;
  flex-grow: 1;
  white-space: nowrap;
  padding: 13px 20px;
  font-family: var(--astrak-font-titre);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2em;
  color: #4a5567;
  fill: #4a5567;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

/* Sous-menus : masqués jusqu'au survol ou au focus clavier. */
.astk-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  display: block;
  min-width: 240px;
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: #fff;
  border-radius: 20px;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.29);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.astk-menu > li:hover > .sub-menu,
.astk-menu > li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.astk-menu .sub-menu a {
  padding: 15px;
  border-radius: 0;
}

.astk-menu .sub-menu li:first-child a {
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.astk-menu .sub-menu li:last-child a {
  border-bottom-right-radius: 20px;
  border-bottom-left-radius: 20px;
}

.astk-menu .sub-menu a:hover,
.astk-menu .sub-menu a:focus {
  background-color: var(--astrak-texte);
  color: #fff;
}

/* Bouton d'ouverture : présent uniquement sous 1025px.
   Fond et arrondi repris du bouton d'Elementor (.elementor-menu-toggle). */
.astk-header__toggle {
  display: none;
  width: 34px;
  height: 34px;
  margin: 0 auto;
  padding: 0;
  background-color: rgba(0, 0, 0, 0.05);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.astk-header__toggle-bar,
.astk-header__toggle-bar::before,
.astk-header__toggle-bar::after {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--astrak-texte);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.astk-header__toggle-bar {
  position: relative;
  margin: 0 auto;
}

.astk-header__toggle-bar::before,
.astk-header__toggle-bar::after {
  position: absolute;
  left: 0;
  content: "";
}

.astk-header__toggle-bar::before {
  top: -7px;
}

.astk-header__toggle-bar::after {
  top: 7px;
}

.astk-header__toggle[aria-expanded="true"] .astk-header__toggle-bar {
  background-color: transparent;
}

.astk-header__toggle[aria-expanded="true"] .astk-header__toggle-bar::before {
  top: 0;
  transform: rotate(45deg);
}

.astk-header__toggle[aria-expanded="true"] .astk-header__toggle-bar::after {
  top: 0;
  transform: rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Bouton de prise de rendez-vous
   -------------------------------------------------------------------------- */

.astk-header__cta {
  width: 40%;
  align-items: flex-end;
  justify-content: flex-end;
}

/* Fond, taille et graisse repris du style global des boutons Elementor
   (couleur « Accentué » du kit) ; la police et la graisse sont ensuite
   surchargées par le réglage propre à l'en-tête. */
.astk-btn {
  display: inline-block;
  min-height: 40px;
  padding: 12px 24px;
  background-color: var(--astrak-accent);
  color: var(--astrak-texte);
  fill: var(--astrak-texte);
  font-family: var(--astrak-font-titre);
  font-size: var(--astrak-accent-size);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  transition: all 0.3s;
}

.astk-btn:hover,
.astk-btn:focus {
  color: var(--astrak-texte);
}

/* ==========================================================================
   Tablette — le menu passe en panneau déroulant
   ========================================================================== */

@media (max-width: 1024px) {
  /* Pas de retour à la ligne à ce palier : Elementor ne l'active qu'en mobile
     (--flex-wrap-mobile). Les trois blocs se rétractent, ils ne s'empilent pas. */
  .astk-header__inner {
    max-width: min(100%, 1024px);
  }

  .astk-header__brand {
    width: 20%;
  }

  .astk-header__nav {
    width: 10%;
    order: 99999;
    z-index: 99;
  }

  .astk-header__cta {
    width: 100%;
    align-items: center;
    justify-content: center;
  }

  .astk-header__toggle {
    display: block;
  }

  /* Le menu devient un panneau, replié par défaut. */
  .astk-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    display: none;
    flex-direction: column;
    align-items: stretch;
    min-width: 375px;
    max-width: calc(100vw - 30px);
    padding: 0;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.29);
    overflow: hidden;
  }

  .astk-menu.is-open {
    display: flex;
  }

  /* En panneau, chaque entrée empile son lien puis son sous-menu : le
     « display: flex » utile à l'alignement horizontal doit passer en colonne. */
  .astk-menu > li {
    flex-direction: column;
    align-items: stretch;
  }

  /* Niveau 1 : fond blanc, une fine séparation entre les entrées. */
  .astk-menu > li + li {
    border-top: 1px solid rgba(15, 15, 61, 0.08);
  }

  .astk-menu > li > a {
    font-weight: 600;
    color: var(--astrak-texte);
  }

  /* En panneau, les sous-menus se déplient dans le flux. Le niveau 2 est
     nettement distingué du niveau 1 : fond plus soutenu, retrait, et un filet
     de couleur accent sur le bord pour marquer la hiérarchie. */
  .astk-menu .sub-menu {
    position: static;
    display: none;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    border-radius: 0;
    box-shadow: none;
    background-color: #eceef4;
    box-shadow: inset 3px 0 0 0 var(--astrak-accent);
  }

  .astk-menu .sub-menu a {
    padding-left: 34px;
    font-weight: 400;
    color: #4a5567;
  }

  .astk-menu .sub-menu li + li a {
    border-top: 1px solid rgba(15, 15, 61, 0.06);
  }

  /* Chevron d'ouverture sur les entrées à sous-menu. */
  .astk-menu > li.menu-item-has-children > a::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.2s ease;
  }

  .astk-menu > li.menu-item-has-children.is-open > a::after {
    transform: rotate(-135deg) translate(-2px, -2px);
  }

  .astk-menu li.is-open > .sub-menu {
    display: block;
  }

  .astk-menu > li:hover > .sub-menu,
  .astk-menu > li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .astk-menu .sub-menu li:first-child a,
  .astk-menu .sub-menu li:last-child a {
    border-radius: 0;
  }
}

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 767px) {
  .astk-header__inner {
    max-width: min(100%, 767px);
    justify-content: space-between;
  }

  .astk-header__brand {
    width: 70%;
    order: -99999;
  }

  .astk-header__nav {
    width: 20%;
    order: -99999;
  }

  /* Le bouton était masqué sur mobile dans le template Elementor. */
  .astk-header__cta {
    display: none;
  }

  .astk-menu {
    min-width: 315px;
  }
}
