/* ============================================================
   Workflow de procédure — schéma interactif (design hybride)
   Flux horizontal de nœuds (acteurs) + cartes déroulables.
   Phase 3 : étapes monochromes. L'acteur est nommé et illustré par son pictogramme ;
   la couleur ne sert plus qu'à deux choses : l'étape ouverte (accent du site) et les
   délais, mis en avant parce que c'est ce que le demandeur cherche.
   ============================================================ */

.wf {
  --wf-c: var(--navy);
  --wf-soft: rgba(11,29,58,0.06);
  margin: 8px 0 8px;
}

/* ---- En-tête : base légale + délai global ---- */
.wf-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 30px;
}
.wf-head-text { flex: 1 1 320px; min-width: 0; }
/* h2 depuis la phase 1 : neutraliser le filet doré et le retrait de .page-content h2 */
.page-content .wf-title { padding-left: 0; line-height: normal; }
.page-content .wf-title::before { content: none; }
/* .page-content h3 (700) l'emportait : DM Serif n'existe qu'en 400 */
.wf-title, .page-content .wf-title { font-family: var(--font-serif); font-size: var(--fs-h2); color: var(--navy); margin: 0 0 8px; font-weight: 400; }
.wf-legal { font-size: var(--fs-small); color: var(--text-secondary); line-height: 1.6; }
.wf-legal p { margin: 0; }
.wf-total {
  flex: 0 1 auto; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 100%;
  padding: 12px 20px; border-radius: var(--radius-lg);
  background: var(--navy); color: var(--on-dark);
}
.wf-total svg { width: 26px; height: 26px; color: var(--accent-on-dark, var(--gold)); flex-shrink: 0; }
.wf-total-label { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.72); }
.wf-total-value { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; }
.wf-total-note { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.72); border-left: 1px solid rgba(255,255,255,0.18); padding-left: 10px; }

/* ---- Pastille de délai (nœuds et cartes) ---- */
.wf-delay {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: var(--fs-small); font-weight: 800; line-height: 1.2;
  padding: 4px 10px 4px 8px; border-radius: var(--radius-pill);
  background: var(--accent-soft, rgba(214,167,75,0.12)); color: var(--accent-text, var(--gold-ink));
}
.wf-delay svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---- Vue d'ensemble : flux horizontal ---- */
.wf-flow {
  display: flex; align-items: stretch; gap: 4px;
  overflow-x: auto; padding: 6px 2px 16px; margin-bottom: 8px;
  scrollbar-width: thin;
}
.wf-node {
  position: relative; flex: 1 0 168px; max-width: 230px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 16px 16px 15px; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; text-align: left;
  transition: transform var(--dur-base) ease, box-shadow var(--dur-base) ease, border-color var(--dur-base) ease;
}
/* Repère de l'étape ouverte : filet d'accent en haut du nœud */
.wf-node::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: -1px; height: 3px;
  border-radius: 0 0 3px 3px; background: transparent; transition: background var(--dur-base) ease;
}
.wf-node:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-muted); }
.wf-node.is-active { border-color: var(--navy); box-shadow: var(--shadow-md); }
.wf-node.is-active::before { background: var(--accent, var(--gold)); }
.wf-node-top { display: flex; align-items: center; gap: 10px; width: 100%; }
.wf-node-num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-caption); font-weight: 800; line-height: 1;
  border: 1.5px solid var(--navy); color: var(--navy); background: var(--surface);
}
.wf-node.is-active .wf-node-num { background: var(--navy); color: var(--on-dark); }
.wf-node-ic { width: 34px; height: 34px; margin-left: auto; border-radius: var(--radius-md); background: var(--wf-soft); color: var(--navy); display: flex; align-items: center; justify-content: center; }
.wf-node-ic svg { width: 19px; height: 19px; }
.wf-node-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.wf-node-title { font-size: var(--fs-small); font-weight: 700; color: var(--navy); line-height: 1.28; }
.wf-node-actor { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--text-secondary); line-height: 1.3; }
.wf-node .wf-delay { margin-top: auto; }
.wf-connector { flex: 0 0 22px; display: flex; align-items: center; justify-content: center; color: var(--line-muted); }
.wf-connector svg { width: 22px; height: 22px; }

