/* ==========================================================================
   Accordéon — version sans jQuery
   Tous les styles sont préfixés .acc pour ne pas déborder sur la page hôte.
   Personnalisation : modifier les variables ci-dessous.
   ========================================================================== */

.acc {
  --acc-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --acc-text: #1d1d1b;          /* texte courant */
  --acc-muted: #5c5b57;         /* libellés secondaires */
  --acc-bar: #ecebe7;           /* bandeau fermé */
  --acc-bar-hover: #e0ded8;     /* bandeau survolé */
  --acc-bar-open: #2a2a28;      /* bandeau ouvert */
  --acc-bar-open-text: #ffffff;
  --acc-panel: #faf9f7;         /* fond du panneau déplié */
  --acc-line: #d9d6cf;          /* filets */
  --acc-accent: #8a3b2e;        /* filet gauche du texte, focus */
  --acc-radius: 6px;
  --acc-speed: 280ms;

  font-family: var(--acc-font);
  color: var(--acc-text);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.acc *,
.acc *::before,
.acc *::after { box-sizing: border-box; }

/* ---------- Bandeau cliquable ---------- */

.acc-heading {
  margin: 0;
  font: inherit;               /* neutralise le style h2/h3 de la page hôte */
}

.acc-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;            /* cible tactile confortable */
  margin: 0;
  padding: 8px 14px 8px 8px;
  border: 0;
  border-radius: var(--acc-radius);
  background: var(--acc-bar);
  color: var(--acc-text);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease, color 150ms ease;
}

.acc-trigger:hover { background: var(--acc-bar-hover); }

.acc-trigger:focus-visible {
  outline: 3px solid var(--acc-accent);
  outline-offset: 2px;
}

.acc-trigger[aria-expanded="true"] {
  background: var(--acc-bar-open);
  color: var(--acc-bar-open-text);
  border-radius: var(--acc-radius) var(--acc-radius) 0 0;
}

/* Image d'illustration : posée sur une pastille claire pour rester lisible
   sur le bandeau sombre (état ouvert). */
.acc-icon {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 3px;
  border-radius: 4px;
  background: #fff;
  object-fit: contain;
}

.acc-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Libellé « Lire / Fermer » */
.acc-state {
  flex: none;
  font-size: 0.875rem;
  font-weight: 400;
  font-style: italic;
  color: var(--acc-muted);
}
.acc-trigger[aria-expanded="true"] .acc-state { color: rgba(255, 255, 255, 0.75); }
.acc-state-open { display: none; }
.acc-trigger[aria-expanded="true"] .acc-state-open { display: inline; }
.acc-trigger[aria-expanded="true"] .acc-state-closed { display: none; }

/* Signe + / − dessiné en CSS */
.acc-sign {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
}
.acc-sign::before,
.acc-sign::after {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform var(--acc-speed) ease;
}
.acc-sign::after { transform: rotate(90deg); }
.acc-trigger[aria-expanded="true"] .acc-sign::after { transform: rotate(0deg); }

/* ---------- Panneau ---------- */

.acc-panel-inner {
  overflow: hidden;
  min-height: 0;
}

.acc-body {
  padding: 18px 18px 16px;
  background: var(--acc-panel);
  border: 1px solid var(--acc-line);
  border-top: 0;
  border-radius: 0 0 var(--acc-radius) var(--acc-radius);
}

.acc-body p + p { margin-top: 0.8em; }

.acc-text {
  margin: 0 0 14px;
  padding-left: 14px;
  border-left: 3px solid var(--acc-accent);
}

.acc-body p {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  max-width: 68ch;
  hyphens: auto;
}

.acc-close {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--acc-line);
  border-radius: 4px;
  background: #fff;
  color: var(--acc-text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.acc-close:hover { border-color: var(--acc-muted); }
.acc-close:focus-visible {
  outline: 3px solid var(--acc-accent);
  outline-offset: 2px;
}

/* ---------- Comportement dépliant (uniquement si le JS est actif) ----------
   Sans JavaScript, tout le texte reste visible : rien n'est perdu. */

.acc:not(.acc--js) .acc-state,
.acc:not(.acc--js) .acc-sign,
.acc:not(.acc--js) .acc-close { display: none; }
.acc:not(.acc--js) .acc-trigger {
  border-radius: var(--acc-radius) var(--acc-radius) 0 0;
  cursor: default;
}

.acc--js .acc-panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;          /* contenu replié : ni focusable, ni lu par les lecteurs d'écran */
  transition: grid-template-rows var(--acc-speed) ease, visibility 0s linear var(--acc-speed);
}

.acc--js .acc-item.is-open .acc-panel {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows var(--acc-speed) ease, visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
  .acc { --acc-speed: 0ms; }
}

/* ---------- Petits écrans ---------- */

@media (max-width: 480px) {
  .acc-trigger {
    gap: 10px;
    min-height: 56px;
    padding: 6px 12px 6px 6px;
    font-size: 1rem;
  }
  .acc-icon { width: 40px; height: 40px; }
  .acc-state { display: none; }   /* le signe + / − suffit */
  .acc-body { padding: 14px 14px 12px; }
  .acc-body p { font-size: 1rem; }
  .acc-text { padding-left: 12px; }
}
