/* ==========================================================
   Krea3 Accordéon – Style standard + institutionnel
   Version : 1.3
   - Compatibilité contenu long
   - Animation fluide
   - Gestion .is-open (via JS)
========================================================== */

/* ---------- Structure de base ---------- */
.krea3-accordeon-wrap {
  border-top: 1px solid #ddd;
}
.krea3-accordeon-item {
  border-bottom: 1px solid #ddd;
  transition: background-color 0.3s ease;
}
.krea3-accordeon-title {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1rem;
  font-size: 1.1rem;
  cursor: pointer;
  font-weight: 600;
  position: relative;
  color: #222;
  background-color: #fff;
  transition: background-color 0.3s, color 0.3s;
}
.krea3-accordeon-title:hover {
  background: #f7f7f7;
}

/* ---------- Icône + / - ---------- */
.krea3-accordeon-title::after {
  content: '+';
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  font-weight: bold;
  color: #777;
  transition: transform 0.3s, color 0.3s;
}

/* ---------- Accordéon ouvert ---------- */
.krea3-accordeon-title[aria-expanded="true"] {
  background-color: #f0f8f8;
  color: #086868;
}
.krea3-accordeon-title[aria-expanded="true"]::after {
  content: '–';
  color: #086868;
  transform: translateY(-50%) rotate(180deg);
}

/* ---------- Focus & accessibilité ---------- */
.krea3-accordeon-title:hover,
.krea3-accordeon-title:focus {
  background-color: #f7f7f7;
  outline: none;
}
.krea3-accordeon-title:focus-visible {
  outline: 2px solid #086868;
  outline-offset: 3px;
}

/* ---------- Contenu (animation + contenu long) ---------- */
.krea3-accordeon-content {
  padding: 1rem;
  overflow: hidden;
  opacity: 0;
  max-height: 0;
  transition: max-height 0.6s ease, opacity 0.4s ease;
  will-change: max-height, opacity;
}

.krea3-accordeon-content[hidden] {
  display: none;
}

/* État ouvert (via JS .is-open ou aria) */
.krea3-accordeon-content.is-open,
.krea3-accordeon-title[aria-expanded="true"] + .krea3-accordeon-content {
  opacity: 1;
  max-height: 9999px; /* contenu très long visible */
  overflow: visible;
}

.krea3-accordeon-item.is-open {
  background-color: #f8fdfd;
}