/* ---- Cartes déroulables ---- */
.wf-cards { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.wf-card { position: relative; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; transition: box-shadow var(--dur-base) ease, border-color var(--dur-base) ease; }
.wf-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; transition: background var(--dur-base) ease; }
.wf-card.is-open { box-shadow: var(--shadow-md); border-color: var(--line-muted); }
.wf-card.is-open::before { background: var(--accent, var(--gold)); }
.wf-card-head { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: none; border: none; cursor: pointer; text-align: left; }
.wf-card-num { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--navy); color: var(--navy); font-weight: 800; font-size: var(--fs-small); display: flex; align-items: center; justify-content: center; }
.wf-card.is-open .wf-card-num { background: var(--navy); color: var(--on-dark); }
.wf-card-ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: var(--radius-md); background: var(--wf-soft); color: var(--navy); display: flex; align-items: center; justify-content: center; }
.wf-card-ic svg { width: 19px; height: 19px; }
.wf-card-titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wf-card-actor { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--text-secondary); }
.wf-card-title { font-size: var(--fs-body); font-weight: 700; color: var(--navy); }
.wf-card-chevron { flex: 0 0 auto; width: 20px; height: 20px; color: var(--text-light); transition: transform var(--dur-base) ease; }
.wf-card.is-open .wf-card-chevron { transform: rotate(180deg); }
.wf-card-body { max-height: 0; overflow: hidden; transition: max-height var(--dur-slow) ease; }
.wf-card.is-open .wf-card-body { max-height: 900px; }
.wf-card-body-inner { padding: 0 18px 20px 110px; } /* aligné sur l’intitulé : 18 + 30 + 14 + 34 + 14 */
.wf-card-summary { margin: 0 0 14px; color: var(--text-primary); font-size: var(--fs-body); line-height: 1.6; max-width: 72ch; }
.wf-items-label { margin: 0 0 8px; font-size: var(--fs-caption); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--navy); }
.wf-card-items { font-size: var(--fs-small); color: var(--text-secondary); line-height: 1.6; }
.wf-card-items ul { margin: 0; padding-left: 18px; }
.wf-card-items li { margin-bottom: 5px; }
.wf-card-items li::marker { color: var(--line-muted); }
.wf-card-items strong { color: var(--navy); }

/* Pièces à fournir : liste à cocher sur deux colonnes, chaque pièce dans sa case */
.wf-card-items--pieces ul {
  list-style: none; padding: 0; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
}
.wf-card-items--pieces li {
  position: relative; margin: 0; padding: 10px 12px 10px 40px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-alt);
  color: var(--text-primary); line-height: 1.45;
}
/* Pictogramme « document » dessiné en masque : il prend la couleur du texte d'accent */
.wf-card-items--pieces li::before {
  content: ""; position: absolute; left: 13px; top: 11px; width: 17px; height: 17px;
  background: var(--accent-text, var(--gold-ink));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M9 14l2 2 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M9 14l2 2 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- Responsive : flux en colonne ---- */
@media (max-width: 1024px) {
  .wf-flow { flex-direction: column; align-items: stretch; overflow: visible; }
  .wf-node { max-width: none; flex: 1 1 auto; flex-direction: row; align-items: center; gap: 14px; }
  .wf-node::before { left: -1px; right: auto; top: 12px; bottom: 12px; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .wf-node-top { width: auto; }
  .wf-node-ic { margin-left: 0; }
  .wf-node-text { flex: 1 1 auto; }
  .wf-node .wf-delay { margin-top: 0; }
  .wf-connector { transform: rotate(90deg); flex-basis: 18px; }
  .wf-card-body-inner { padding-left: 18px; }
}
@media (max-width: 640px) {
  /* Le pictogramme d'acteur s'efface : numéro, intitulé et acteur écrits suffisent */
  .wf-node-ic, .wf-card-ic { display: none; }
  .wf-node { gap: 12px; }
  /* Carte : numéro | intitulés | chevron, le délai passe sous l'intitulé */
  .wf-card-head { display: grid; grid-template-columns: 30px minmax(0, 1fr) 20px; align-items: center; gap: 8px 12px; }
  .wf-card-num { grid-area: 1 / 1; }
  .wf-card-titles { grid-area: 1 / 2; }
  .wf-card-chevron { grid-area: 1 / 3; }
  .wf-card-head .wf-delay { grid-area: 2 / 2; justify-self: start; }
}
