html,
body {
  max-width: 100%;
  overflow-x: hidden !important;
}

/* Sécurité anti-débordement */
header,
header * {
  box-sizing: border-box;
}

/* TABLETTE + MOBILE */
@media (max-width: 1024px) {

  header {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: clip !important;
  }

  header .wp-block-group {
    max-width: 100% !important;
  }

  /* Ligne principale du header */
  header .wp-block-group.is-layout-flex,
  header .wp-block-group.wp-block-group-is-layout-flex {
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 14px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Titre */
  header .wp-block-site-title,
  header .wp-block-site-title a {
    font-size: 20px !important;
    line-height: 1 !important;
    white-space: nowrap !important; /* ✅ UNE SEULE LIGNE */
    max-width: none !important;
    flex-shrink: 0 !important;
  }

  /* Navigation */
  header .wp-block-navigation {
    flex-shrink: 0 !important;
    min-width: auto !important;
  }

  /* Boutons */
  header .wp-block-buttons {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    width: 140px !important;
    max-width: 140px !important;
  }

  header .wp-block-button {
    width: 100% !important;
    max-width: 100% !important;
  }

  header .wp-block-button__link {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 10px 10px !important;
    font-size: 13px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    text-align: center !important;
    border-radius: 14px !important;
  }
}

/* MOBILE */
@media (max-width: 767px) {

  header {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Autorise le retour à la ligne */
  header .wp-block-group.is-layout-flex,
  header .wp-block-group.wp-block-group-is-layout-flex {
    flex-wrap: wrap !important;
    row-gap: 14px !important;
    gap: 10px !important;
  }

  /* Logo */
  header .wp-block-site-title,
  header .wp-block-site-title a {
    font-size: 18px !important;
    white-space: nowrap !important; /* ✅ UNE SEULE LIGNE */
    max-width: none !important;
  }

  /* Boutons */
  header .wp-block-buttons {
    width: 138px !important;
    max-width: 138px !important;
  }

  header .wp-block-button__link {
    font-size: 12.5px !important;
    padding: 10px 8px !important;
    border-radius: 12px !important;
  }

  /* SE CONNECTER */
  header .header-login,
  header .header-login a {
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  header .header-login {
    order: 99 !important;
    margin-top: -6px !important;
    padding-right: 4px !important;
  }
}

/* TRÈS PETIT MOBILE */
@media (max-width: 390px) {

  header .wp-block-site-title,
  header .wp-block-site-title a {
    font-size: 16px !important;
    white-space: nowrap !important;
    max-width: none !important;
  }

  header .wp-block-buttons {
    width: 128px !important;
    max-width: 128px !important;
  }

  header .wp-block-button__link {
    font-size: 12px !important;
    padding: 9px 7px !important;
  }
}