/* ---------- Variante à onglets latéraux ---------- */
.krea3-tabs-wrap {
  display: grid;
  grid-template-columns: minmax(180px, 28%) minmax(0, 1fr);
  border: 1px solid #ddd;
  background: #fff;
}
.krea3-tabs-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #ddd;
  background: #f5f6f7;
}
.krea3-tab-title {
  width: 100%;
  margin: 0;
  padding: 1rem 1.15rem;
  border: 0;
  border-bottom: 1px solid #ddd;
  background: transparent;
  color: #222;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-align: left;
}
.krea3-tab-title:hover,
.krea3-tab-title[aria-selected="true"] {
  background: var(--couleur-principale, #086868);
  color: #fff;
}
.krea3-tab-title:focus-visible,
.krea3-tab-content:focus-visible {
  outline: 3px solid var(--couleur-secondaire, #086868);
  outline-offset: -3px;
}
.krea3-tabs-panels {
  min-width: 0;
}
.krea3-tab-content {
  box-sizing: border-box;
  min-height: 100%;
  padding: clamp(1.25rem, 3vw, 2.25rem);
}
.krea3-tab-content[hidden] {
  display: none;
}

.krea3-tabs-wrap.style-instit {
  border: 0;
  border-radius: 6px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, .12);
  overflow: hidden;
}
.krea3-tabs-wrap.style-instit .krea3-tabs-list {
  border-right: 0;
  background: var(--couleur-principale, #086868);
}
.krea3-tabs-wrap.style-instit .krea3-tab-title {
  border-bottom-color: rgba(255, 255, 255, .24);
  color: #fff;
}
.krea3-tabs-wrap.style-instit .krea3-tab-title:hover,
.krea3-tabs-wrap.style-instit .krea3-tab-title[aria-selected="true"] {
  background: var(--couleur-secondaire, #086868);
}
.krea3-tabs-wrap.style-instit .krea3-tab-content {
  border-top: 5px solid var(--couleur-secondaire, #086868);
}

@media (max-width: 700px) {
  .krea3-tabs-wrap {
    grid-template-columns: 1fr;
  }
  .krea3-tabs-list {
    border-right: 0;
    border-bottom: 1px solid #ddd;
  }
  .krea3-tabs-wrap.style-instit .krea3-tabs-list {
    border-bottom: 0;
  }
}

/* Amélioration visuelle pour contenu */
.krea3-accordeon-content p:last-child {
  margin-bottom: 0;
}

/* ==========================================================
   Variante institutionnelle Krea3 Accordéon
   Activez-la en ajoutant la classe .style-instit
   Ex : <div class="krea3-accordeon-wrap style-instit">
========================================================== */

.krea3-accordeon-wrap.style-instit {
  border: none;
  background: #f9f9f9;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Titre institutionnel */
.krea3-accordeon-wrap.style-instit .krea3-accordeon-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #064949;
  background-color: #eaf5f5;
  border: none;
  border-left: 5px solid #086868;
  margin: 0;
  padding: 1.1rem 3rem 1.1rem 1.2rem;
  transition: background-color 0.3s, color 0.3s;
}
.krea3-accordeon-wrap.style-instit .krea3-accordeon-title::after {
  content: '+';
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: #086868;
  transition: transform 0.3s, color 0.3s;
}

/* Titre ouvert */
.krea3-accordeon-wrap.style-instit .krea3-accordeon-title[aria-expanded="true"] {
  background-color: #d8f0f0;
  color: #043f3f;
}
.krea3-accordeon-wrap.style-instit .krea3-accordeon-title[aria-expanded="true"]::after {
  content: '–';
  transform: translateY(-50%) rotate(180deg);
}

/* Contenu institutionnel (animation + contenu long) */
.krea3-accordeon-wrap.style-instit .krea3-accordeon-content {
  background-color: #fff;
  border-left: 5px solid #086868;
  padding: 1.2rem 1.5rem;
  font-size: 1rem;
  color: #333;
  line-height: 1.6;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.05);
  overflow: hidden;
  opacity: 0;
  max-height: 0;
  transition: max-height 0.6s ease, opacity 0.4s ease;
  will-change: max-height, opacity;
}

/* État ouvert : visible sans limite */
.krea3-accordeon-wrap.style-instit .krea3-accordeon-content.is-open,
.krea3-accordeon-wrap.style-instit .krea3-accordeon-title[aria-expanded="true"] + .krea3-accordeon-content {
  max-height: 9999px;
  opacity: 1;
  overflow: visible;
}

/* Hover & focus */
.krea3-accordeon-wrap.style-instit .krea3-accordeon-title:hover,
.krea3-accordeon-wrap.style-instit .krea3-accordeon-title:focus-visible {
  background-color: #d2ecec;
  outline: none;
}

/* Liens dans le contenu */
.krea3-accordeon-wrap.style-instit .krea3-accordeon-content a {
  color: #086868;
  text-decoration: underline;
  font-weight: 500;
}
.krea3-accordeon-wrap.style-instit .krea3-accordeon-content a:hover {
  color: #043f3f;
  text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  .krea3-accordeon-item,
  .krea3-accordeon-title,
  .krea3-accordeon-title::after,
  .krea3-accordeon-content,
  .krea3-accordeon-wrap.style-instit .krea3-accordeon-title,
  .krea3-accordeon-wrap.style-instit .krea3-accordeon-content {
    transition: none !important;
  }
}
