/* =========================================================
   MB Accordion – cartes dépliables (Elementor)
   Couleurs : bordeaux #670000 / crème / doré
   ========================================================= */

:root {
  --mb-acc-primary: #670000;
  --mb-acc-bg: rgba(250, 244, 234, 0.92);
  --mb-acc-bg-panel: #faf4ea;   /* fond OPAQUE du panneau déplié (desktop) */
  --mb-acc-border: #d9c69b;
  --mb-acc-radius: 14px;
  --mb-acc-text: #3a3a3a;
  --mb-acc-speed: 0.35s;
  --mb-acc-max-h: none;         /* mobile : pas de limite, le contenu s'insère dans la page */
  --mb-acc-scroll-offset: 0px;  /* mobile : hauteur de ton header fixe, ex. 70px */
}

.e-con.e-grid.mb-acc-group,
.mb-acc-group.e-grid {
  grid-template-rows: none !important;
  grid-auto-rows: auto !important;
  align-items: start !important;
  align-content: start !important;
}

.mb-acc__head {
  touch-action: manipulation;   /* supprime le délai de double-tap sur mobile */
}

/* Si des éléments DANS le contenu ont une animation d'entrée Elementor,
   ils resteraient invisibles (carte "vide") tant que le waypoint ne se déclenche pas */
.mb-acc__body .elementor-invisible {
  visibility: visible !important;
}

.e-n-accordion > .e-n-accordion-item > .e-n-accordion-item-title {
      justify-content: space-between!important;
}

/* ---------- Grille parent ---------- */
.mb-acc-group {
  align-items: start;          /* une carte ouverte ne "tire" pas ses voisines */
  align-content: start;
}

/* ---------- Carte ---------- */
.mb-acc {
  position: relative;
  background: var(--mb-acc-bg);
  border: 1px solid var(--mb-acc-border);
  border-radius: var(--mb-acc-radius);
  overflow: hidden;
  padding: 0 !important;
  box-shadow: 0 2px 10px rgba(60, 30, 0, 0.06);
  transition: box-shadow var(--mb-acc-speed) ease, border-radius var(--mb-acc-speed) ease;
}
.mb-acc:hover {
  box-shadow: 0 6px 18px rgba(60, 30, 0, 0.12);
}

/* ---------- En-tête cliquable ---------- */
.mb-acc__head {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 20px !important; /* place à droite pour la flèche */
  cursor: pointer;
  user-select: none;
  outline: none;
}
.mb-acc__head:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(103, 0, 0, 0.35);
  border-radius: var(--mb-acc-radius);
}

/* Petite flèche en bas à droite de l'en-tête (pivote à l'ouverture) */
.mb-acc__head::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 12px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--mb-acc-primary);
  transition: transform var(--mb-acc-speed) ease;
  pointer-events: none;
}
.mb-acc.is-open .mb-acc__head::after {
  transform: rotate(180deg);
}

/* Icône ronde bordeaux (widget Image ou Icône avec la classe .mb-acc__icon) */
.mb-acc__icon,
.mb-acc__icon img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.mb-acc__icon img {
  display: block;
}

/* Titre + sous-titre (Heading + Text Editor) */
.mb-acc__title,
.mb-acc__title .elementor-heading-title {
  margin: 0 0 4px !important;
  color: var(--mb-acc-primary);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}
.mb-acc__subtitle,
.mb-acc__subtitle p {
  margin: 0 !important;
  color: var(--mb-acc-text);
  font-size: 0.95rem;
  line-height: 1.35;
}

/* ---------- Contenu déplié ---------- */
.mb-acc__body {
  height: 0;
  overflow: hidden;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  transition: height var(--mb-acc-speed) ease;
  will-change: height;
  /* barre de défilement discrète quand le contenu est plafonné */
  scrollbar-width: thin;
  scrollbar-color: rgba(103, 0, 0, 0.35) transparent;
}
.mb-acc__body::-webkit-scrollbar {
  width: 6px;
}
.mb-acc__body::-webkit-scrollbar-thumb {
  background: rgba(103, 0, 0, 0.35);
  border-radius: 3px;
}
.mb-acc__body::-webkit-scrollbar-track {
  background: transparent;
}
/* Posé par le JS quand le contenu dépasse la hauteur max : on scrolle DANS la carte */
.mb-acc__body.is-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;   /* la molette ne "fuit" pas vers la page */
}

/* Le padding du contenu se met sur un conteneur ENFANT de .mb-acc__body,
   sinon il resterait visible quand la carte est fermée. */
.mb-acc__body > * {
  padding-bottom: 24px;
}

@media (prefers-reduced-motion: reduce) {
  .mb-acc__body,
  .mb-acc__head::after {
    transition: none;
  }
}

/* =========================================================
   DESKTOP (≥ 768px) : le contenu déplié se SUPERPOSE aux
   cartes voisines, plafonné à --mb-acc-max-h (500px) et
   scrollable à l'intérieur. La page n'est jamais poussée.
   ========================================================= */
@media (min-width: 768px) {

  :root {
    --mb-acc-max-h: 500px;   /* hauteur max du panneau déplié */
  }

  /* Le groupe et la carte doivent laisser déborder le panneau */
  .mb-acc-group,
  .mb-acc {
    overflow: visible;
  }

  .mb-acc.is-open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  /* Empilement : la carte ouverte ET tous ses conteneurs parents passent
     au-dessus (les animations d'entrée Elementor créent des contextes
     d'empilement qui feraient sinon passer la ligne du dessous par-dessus). */
  .mb-acc-group .mb-acc.is-open,
  .mb-acc.is-open {
    z-index: 50 !important;
  }
  .mb-acc-has-open {
    z-index: 40 !important;
  }

  /* Le panneau se détache du flux et vient se coller sous l'en-tête */
  .mb-acc__body {
    position: absolute;
    top: 100%;
    left: -1px;               /* aligne avec la bordure de la carte */
    right: -1px;
    z-index: 30;
    background: var(--mb-acc-bg-panel);
    border-top: 0;
    border-radius: 0 0 var(--mb-acc-radius) var(--mb-acc-radius);
    box-shadow: 0 14px 30px rgba(60, 30, 0, 0.18);
  }

  /* Trait fin de séparation en-tête / contenu */
  .mb-acc__body > *:first-child {
    border-top: 1px solid rgba(103, 0, 0, 0.12);
  }
}

/* ---------- Éditeur Elementor : tout est visible pour pouvoir éditer ---------- */
.elementor-editor-active .mb-acc__body {
  height: auto !important;
  overflow: visible;
  position: static !important;  /* dans l'éditeur, on reste en flux pour éditer confortablement */
  box-shadow: none;
}
.elementor-editor-active .mb-acc__head {
  cursor: default;
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  .mb-acc__icon,
  .mb-acc__icon img {
    width: 64px;
    height: 64px;
  }
  .mb-acc__head {
    padding: 16px 36px 20px 16px !important;
  }
}